# WhatsApp AI agent with n8n: step-by-step setup and when to migrate

> How to build a WhatsApp AI agent with n8n and the official API: credentials, trigger, AI Agent node with memory, testing, total cost and the signs it is time to migrate.

- **HTML version:** https://tolky.to/en/blog/whatsapp-ai-agent-n8n
- **Author:** [Marlos Carmo](https://tolky.to/en/author/marlos), Co-founder of Tolky
- **Published:** November 19, 2026
- **Reviewed:** November 19, 2026
- **Language:** en

## Summary

A **WhatsApp AI agent with n8n** connects the official WhatsApp API (Cloud API) to a workflow with the WhatsApp Trigger, the AI Agent node with a model, memory and tools, and the WhatsApp Business Cloud node to reply. Building it takes a few hours; running it takes a team inbox, a queue, a CRM, monitoring, 24/7 hosting and care with personal data. When that outweighs the workflow, it is time to migrate, and Tolky Flows import n8n JSON.

You can build a WhatsApp AI agent with n8n in an afternoon: a trigger receives the message through the official API, an AI agent node thinks and a WhatsApp node replies. The most popular tutorials stop there.

They do not show the next day: the customer who asks for a person, the token that expires, the duplicate reply, the bill from Meta. This guide covers the step-by-step setup, what is missing to run it as an operation, the total cost and when to migrate.

*Updated in November 2026.*

## What is a WhatsApp AI agent with n8n?

**A WhatsApp AI agent with n8n is an n8n workflow that receives WhatsApp messages through the official API, hands each one to a language model with memory and tools, and sends the reply back to the customer.** The [AI agent](https://tolky.to/en/glossary/ai-agent) decides what to say and when to use a tool, such as looking up a spreadsheet.

The pieces: the [WhatsApp Cloud API](https://tolky.to/en/glossary/whatsapp-cloud-api), n8n, the language model and the memory of each conversation.

n8n is an excellent automation tool, but it is not a customer service platform: it has no team inbox, queue or CRM.

## What do you need before you start?

**You need an n8n instance reachable over HTTPS, a Meta app with WhatsApp, a phone number and an API key for a language model.** The list follows the [n8n WhatsApp credentials documentation](https://docs.n8n.io/integrations/builtin/credentials/whatsapp/), checked on November 19, 2026.

- **n8n in the cloud or on your server.** n8n Cloud is a paid subscription; the self-hosted version is free for internal use under the Sustainable Use License ([license FAQ](https://docs.n8n.io/n8n-community-license/community-license/license-faq)).
- **A Meta developer account and business portfolio**, with an app that has the WhatsApp product and is in Live mode.
- **A phone number.** Meta provides a test number; for production, use the business number. See [how to get the official WhatsApp Business API](https://tolky.to/en/blog/how-to-get-official-whatsapp-business-api).
- **An API key for a language model**, with a spending cap.
- **A public address with a valid certificate.** Meta only delivers [webhooks](https://tolky.to/en/glossary/webhook) to HTTPS endpoints and does not accept self-signed certificates ([Meta documentation](https://developers.facebook.com/documentation/business-messaging/whatsapp/webhooks/create-webhook-endpoint), checked on November 19, 2026).

The [n8n installation documentation](https://docs.n8n.io/hosting/installation/docker/) recommends self-hosting only for experienced users.

## How to build a WhatsApp AI agent in n8n, step by step

**The minimum workflow has five steps: credentials, an incoming message trigger, a filter, the AI Agent node with a model, memory and a tool, and the reply.** Node names are the ones in the n8n documentation on November 19, 2026.

| Step | n8n node | What to configure | How to check |
| :--- | :--- | :--- | :--- |
| 1 | Credentials | API key (Access Token and Business Account ID) and OAuth2 (Client ID and Client Secret) | Credential test passes |
| 2 | WhatsApp Trigger | Messages event | A message to the number creates an execution |
| 3 | If | Continue only with customer messages | Status updates never reach the agent |
| 4 | AI Agent | Chat model, memory, at least one tool and instructions | The reply remembers what was said |
| 5 | WhatsApp Business Cloud | Send operation, sender and customer number | The reply arrives on the phone |

### 1. Create the Meta credentials in n8n

The WhatsApp Business Cloud node uses an API key credential, with the Access Token and the WhatsApp Business Account ID (under WhatsApp > API Setup in the Meta app). The WhatsApp Trigger uses OAuth2, with the App ID and App Secret from App settings > Basic.

The detail that breaks many agents on day two: the token from the setup screen is a user access token, which expires within hours. For production, Meta says to use a long-lived system user access token ([access tokens](https://developers.facebook.com/documentation/business-messaging/whatsapp/access-tokens), checked on November 19, 2026).

### 2. Set up the incoming message trigger

Use the WhatsApp Trigger node with the Messages event. According to the [WhatsApp Trigger documentation](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.whatsapptrigger/), WhatsApp allows only one webhook per app: switching between the test and production URLs overwrites the registration. Publishing the workflow also does not subscribe the app to the WhatsApp Business Account; without that subscription, nothing arrives and no error shows up.

The Messages event also carries status updates (sent, delivered, read), which Meta delivers in the same field. An If node right after the trigger lets only customer messages through.

### 3. Build the AI Agent node with memory and tools

The AI Agent works with a chat model and at least one connected tool ([AI Agent in n8n](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/)). Write the system instructions (who the agent is, what it answers, when it hands off to a person) and connect the tool, such as an HTTP request to your system.

For memory, Simple Memory asks for a Session Key: use the customer's number, so each conversation has its own. The [Simple Memory documentation](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.memorybufferwindow/) warns that it does not work in production when n8n runs in queue mode; in that case, use a database-backed memory such as Postgres Chat Memory.

### 4. Send the reply and test

In the WhatsApp Business Cloud node, use the Send operation, with the customer's number from the trigger as the recipient. Test with Meta's test number by sending off-topic questions, a voice note and three messages in a row.

There are ready-made community workflows with AI on the [WhatsApp Business Cloud integration page at n8n](https://n8n.io/integrations/whatsapp-business-cloud/); review every node before using one.

## What are the most common setup mistakes?

**The most common mistakes are infrastructure, not AI: duplicate messages, an overwritten webhook, an unsubscribed app and message types nobody handled.**

- **Duplicate replies.** Meta retries unacknowledged webhooks for up to 7 days and recommends handling repeats. Store each message ID.
- **The agent replying to statuses.** Without the filter, every "delivered" can trigger a reply.
- **Total silence.** The app is not subscribed to the WhatsApp Business Account.
- **A workflow that stops after a test.** The test URL overwrote the production one.
- **Voice notes, images and documents.** The trigger receives them, but the agent only understands what you handle.
- **Made-up answers.** Missing clear instructions and a [knowledge base](https://tolky.to/en/blog/train-ai-agent-knowledge-base).

## What is missing to run the agent as an operation?

**A workflow that replies is not customer service: what is missing is where the team works, how a case reaches a person and how the business measures and protects what happens.**

- **An inbox for humans.** n8n has no conversation screen for the team to reply on the same number, with [WhatsApp multi-agent inbox](https://tolky.to/en/features/whatsapp-shared-inbox).
- **Queue and handoff with context.** The case reaches the right person with a summary. See the rules for [AI-to-human handoff](https://tolky.to/en/blog/ai-to-human-handoff-7-rules).
- **CRM and history** in one place, not scattered across n8n executions.
- **Templates** to reach customers outside the 24-hour window.
- **Metrics** for AI resolution, response time and handoffs.
- **Monitoring and 24/7 hosting**, with alerts, backups and updates.
- **Security and privacy.** Brazil's LGPD, for example, requires technical and administrative measures that protect personal data from unauthorized access ([Law 13,709, art. 46](https://www.planalto.gov.br/ccivil_03/_ato2015-2018/2018/lei/l13709.htm)). That covers the server, the execution logs and what goes to the model ([LGPD](https://tolky.to/en/glossary/lgpd-in-customer-service)).

## How much does a WhatsApp AI agent with n8n cost?

**The total cost adds up n8n hosting, AI model usage, Meta's fees and maintenance hours, and the last one is usually the largest.** Only Meta's fees have a fixed public price.

| Component | How it is billed | Illustrative monthly example |
| :--- | :--- | :--- |
| n8n | n8n Cloud subscription, or your own server and database | US$ 30 |
| AI model | Per token, depending on the provider | US$ 40 |
| Meta fees | Per delivered message, with 1,000 free service replies per number each month | (6,000 − 1,000) × US$ 0.0034 = US$ 17 |
| Maintenance | Hours of whoever looks after the workflow and incidents | 10 h × US$ 50 = US$ 500 |
| **Illustrative total** | | **US$ 587** |

Server, model and hourly figures are made up, just to show the math. Meta's fees are real: under the rate card in effect since October 1, 2026, checked on November 17, 2026, a service message to a US number costs US$ 0.0034 after the 1,000 free ones, and a marketing template US$ 0.025 ([WhatsApp Business Platform pricing](https://developers.facebook.com/documentation/business-messaging/whatsapp/pricing)). Rates vary by country: run your numbers in the [WhatsApp API cost calculator](https://tolky.to/en/resources/whatsapp-api-cost-calculator) and see [how much a WhatsApp AI agent costs](https://tolky.to/en/blog/whatsapp-ai-agent-pricing).

## When should you stay on n8n and when should you migrate?

**n8n is the best choice when WhatsApp is one piece of a larger automation and someone technical looks after the workflow; migrating makes sense when customer service becomes the center.**

Stay on n8n when volume is small, with no human team on the number, or when the company already runs n8n and has someone to maintain it.

Signs it is time to migrate:

- more than one person needs to reply on the same number;
- customers get repeated, lost or late replies;
- only one person understands the workflow;
- management asks for customer service metrics;
- legal asks where conversations are stored and who can access them;
- maintenance hours exceed the price of a platform.

To compare the paths (n8n, a platform or Meta's own AI), see [how to build a WhatsApp AI agent](https://tolky.to/en/blog/how-to-build-a-whatsapp-ai-agent) and the guide to [WhatsApp automation for businesses](https://tolky.to/en/blog/whatsapp-automation-for-business).

## What about unofficial APIs such as Evolution API and WAHA?

**Many n8n tutorials connect the number through WhatsApp Web by scanning a QR code, without the official API.** It is free and quick to test, but WhatsApp says unofficial apps violate its terms and that the account may be banned.

Evolution API supports both WhatsApp Web (through the Baileys library) and the official Cloud API: the risk lies in the connection method. The details are in the guide to the [unofficial WhatsApp API](https://tolky.to/en/blog/unofficial-whatsapp-api-risks).

## How do you migrate from n8n to Tolky without losing your work?

**Tolky Flows import the JSON of an n8n workflow for review in the visual editor and export flows in n8n format, with caveats for steps that have no equivalent.** If you started on n8n, you do not redesign from scratch.

The path, described on the [n8n integration](https://tolky.to/en/integrations/n8n) page:

1. **Export the workflow from n8n as JSON.**
2. **In Flows, use Import and choose the file.**
3. **Review the nodes and publish.** Steps with no equivalent are rebuilt, usually with an HTTP request or advanced code.

What were loose pieces in n8n come built in: a native incoming message trigger, an AI agent with the account's knowledge base, a handoff to a person that pauses the AI and carries the history, and CRM steps (deal, stage, tag and task). See [WhatsApp automation flows](https://tolky.to/en/features/whatsapp-automation-flows) and [Tolky's CRM](https://tolky.to/en/solutions/crm).

![Real screenshot of Tolky's automations screen, in dark mode and still in Portuguese, with automation modules on the side and an open automation for a board test failure, showing the When condition written in natural language and the Create Ticket action](https://tolky.to/screenshots/automacao.png)

Automations, shown in the screenshot, act during the conversation with conditions written in natural language. For other systems, there are more than 1,000 apps, HTTP requests, webhooks, a REST API and MCP ([integrations](https://tolky.to/en/integrations)).

**What Tolky does not do:** it has no ready-made Zapier or Make connector (the bridge is webhooks and HTTP requests, as the question about [Zapier and Make](https://tolky.to/en/faq/does-tolky-work-with-zapier-or-make) explains), and the import does not convert every n8n node. WhatsApp starts on the Starter plan (US$ 90 or R$ 500 a month, 500 attendances, 2 users, 10 flows and 1,000 runs); the Individual plan is free, but without WhatsApp. Meta's fees are not part of the plan. See the [plans](https://tolky.to/en/pricing).

## Frequently asked questions

### Can you build a WhatsApp AI agent with n8n for free?

Self-hosted n8n is free for internal use, but the server, the AI model and Meta's fees are paid. Meta gives 1,000 free service messages per number each month; above that, each reply is billed.

### Which WhatsApp API should you use with n8n?

The official one, through Meta's Cloud API, which has its own n8n nodes: WhatsApp Trigger to receive and WhatsApp Business Cloud to send. Connections through WhatsApp Web carry a risk of the number being banned.

### Is there a ready-made WhatsApp AI agent template for n8n?

Yes. The WhatsApp Business Cloud integration page on the n8n site lists community workflows with AI. Review credentials, memory and rules before using one.

### Does n8n support multiple agents on the same number?

Not directly. n8n automates the workflow but has no team inbox. For several people on the same number, you need a customer service platform connected to the official API.

### Why does my n8n agent reply twice?

Usually Meta retried the webhook, or the trigger fired on a status update. Filter customer messages and store each message ID.

### Can I bring my n8n workflows to Tolky?

Yes. Tolky Flows import n8n JSON for review in the visual editor and export in n8n format. Steps with no equivalent need manual adjustment.

---

## Conclusion

A WhatsApp AI agent with n8n is a great way to validate a use case. Once it becomes customer service, with a team, a queue, a CRM and metrics, the cost shifts to maintenance, and it is worth comparing with a platform that already has those pieces.

[See the plans](https://tolky.to/en/pricing), [explore Tolky Flows](https://tolky.to/en/features/whatsapp-automation-flows), [bring your n8n workflows](https://tolky.to/en/integrations/n8n) or [talk to the team →](https://tolky.to/en/contact). Let's talk?

---

This is the Markdown version of the page. The full version, with images and navigation, is at https://tolky.to/en/blog/whatsapp-ai-agent-n8n

Tolky: https://tolky.to
