Whatsapp bot

Hi @romeo_roy, creating webhooks can be a bit tricky but this should still work fine with n8n. What’s important is that WhatsApp requires you to have two separate webhooks as per their docs: “Verification Requests” and “Event Notifications”. The verification request is a GET request, while the actual events come through in a POST request. The token can have any value, it’s only meant to verify the authenticity of requests coming from Meta/WhatsApp.

In n8n this means setting up two Webhooks nodes with the same path but different HTTP methods, similar to what I’ve describe here for Okta. This is how a WhatsApp event workflow could look like assuming you pick a token of foo?:

I’d suggest you activate this workflow straight away and then use your production URL (and check your execution data for the results). Facebook seems to occasionally re-verify your webhook and this would fail if your workflows is inactive (or you are relying on manual executions using the test URL of your webhook nodes).

You can then see each request in your execution data. A verification request will be processed in the upper branch:

Actual events come through on the bottom branch:

Once you have received your first event, you can simply copy the JSON payload into the n8n editor using the Copy to editor button in the upper right corner of your execution view and then build your full workflow from there.

Hope this helps!

1 Like