Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(n8n): stop the Discord example from pinging the channel

Yudhi Armyndharisebecd6894384
diff --git a/docs/examples/n8n/README.md b/docs/examples/n8n/README.md
index 78708b809..11c7f2413 100644
--- a/docs/examples/n8n/README.md
+++ b/docs/examples/n8n/README.md
@@ -12,7 +12,7 @@ This example demonstrates how to receive OpenWA webhooks using n8n and forward i
1. **Import the Workflow**: Open n8n, click the "Import from file" option, and select the [`workflow.json`](./workflow.json) file.
2. **Set the Discord Webhook URL**: Open the Post to Discord node and replace the placeholder URL with your Discord webhook URL. Paste the URL itself rather than reading it from `$env`: n8n 2.0 and later block `$env` in expressions by default.
-3. **Protect the Webhook**: Open the OpenWA Webhook node, set **Authentication** to **Header Auth**, and create a Header Auth credential with **Name** `X-Webhook-Token` and a long random **Value**. Without it, anyone who learns the URL can post into your Discord channel.
+3. **Protect the Webhook**: Open the OpenWA Webhook node, set **Authentication** to **Header Auth**, and create a Header Auth credential with **Name** `X-Webhook-Token` and a long random **Value**. Without it, anyone who learns the URL can post into your Discord channel. Header Auth only guards the n8n URL: the message text still comes from any WhatsApp sender, so the workflow sends it with Discord's `allowed_mentions: { "parse": [] }` and a message cannot ping `@everyone`, `@here`, a role, or a user.
4. **Get the Webhook URL**: Publish the workflow (activate it on n8n 1.x) and copy the **Production URL** from the OpenWA Webhook node (e.g., `https://n8n.example.com/webhook/openwa-discord`).
5. **Register in OpenWA**: Register the Production URL for the `message.received` event, with the same header and value:
@@ -55,4 +55,4 @@ This workflow expects the standard OpenWA webhook payload for the `message.recei
}
```
-The workflow posts `{{ $json.body.data.author || $json.body.data.from }}` as the sender and `{{ $json.body.data.body }}` as the message. In a group, `from` is the group and `author` is the member who sent the message; a direct message has no `author`, so `from` is used.
+The workflow posts `data.author || data.from` as the sender and `data.body` as the message. In a group, `from` is the group and `author` is the member who sent the message; a direct message has no `author`, so `from` is used.
diff --git a/docs/examples/n8n/workflow.json b/docs/examples/n8n/workflow.json
index 7cc47b44c..e03f5bf6b 100644
--- a/docs/examples/n8n/workflow.json
+++ b/docs/examples/n8n/workflow.json
@@ -18,14 +18,8 @@
"method": "POST",
"url": "https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN",
"sendBody": true,
- "bodyParameters": {
- "parameters": [
- {
- "name": "content",
- "value": "=*New WhatsApp Message*\n**From:** `{{ $json.body.data.author || $json.body.data.from }}`\n**Message:** {{ $json.body.data.body }}"
- }
- ]
- },
+ "specifyBody": "json",
+ "jsonBody": "={{ JSON.stringify({ content: '*New WhatsApp Message*\\n**From:** `' + ($json.body.data.author || $json.body.data.from) + '`\\n**Message:** ' + ($json.body.data.body || ''), allowed_mentions: { parse: [] } }) }}",
"options": {}
},
"name": "Post to Discord",