If you want to build your own WhatsApp chatbot to receive text and voice messages, process them with AI, and reply automatically, this guide shows a practical way to do it using n8n + OpenAI + Meta + AWS.
๐ง What will you learn?
In this post you will see how to:
- Connect OpenAI AI services with n8n
- Connect WhatsApp Business Cloud services with n8n
- Receive text and voice messages and reply automatically from an n8n workflow
- Estimate basic operation costs
๐ ๏ธ Implementation step by step
1. Prerequisites โ
Before you start, you need:
- An OpenAI account with balance
- A Meta Developer account (you can use your personal Facebook account)
- A domain to publish n8n with HTTPS
- Access to n8n (self-hosted or cloud service)
- Download the whatsapp-chatbot repository for installation and setup
2. Import chatbot workflow ๐ฌ
Import the workflow from the n8n folder in the whatsapp-chatbot repository. Copy and paste the content of the whatsapp-chatbot.json file into n8n.
This workflow allows you to:
- Receive text or voice messages from WhatsApp
- Detect if the content is audio
- Download and transcribe the audio
- Run an OpenAI LLM model
- Send the response back to WhatsApp
3. Configure OpenAI in n8n ๐ง
To run OpenAI Large Language Models (LLM) in n8n, you need an API Key to authenticate requests. Steps:
- Go to OpenAI Platform with your account
- In the side panel, open API Key and create a key
- In the n8n workflow, in the Transcribe Recording node, configure OpenAI credentials
4. WhatsApp Business API ๐ฒ
To send and receive voice and text messages from WhatsApp, you need to create an app in Meta Developer and configure it to get credentials for n8n.
Steps:
- Create an app in the Meta Developers portal
- Add the use case Connect with customers through WhatsApp
- Confirm app creation
Send messages to WhatsApp ๐ค
To enable sending messages from n8n, you need authentication credentials. Steps:
In Meta Developer, open your app and go to the WhatsApp configuration. Copy the WhatsApp Business Account ID
In Meta Business, go to system users. Select or create a user
Assign the Meta Developer app to that system user
Generate an access token. Set permissions to
whatsapp_business_messagingIn n8n workflow, in the Send Message (WhatsApp Business Cloud) node, create WhatsApp credentials using values from steps 1 and 4. Test the connection
Receive messages from WhatsApp ๐ฅ
We will use WhatsApp test numbers to receive messages. For real numbers, follow extra steps.
Each message triggers a Webhook in n8n. Steps:
In Meta Developer, go to app settings and get App ID and App Secret
In n8n workflow, in WhatsApp Business on Message node, create OAuth credentials with App ID and App Secret. Test connection
Publish the n8n workflow so it is available online
Copy the Production POST URL from the node (this is your webhook endpoint)
In Meta Developer, set this URL in the WhatsApp configuration with a verification token. Test connection
5. Test the chatbot ๐ค
Use WhatsApp test phone numbers to run the chatbot workflow. Steps:
In Meta Developer, go to WhatsApp API settings and copy the test number
Send a message from your WhatsApp to that number
Costs ๐ฐ
OpenAI API ๐ค
The cost of OpenAI API depends on:
- Model used
- Number of tokens
- Input vs output usage
Output is usually 3โ6 times more expensive than input.
| Model | Input ($/1M tokens) | Output ($/1M tokens) | Context | Recommended use |
|---|---|---|---|---|
| GPT-5.4 | $2.50 | $15.00 | ~1M tokens | High complexity, agents |
| GPT-5.4 mini | $0.75 | $4.50 | 400K tokens | Apps, SaaS, chatbots |
| GPT-5.4 nano | $0.20 | $1.25 | ~400K tokens | Classification, extraction |
Monthly estimate ๐
WhatsApp conversation (1โ5 minutes):
- Messages per conversation: 6โ12
- Words per message: 8โ15
- Total words: ~120
Conversion:
- 1 token โ 0.75 words
- 120 words โ 160 tokens
| Type | Tokens |
|---|---|
| User input | 80 |
| Model output | 80 |
| Total | 160 |
Monthly scenario ๐
Example: 10,000 conversations/month
| Model | Monthly cost |
|---|---|
| GPT-5.4 | $14 USD |
| GPT-5.4 mini | $4.2 USD |
| GPT-5.4 nano | $0.4 USD |
Meta API ๐ฑ
WhatsApp Business API uses a pricing model based on message categories:
- Service
- Utility
- Authentication
- Marketing
Service messages (user starts the chat) are free within a 24-hour window.
Monthly estimate ๐
- 600 service messages โ $0
Total Meta cost ๐ต: $0/month
n8n
n8n cost depends on infrastructure and number of workflow executions (conversations). Below table shows the comparation between Self-hosted using AWS cloud services and Cloud Starter:
| Variable | Self-hosted (AWS) | Cloud Starter | Cloud Pro |
|---|---|---|---|
| Base cost | Low (infra + ops) | Medium (~โฌ20โโฌ30/mo) | High (~โฌ50โโฌ100+/mo) |
| Infrastructure | Your responsibility | Included | Included |
| Executions | Unlimited (depends infra) | Limited (~5kโ10k/mo) | Higher (~20kโ50k+/mo) |
| Scalability | Manual | Auto (limited) | Auto (better) |
| Security | Full control | Managed by n8n | Managed by n8n |
| Concurrency | Depends on resources | Limited | Higher |
| Integrations | All | All | All |
| Maintenance | High (needs DevOps) | Low | Low |
| Multi-user | Manual setup | Limited | Full (roles, teams) |


Top comments (0)