how to build a WhatsApp AI agent with n8n and OpenAI
By Catalina Jaramillo · AI Commerce & Revenue Operations Consultant · 2026-11-21
You can launch a production‑ready WhatsApp AI agent by wiring the WhatsApp Business API, OpenAI and your CRM inside n8n. The workflow receives messages, generates contextual replies with GPT, records the interaction, and sends the answer back through WhatsApp.
What components do I need to start?
The stack is small but each piece must be correctly provisioned before you connect them in n8n.
- WhatsApp Business API access (through an official provider or self‑hosted solution).
- n8n instance – cloud hosted or on a VPS with HTTPS.
- OpenAI API key with enough quota for your expected traffic.
- A CRM that exposes a REST API (HubSpot, Salesforce, Zoho, etc.).
- Domain name with a valid SSL certificate for webhook security.
How do I connect WhatsApp Business API to n8n?
n8n acts as the glue between the inbound WhatsApp webhook and the rest of the automation.
- Obtain the provider’s webhook URL and authentication token.
- Create a **Webhook** node in n8n that listens on a public HTTPS endpoint.
- Map the incoming JSON fields (phone number, message text, media type) to n8n variables.
- Add a **WhatsApp** node (or an HTTP Request node) to send replies back using the provider’s API.
- Test with the sandbox environment before moving to production.
Carolina, Catalina's AI agent, reviews your business, shows which system solves it and what it would cost. If there is a fit, she books a call with Catalina.
Tell Carolina about your case →How can OpenAI be added to generate intelligent replies?
OpenAI provides the language model that turns raw messages into context‑aware answers.
- Insert an **HTTP Request** node after the inbound webhook to call the OpenAI /completions endpoint.
- Build a prompt that includes the latest user message and, if available, recent conversation history stored in n8n’s workflow data.
- Set temperature, max tokens, and stop sequences according to the desired tone.
- Parse the response, extract the generated text, and feed it to the WhatsApp reply node.
- Log the prompt‑response pair for future fine‑tuning or audit.
Which CRM should I integrate and how to keep data in sync?
Storing contacts and interaction logs in a CRM lets sales teams follow up manually when needed.
- Choose a CRM that supports upsert (create or update) via REST; most major platforms do.
- Add a **CRM** node (or another HTTP Request) after the OpenAI call to upsert the contact using the phone number as the unique key.
- Record the message, the AI‑generated reply, and a timestamp in a custom field or activity log.
- Trigger follow‑up tasks or reminders based on the content (e.g., “price request” → create a deal).
- Ensure GDPR‑compliant handling of personal data – store only what you need and provide opt‑out mechanisms.
What common mistakes cause the bot to fail in production?
Even a correctly wired workflow can break if you overlook operational limits or edge cases.
- Ignoring WhatsApp rate limits – send no more than the provider’s messages per second.
- Hard‑coding language; users may switch to Spanish, Portuguese, etc., and the model will answer in the wrong language.
- Not handling non‑text media (images, videos) – the workflow should route them to a fallback human agent.
- Missing fallback logic for OpenAI errors (timeout, quota exceeded) – always have a default “We’ll get back to you shortly” reply.
- Storing API keys in plain text – use n8n’s credential store and restrict access.
- Insufficient logging – without logs you cannot diagnose why a message was dropped.
What investment is required for a production‑ready solution?
Catalina offers transparent pricing for every stage of the project, plus the variable costs of OpenAI and the WhatsApp provider.
- Strategic diagnosis with Catalina – USD 490 (defines funnel, success metrics).
- Automation express (basic n8n workflow) – USD 500 – 1,500.
- Revenue Agent Sprint (full configuration + first month) – USD 2,500 + USD 750 / month.
- System multi‑agent / AI Business OS (enterprise‑scale) – USD 10,000 – 20,000 + USD 2,000 / month.
- Continuous optimization and growth – USD 1,000 – 2,000 / month.
- OpenAI usage (pay‑as‑you‑go) and WhatsApp provider fees are billed separately.
How would Catalina design and launch the agent for my business?
Catalina follows a data‑driven, measurable process that minimizes risk and maximizes ROI.
- 1️⃣ Conduct the USD 490 strategic diagnosis to map the sales journey, identify decision points, and define KPI targets (response time, conversion rate).
- 2️⃣ Draft a detailed n8n workflow diagram that includes WhatsApp inbound, OpenAI processing, CRM upsert, and fallback paths.
- 3️⃣ Build a pilot covering a single product line or a limited set of contacts; run it for 2 weeks while capturing baseline metrics.
- 4️⃣ Compare pre‑pilot and pilot data; adjust prompt engineering, rate‑limit handling, and CRM field mapping.
- 5️⃣ Deploy the full‑scale workflow, enable monitoring dashboards in n8n, and hand over a run‑book to the internal team.
- 6️⃣ Offer ongoing support (USD 1,000 – 2,000 / month) to refine prompts, add new use cases, and keep the system aligned with business growth.
FAQ
Do I need programming skills to build this agent?
No. n8n provides a visual node‑based editor; you only need to copy‑paste API keys and configure JSON mappings.
Can any CRM be used with the workflow?
Any CRM that offers a REST API can be integrated. HubSpot, Salesforce, Zoho and Pipedrive are common choices.
How long does a pilot usually last?
A typical pilot runs 2 to 4 weeks, enough time to validate the prompt, measure response accuracy and confirm KPI improvements.
What security steps are mandatory before going live?
Use HTTPS for all webhooks, store API keys in n8n’s credential vault, verify provider signatures, and comply with GDPR for personal data.
How can the agent scale to thousands of messages per day?
Host n8n on a scalable cloud service, enable concurrency limits, monitor OpenAI token usage, and upgrade the WhatsApp Business API plan to match the volume.
Carolina, Catalina's AI agent, reviews your business, shows which system solves it and what it would cost. If there is a fit, she books a call with Catalina.
Tell Carolina about your case →