How to Connect n8n to WhatsApp: Step-by-Step Guide
In this article
To connect n8n to WhatsApp, you don't use a single built-in node. n8n has no official WhatsApp node, so the working method is to connect through the WhatsApp Business Cloud API (Meta's official API) using n8n's HTTP Request node, or through a third-party community node that wraps that API. The shortest working path is: create a Meta developer app with the WhatsApp product, get a permanent access token and phone number ID, then build an HTTP Request node in n8n that sends messages to the Graph API endpoint. This guide walks through that process, plus the common pitfalls and how to fix them.
What You'll Need
- A Meta (Facebook) developer account and a Meta app with the WhatsApp product added.
- A WhatsApp Business Account (WABA) and a phone number registered for the API. You can start with the free test number Meta provides, but it can only message numbers you add to the test recipient list.
- Your WhatsApp Business Account ID, Phone Number ID, and a permanent access token (System User token recommended over the temporary 24-hour token).
- An n8n instance (cloud or self-hosted) with permission to create workflows and credentials.
- If you plan to receive messages, a publicly reachable HTTPS URL for your n8n webhook. n8n Cloud provides this; self-hosted instances need a domain and TLS.
- Optional: a verified Meta Business account if you want to message real customers beyond the test list.
Step-by-Step
- Create a Meta app. Go to developers.facebook.com, click My Apps, then Create App. Choose the Business type, give it a name, and link it to your Meta Business account. Menu labels can differ slightly by version and region.
- Add the WhatsApp product. In the app dashboard, find WhatsApp in the product list and click Set up. Meta will provision a test WhatsApp Business Account and a test phone number for you.
- Collect your IDs. On the WhatsApp > API Setup page, note the Phone Number ID and the WhatsApp Business Account ID. These are the values you'll paste into n8n.
- Generate a permanent token. The token shown on the API Setup page expires in 24 hours. For a durable connection, go to Meta Business Settings > Users > System Users, create a system user, assign it the app and the WhatsApp Business Account, then generate a token with the whatsapp_business_messaging and whatsapp_business_management permissions. Copy it immediately; you won't see it again.
- Add test recipients. On the API Setup page, add your own WhatsApp number as a recipient. The test number can only message numbers on this list until you move to a production number.
- Create an n8n credential (optional but recommended). In n8n, open Credentials > New, choose HTTP Request > Header Auth (or Generic Credential Type > Header Auth). Set the header name to Authorization and the value to Bearer followed by a space and your token.
- Build the send node. Add an HTTP Request node to your workflow. Set Method to POST, URL to https://graph.facebook.com/v19.0/{PHONE_NUMBER_ID}/messages (replace the placeholder with your Phone Number ID; check Meta's docs for the current API version). Enable Send Headers and add Content-Type: application/json and Authorization: Bearer YOUR_TOKEN. Use the full international number without plus signs or spaces.
- Test the send. Execute the node manually. A successful response returns a message ID and a 200 status. If you get an error, see Troubleshooting below.
- Set up receiving (optional). To react to incoming messages, add a Webhook node to a new workflow, set the HTTP method to POST, and copy the production URL. In Meta's app dashboard under WhatsApp > Configuration, set the Callback URL to that n8n webhook URL and enter a Verify Token you choose. Meta will send a GET request with hub.challenge; your webhook must respond with that challenge value. n8n's Webhook node can return a custom response, but for the verification handshake you may need a small Function node or a Respond to Webhook node configured to echo the challenge.
- Subscribe to message events. On the same Configuration page, subscribe to the messages field. Now incoming WhatsApp messages will POST to your n8n webhook, and you can branch on the payload to reply.
- Harden and monitor. Store the token in an n8n credential rather than hardcoding it. Add error handling (e.g., an IF node checking the status code) and log failures. Rotate the system user token periodically.
Common Mistakes
- Using the temporary token. The token on the API Setup page expires in 24 hours. Workflows that worked yesterday fail today with an authentication error. Use a System User token.
- Wrong number format. The 'to' field must be digits only, including country code, no plus sign, spaces, or leading zeros. A number like +1 (555) 123-4567 becomes 15551234567.
- Messaging non-test numbers on the test number. The free test number only reaches recipients you explicitly added. Attempts to message others return an error.
- Forgetting the Content-Type header. Without application/json, Meta rejects the body or misparses it.
- Using an outdated API version in the URL. Meta deprecates Graph API versions. Check the current version in Meta's docs and update the URL.
- Webhook verification failing. Meta's GET request expects the exact hub.challenge value echoed back with a 200 status. Returning JSON or a redirect breaks verification.
- Self-hosted webhook not publicly reachable. Meta cannot reach localhost. You need a public HTTPS URL, often via a reverse proxy or tunnel.
Tips
- Start with the test number and your own phone before wiring real customers. It isolates token and format issues from business verification issues.
- Keep the Phone Number ID and WABA ID in n8n variables or a Set node so you don't paste them into every HTTP Request node.
- Use n8n's Expressions to build the 'to' field from a phone number column in your data, stripping non-digits with a replace expression.
- For two-way conversations, store the incoming message ID and use it to reply in context; WhatsApp supports reply context but it's optional.
- If you need templates (for messages outside the 24-hour customer service window), create and get them approved in Meta Business Manager first, then send them via the same messages endpoint with type template.
- Log the full API response, not just the status code. Meta returns useful error subcodes that tell you exactly what's wrong.
Troubleshooting
401 Unauthorized. Your token is expired, revoked, or lacks the right permissions. Regenerate a System User token with whatsapp_business_messaging and whatsapp_business_management, update the credential, and retest.
400 Bad Request with a message about recipient. The number is not on the test recipient list, is formatted incorrectly, or has not opted in. Add it to the list or fix the formatting.
Webhook verification fails. Confirm the Verify Token in Meta matches what your n8n workflow checks, that the URL is the production webhook URL (not the test URL), and that the response is a plain 200 with the challenge string. Use n8n's Respond to Webhook node to return the challenge explicitly.
Messages send but replies never arrive. Check that you subscribed to the messages field in Meta's Configuration page and that the webhook is active. Also confirm your n8n workflow is set to Active, not just saved.
Self-hosted instance not receiving webhooks. Verify the URL is reachable from the internet over HTTPS, the certificate is valid, and no firewall blocks Meta's requests. Test with a tool like a webhook tester before blaming n8n.
Rate limits or 429 errors. Slow down your workflow with a Wait node or batch your sends. Meta enforces per-number throughput limits; check the current limits in Meta's docs.
If none of that works, simplify: send a single hardcoded message with a fresh token to your own number using curl or Postman first. Once that succeeds, move the same payload into n8n. This separates API problems from workflow problems.
Frequently Asked Questions
Does n8n have a native WhatsApp node?
No. n8n does not ship an official WhatsApp node. You connect via the WhatsApp Business Cloud API using the HTTP Request node, or via a community node that wraps that API. Community nodes are third-party and should be reviewed before use.
Can I use a personal WhatsApp account?
No. The official API requires a WhatsApp Business Account and a phone number registered for the API. Using unofficial libraries that automate WhatsApp Web violates WhatsApp's terms and risks a ban.
Why does my token stop working after a day?
The token on the API Setup page is temporary (24 hours). Generate a System User token in Meta Business Settings for a long-lived credential.
Do I need a verified business to send messages?
For the test number and test recipients, no. To message real customers at scale, you need business verification and approved message templates for conversations outside the 24-hour window.
Can n8n receive WhatsApp messages?
Yes, through a Webhook node configured as the callback URL in Meta's WhatsApp Configuration page, subscribed to the messages field. The webhook must complete Meta's verification handshake first.
What number format does the API expect?
Digits only, including the country code, with no plus sign, spaces, dashes, or leading zeros. For example, a US number is sent as 15551234567.