Integrations / Rocket.Chat

Rocket.Chat logo

Team chat · Integrations webhooks with scripts

Rocket.Chat + Sendjade

Bridge Rocket.Chat rooms and WhatsApp with outgoing and incoming webhook scripts.

Live API · real-phone check pending

What you can automate

  • Forward a Rocket.Chat message to a WhatsApp number
  • Show incoming WhatsApp messages in a room
  • Let agents answer WhatsApp customers from Rocket.Chat

Before you start

  • A Sendjade account with a connected instance (status Authorized). See Getting started.
  • Your **idInstance** (shown on the instance page in the console) and **apiTokenInstance** (shown once when you created the instance; press Generate new token if you lost it). Use a spare number while testing.
  • Rocket.Chat admin access to **Administration, Integrations**.

Set it up

  1. Rocket.Chat to WhatsApp

    Create an Outgoing WebHook triggered on messages in a room (use a trigger word such as !wa). Enable Script, and paste:

    Outgoing script
    class Script {
      prepare_outgoing_request({ request }) {
        const [, to, ...rest] = request.data.text.split(' '); // !wa 2348012345678 hello
        return {
          url: 'https://api.sendjade.com/waInstanceYOUR_ID_INSTANCE/sendMessage/YOUR_API_TOKEN_INSTANCE',
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          data: { chatId: to.replace(/\D/g, ''), message: rest.join(' ') },
        };
      }
    }
  2. WhatsApp to Rocket.Chat

    Create an Incoming WebHook, enable Script, and register its URL as a Sendjade webhook endpoint for message.received. Sendjade posts its normal JSON; the script turns it into a room message.

    Incoming script
    class Script {
      process_incoming_request({ request }) {
        const e = request.content;
        if (e.event !== 'message.received') return { content: { text: '' } };
        return { content: { text: '*WhatsApp ' + (e.data.senderName || e.data.chatId) + ':* ' + e.data.text } };
      }
    }

Test it

In the room type `!wa <your number> hello` and check your phone.

Troubleshooting

The webhook does not fire

Outgoing webhooks need the exact trigger word at the start of the message and the correct channel. Check the integration history for the request and response.

I get 401 unauthorized

The idInstance or token in the URL is wrong. Copy both again from the console. Generating a new token makes the old one stop working immediately.

I get 409 instance_not_connected

The instance is not Authorized yet. Open it in the console, press Connect and scan the QR code.

I get 400 invalid_chat_id

Use international format with digits only, e.g. 2348012345678 (or 2348012345678@c.us). Remove spaces, dashes and the leading zero of the local number.

I get 422 recipient_opted_out

That person replied STOP (or was added to the opt-out list). Sendjade refuses to message them. Remove the number from Opt-outs only if they asked to hear from you again.

I get 429 daily_limit_reached or rate_limited

The number reached its 24-hour sending cap (default 500) or you are calling too fast. The cap protects your number from restriction. Slow down, and raise the cap only if your volume is genuine.

Ask AI to help me integrate Rocket.Chat

Copy this prompt into ChatGPT, Claude or any assistant. It already knows Sendjade’s API, so the answer matches our endpoints.

The prompt is plain text that you copy yourself. Never paste real keys into an assistant; use placeholders.