Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs: fix the n8n to Discord example setup

Yudhi Armyndharis5de56fa866ed
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 36b634f27..bc288443d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The dashboard Chats thread renders an `@<digits>` mention as `@FirstName` when that participant has posted in the loaded thread and their id matches the digits in the body. This covers whatsapp-web.js, where the author id and the mention carry the same digits. On Baileys the author is normalized to the phone number when the lid mapping is known while the body keeps the lid digits, so those mentions stay as WhatsApp sent them, as does any mention of someone who has not posted. The resolved name renders inside its own `<bdi>` element, outside Linkify's `ignoreTags`-respected walk, so a push name can never become a clickable link, however it's spelled. Thanks @TanmayChachra.
+### Documentation
+
+- An n8n example forwards incoming WhatsApp messages to a Discord channel with n8n's built-in Webhook and HTTP Request nodes, without the OpenWA community node. Thanks @probably-ABHINAV.
+
## [0.23.6] - 2026-09-23
### Added
diff --git a/docs/22-n8n-integration.md b/docs/22-n8n-integration.md
index f9b48d538..a2dca8ea1 100644
--- a/docs/22-n8n-integration.md
+++ b/docs/22-n8n-integration.md
@@ -337,6 +337,7 @@ docker run -it --rm \
- [OpenWA API Specification](./06-api-specification.md)
- [Webhook System](./03-system-architecture.md#353-webhook-system)
- [n8n Appointment Booking Workflow](./examples/n8n-appointment-booking.md)
+- [n8n to Discord Workflow](./examples/n8n/README.md), built from n8n's own Webhook and HTTP Request nodes
- [n8n Documentation](https://docs.n8n.io/)
---
diff --git a/docs/23-community-integrations.md b/docs/23-community-integrations.md
index 55339d71c..63615ecd0 100644
--- a/docs/23-community-integrations.md
+++ b/docs/23-community-integrations.md
@@ -13,7 +13,6 @@ Third-party integrations and adapters built by the community on top of OpenWA's
| Integration | Platform | Source | Notes |
| ------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **ioBroker.openwa** | [ioBroker](https://www.iobroker.net/) (home / IoT automation) | [ThorstenBoettler/ioBroker.openwa](https://github.com/ThorstenBoettler/ioBroker.openwa) · [npm](https://www.npmjs.com/package/iobroker.openwa) | Send text / image / video / audio / document messages to chats and groups through OpenWA's REST API, with Blockly blocks. Early stage. |
-| **n8n to Discord** | [n8n](https://n8n.io/) (workflow automation) | [docs/examples/n8n](./examples/n8n) | A minimal workflow template to receive OpenWA webhooks and post incoming messages to a Discord channel using built-in n8n HTTP nodes. |
Maintain an integration built on OpenWA and want it listed here? Open a PR adding a row (or an issue), including the repository link and a one-line description.
diff --git a/docs/README.md b/docs/README.md
index 4b79e9723..e65deada6 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -72,6 +72,7 @@
| [Chat History Limits](./examples/chat-history-limits.md) | Understand local message history vs bounded live WhatsApp history |
| [Webhook Signature Verification](./examples/webhook-signature-verification.md) | Verify signed OpenWA webhook deliveries in Node.js and Python |
| [n8n Appointment Booking Workflow](./examples/n8n-appointment-booking.md) | Build an appointment-booking flow with OpenWA and n8n |
+| [n8n to Discord Workflow](./examples/n8n/README.md) | Forward incoming WhatsApp messages to Discord with n8n's built-in nodes |
## Quick Start
diff --git a/docs/examples/n8n/README.md b/docs/examples/n8n/README.md
index 624c88593..78708b809 100644
--- a/docs/examples/n8n/README.md
+++ b/docs/examples/n8n/README.md
@@ -11,9 +11,23 @@ This example demonstrates how to receive OpenWA webhooks using n8n and forward i
## Setup
1. **Import the Workflow**: Open n8n, click the "Import from file" option, and select the [`workflow.json`](./workflow.json) file.
-2. **Environment Variable**: The workflow expects a Discord webhook URL. Define it as an environment variable in n8n (`DISCORD_WEBHOOK_URL`), or manually paste your webhook URL into the URL field of the HTTP Request node.
-3. **Get the Webhook URL**: Activate the workflow and copy the **Production URL** from the OpenWA Webhook node (e.g., `https://n8n.example.com/webhook/openwa-discord`).
-4. **Register in OpenWA**: Send a POST request to your OpenWA server to register the webhook URL, subscribing to the `message.received` event.
+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.
+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:
+
+ ```bash
+ curl -X POST https://openwa.example.com/api/sessions/<sessionId>/webhooks \
+ -H "X-API-Key: <your API key>" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "url": "https://n8n.example.com/webhook/openwa-discord",
+ "events": ["message.received"],
+ "headers": { "X-Webhook-Token": "<the same random value>" }
+ }'
+ ```
+
+ If n8n is only reachable at a private address (`localhost`, a Docker service name), add its host to `SSRF_ALLOWED_HOSTS` on the OpenWA server, or the registration is refused with `400`. The other webhook options, including a `secret` that signs every delivery, are in the [API Specification](../../06-api-specification.md) and [Webhook Signature Verification](../webhook-signature-verification.md).
### API Key Scope
@@ -21,7 +35,7 @@ The API key used to register the webhook in OpenWA needs the **`OPERATOR`** role
### Webhook Payload Expected
-This workflow expects the standard OpenWA webhook payload for the `message.received` event.
+This workflow expects the standard OpenWA webhook payload for the `message.received` event.
```json
{
@@ -41,4 +55,4 @@ This workflow expects the standard OpenWA webhook payload for the `message.recei
}
```
-The workflow automatically extracts `{{ $json.body.data.from }}` and `{{ $json.body.data.body }}` to format the Discord message.
+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.
diff --git a/docs/examples/n8n/workflow.json b/docs/examples/n8n/workflow.json
index 836f1a0d1..7cc47b44c 100644
--- a/docs/examples/n8n/workflow.json
+++ b/docs/examples/n8n/workflow.json
@@ -16,13 +16,13 @@
{
"parameters": {
"method": "POST",
- "url": "={{ $env.DISCORD_WEBHOOK_URL }}",
+ "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.from }}`\n**Message:** {{ $json.body.data.body }}"
+ "value": "=*New WhatsApp Message*\n**From:** `{{ $json.body.data.author || $json.body.data.from }}`\n**Message:** {{ $json.body.data.body }}"
}
]
},