Connect WhatsApp to n8n: Build an Auto-Reply Workflow
n8n is good at the logic: branching, calling other tools, handing a question to an AI agent. The WSAPI community node gives it a WhatsApp end: 101 operations across 11 resources (messages, chats, groups, contacts, media and more) plus a trigger that fires when a message arrives. This guide builds the smallest workflow that is actually useful: receive a message, ignore your own, and answer.
Everything below was run on n8n 2.35.7 with version 3.0.0 of the node.
What you need
A WSAPI instance with a WhatsApp number paired to it, which the quickstart covers in a few minutes, and an n8n reachable from the internet, because messages arrive as webhooks.
Install the node
In n8n, open Settings, Community Nodes, choose Install, and enter @wsapichat/n8n-nodes-wsapi. On a self-hosted n8n you can also run npm install @wsapichat/n8n-nodes-wsapi in the n8n directory and restart it. It is a community package, so check that your n8n setup allows community nodes.
Create the credential
Add a WSAPI API credential with your API key and instance ID, and leave the base URL as it is. The Webhook Signing Secret field matters more than it looks: it must hold the same value as the Event Signature Secret in your WSAPI settings.
Wire up the webhook
Add the WSAPI Trigger node and select the Message event. Copy its Production URL into the Webhook URL field at wsapi.chat/app/settings, with the delivery mode set to Webhook. Two things trip people up. The node does not register that URL with WSAPI for you, so the paste is manual. And the production URL only works while the workflow is active: an inactive one answers 404.
With a secret in the credential, the node checks the signature on the raw request body. We sent it one request with no signature and one with a wrong signature: both got a 401 and never started the workflow. Without a secret, anyone who learns the URL can post fake messages into your workflow, so set it in both places.
Reply, without answering yourself
The trigger flattens the event, so a message exposes {{ $json.text }}, {{ $json.chatId }} and {{ $json.sender.id }} directly. An If node lets the message through only when sender.isMe is false, so the workflow never answers the account's own messages. The reply is a WSAPI node set to Message, Send Text, sending to chatId, the chat the message came from.
The whole workflow
Paste this onto the canvas of a new workflow, or save it as a .json file and use Import from File. Then select your WSAPI credential in the trigger and in the Reply node.
{
"name": "WhatsApp auto-reply",
"nodes": [
{
"parameters": { "events": ["message"] },
"name": "WSAPI Trigger",
"type": "@wsapichat/n8n-nodes-wsapi.wsApiTrigger",
"typeVersion": 1,
"position": [0, 0]
},
{
"parameters": {
"conditions": {
"options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 },
"conditions": [
{
"id": "not-from-me",
"leftValue": "={{ $json.sender.isMe }}",
"rightValue": "",
"operator": { "type": "boolean", "operation": "false", "singleValue": true }
}
],
"combinator": "and"
},
"options": {}
},
"name": "Not from me",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [240, 0]
},
{
"parameters": {
"resource": "message",
"operation": "sendText",
"to": "={{ $json.chatId }}",
"message": "=You said: {{ $json.text }}"
},
"name": "Reply",
"type": "@wsapichat/n8n-nodes-wsapi.wsApi",
"typeVersion": 1,
"position": [480, -80]
}
],
"connections": {
"WSAPI Trigger": { "main": [[{ "node": "Not from me", "type": "main", "index": 0 }]] },
"Not from me": { "main": [[{ "node": "Reply", "type": "main", "index": 0 }], []] }
},
"settings": {}
}We ran this exact workflow against a fake instance and a local stand-in for the API. A signed message from someone else produced a POST /messages/text with the X-Api-Key and X-Instance-Id headers and the body {"to": "1234567890@s.whatsapp.net", "text": "You said: Hello"}. The same event with isMe true stopped at the If node and sent nothing.
Where to take it
Swap the Reply node for whatever your process needs: look up an order, write to a spreadsheet, open a ticket. The WSAPI node is flagged as usable as a tool, so it can also sit under an n8n AI Agent. The trigger has an Auto-Download Media option for incoming files. Event types and payloads are in the webhooks and SSE reference, and the node has its own docs page.
There is no fee per message. Pricing starts at $5.00 per instance per month with a 14 day trial and no credit card.
FAQ
Do I need the n8n WhatsApp Business node?
No. This node talks to your WSAPI instance, so there is no Meta business verification and no template approval in the way.
Can my WhatsApp number get blocked?
Any unofficial API carries that risk, so avoid sending unsolicited bulk messages from an automation.