orvachat

Getting Started

Using orvachat with n8n

Receive WhatsApp messages in n8n and send replies with the HTTP Request node.

n8n can receive WhatsApp messages from orvachat and send replies, without writing a server. You need two nodes: a Webhook node to receive, and an HTTP Request node to send.

Receive messages

  1. Add a Webhook node. Set HTTP Method to POST. Copy its Production URL.
  2. Paste that URL as the webhook URL on the Developer API page. Keep the Message event on.
  3. Activate the workflow, then press Send test event on the Developer API page. The test event shows up in n8n.
  4. The message text is in {{ $json.body.event.Message.conversation }}, and the chat to reply to is in {{ $json.body.event.Info.Chat }}. See How To Receive Messages.

Only answer new messages

Your webhook also gets other events (for example ReadReceipt and the test event), and a Message event for every message you send from the phone. Don't reply to those.

  1. Add an IF node after the Webhook node (after the Code node, if you check the signature).
  2. Condition 1: {{ $json.body.type }} is equal to Message.
  3. Condition 2 (AND): {{ $json.body.event.Info.IsFromMe }} is false.
  4. Connect the true output to the HTTP Request node below. If you don't need read ticks, turn ReadReceipt off on the Developer API page.

Send a reply

  1. Add an HTTP Request node. Method POST, URL https://orvachat.com/api/v1/chat/send/text.
  2. Authentication: Generic Credential Type → Header Auth. Name Authorization, Value Bearer YOUR_API_KEY.
  3. Body: JSON, for example { "Phone": "{{ $json.body.event.Info.Chat }}", "Body": "Thanks, we got your message" }.

Check the signature (optional, recommended)

Add a Code node after the Webhook node. It stops the workflow when the X-Webhook-Signature header is wrong.

Code node
// n8n Code node ("Run Once for Each Item")
const crypto = require("crypto");

const secret = "YOUR_SIGNING_SECRET";
const raw = JSON.stringify($json.body); // see the note below
const header = $json.headers["x-webhook-signature"] ?? "";
const expected = "sha256=" + crypto.createHmac("sha256", secret).update(raw).digest("hex");

if (header !== expected) throw new Error("Bad signature");
return $input.item;

Tip

On self-hosted n8n the Code node can only load crypto when you start n8n with NODE_FUNCTION_ALLOW_BUILTIN=crypto.

The signature is made from the exact body we send. Re-encoding $json.body usually gives the same text, but for a sure match turn on the Webhook node's Raw Body option and sign that instead.

Important

The API works only for numbers in Developer API mode. In AI Agent mode the API answers 403 and the agent replies instead. Change a number's mode in your orvachat dashboard.