whatsapp automation - verifying meta's webhook
Hey Guys,
I have been struggling getting whatsapp business working. I cant get the webhook working that would do the verification for meta to start using whatsapp business. (it is a silly problem really): I cant get the webhook to return test123, instead it returns {"directResponse":{"directResponse":"test123"}}
I have been debugging for an hour with 4o and it keeps going circles.
I guess anybody here who has built a working whatsapp tool had solved this, so would appreciate if you could share the right way to handle this.
here is my json:
{
"name": "Whatsapp webhook verification",
"nodes": [
{
"parameters": {
"path": "whatsapp-webhook",
"responseMode": "responseNode",
"options": {}
},
"id": "webhook-node-id",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
780,
3260
],
"webhookId": "ddc6e9e5-0ec1-4102-9769-c0e352befdf6"
},
{
"parameters": {
"jsCode": "// Get the query parameters\nconst query = items[0].json.query;\n\n// Check if it is a verification request\nif (query && query[\"hub.mode\"] === \"subscribe\" && query[\"hub.verify_token\"] === \"test\") {\n return [\n {\n json: {\n challenge: query[\"hub.challenge\"]\n }\n }\n ];\n}\n\n// Not a verification request\nreturn [\n {\n json: {\n message: \"Not a verification request\"\n }\n }\n];"
},
"id": "code-node-id",
"name": "Code",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1280,
3140
]
},
{
"parameters": {
"options": {
"responseCode": "=200"
},
"responseBody": "={{ $json.challenge }}"
},
"id": "respond-node-id",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1680,
3220
]
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
}
}
Any help is much appreciated!
5
1 comment
Gabor Szorad
2
whatsapp automation - verifying meta's webhook
AI Automation Society
skool.com/ai-automation-society
A community built to master no-code AI automations. Join to learn, discuss, and build the systems that will shape the future of work.
Leaderboard (30-day)
Powered by