Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(n8n): cap the Discord message at 2000 characters

Yudhi Armyndharisd08d571da696
diff --git a/docs/examples/n8n/README.md b/docs/examples/n8n/README.md
index 11c7f2413..baf5861aa 100644
--- a/docs/examples/n8n/README.md
+++ b/docs/examples/n8n/README.md
@@ -55,4 +55,4 @@ This workflow expects the standard OpenWA webhook payload for the `message.recei
}
```
-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.
+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. Discord rejects a message over 2000 characters, and n8n has already answered OpenWA by then, so nothing would retry it; the workflow therefore cuts a longer message at 2000 characters.
diff --git a/docs/examples/n8n/workflow.json b/docs/examples/n8n/workflow.json
index e03f5bf6b..d9bede661 100644
--- a/docs/examples/n8n/workflow.json
+++ b/docs/examples/n8n/workflow.json
@@ -19,7 +19,7 @@
"url": "https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN",
"sendBody": true,
"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: [] } }) }}",
+ "jsonBody": "={{ JSON.stringify({ content: ('*New WhatsApp Message*\\n**From:** `' + ($json.body.data.author || $json.body.data.from) + '`\\n**Message:** ' + ($json.body.data.body || '')).slice(0, 2000), allowed_mentions: { parse: [] } }) }}",
"options": {}
},
"name": "Post to Discord",