# WhatsApp chatbot with OpenAI and OpenRouter: n8n workflow

> Started by an incoming WhatsApp message, and works across WhatsApp. It puts OpenAI and OpenRouter behind a retrieval step, so answers are drawn from...

Source: https://millionrounds.com/workflow/whatsapp-chatbot-with-openai-and-openrouter (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Chat assistants](https://millionrounds.com/workflows?category=Chat+assistants#library)

# WhatsApp chatbot with OpenAI and OpenRouter

Started by an incoming WhatsApp message, and works across WhatsApp. It puts OpenAI and OpenRouter behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 24 steps, 1 branch, 1 loop or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI, OpenRouter Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fwhatsapp-chatbot-with-openai-and-openrouter)

**24 steps** Large: read it before trusting it with anything live

**1** Branch: places the flow splits

**1** Loop or waits

**1** Service it connects to

## The flow

Starts it 1 Model 9 Logic 6 Service 8

The steps in the order they run, from what starts it.

- 1 **WhatsApp Trigger** Whats App trigger *Starts it*
- 2 **Window Buffer Memory** Memory Buffer Window *Model*
- 3 **Wikipedia** Tool Wikipedia *Model*
- 4 **OpenRouter Chat Model1** Lm Chat Open Router *Model*
- 5 **OpenRouter Chat Model2** Lm Chat Open Router *Model*
- 6 **OpenRouter Chat Model** Lm Chat Open Router *Model*
- 7 **Split Out Message Parts** Split Out *Logic*
- 8 **AI Agent** Agent *Model*
- 9 **Image Explainer** Chain Llm *Model*
- 10 **Text Summarizer** Chain Llm *Model*
- 11 **Redirect Message Types** Switch *Logic*
- 12 **Respond to User** Whats App *Service*
- 13 **Get User's Message** Set *Logic*
- 14 **Get Audio URL** Whats App *Service*
- 15 **Get Video URL** Whats App *Service*
- 16 **Get Image URL** Whats App *Service*
- 17 **Get Text** Wait *Logic*
- 18 **Download Audio** Http Request *Service*
- 19 **Download Video** Http Request *Service*
- 20 **Download Image** Http Request *Service*
- 21 **Transcribe a recording** Open Ai *Model*
- 22 **Google Gemini Video** Http Request *Service*
- 23 **Format Response1** Set *Logic*
- 24 **Format Response** Set *Logic*

## How it's built

- **Starts on:** An incoming WhatsApp message
- **Steps:** 24, with 1 branch, 1 loop or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** WhatsApp
- **Model:** OpenAI, OpenRouter
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own WhatsApp account, and a key for OpenAI and OpenRouter. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming WhatsApp message.

Does it use AI?

Yes. It calls OpenAI and OpenRouter. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 24 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 24 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fwhatsapp-chatbot-with-openai-and-openrouter)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[WhatsApp](https://millionrounds.com/workflows?service=WhatsApp#library)

## Workflows like it

Also chat assistants, with the same services where possible, closest in size first.

- [**Build an AI WhatsApp chatbot with Gemini and Wikipedia** 24 steps · calls a model · WhatsApp](https://millionrounds.com/workflow/build-an-ai-whatsapp-chatbot-with-gemini-and-wikipedia)
- [**Large Language Learning with OpenAI and WhatsApp** 24 steps · calls a model · RSS, WhatsApp](https://millionrounds.com/workflow/large-language-learning-with-openai-and-whatsapp)
- [**Respond to WhatsApp messages with Gemini** 24 steps · calls a model · WhatsApp](https://millionrounds.com/workflow/respond-to-whatsapp-messages-with-gemini)
- [**Score AQI health risks with Open-Meteo and AirNow** 24 steps · calls a model · Slack, Twilio](https://millionrounds.com/workflow/score-aqi-health-risks-with-open-meteo-and-airnow)
- [**Build a multimodal WhatsApp assistant with OpenAI and Gemini** 23 steps · calls a model · WhatsApp](https://millionrounds.com/workflow/build-a-multimodal-whatsapp-assistant-with-openai-and-gemini)
- [**AI-powered WhatsApp chatbot for text, voice, images & PDFs** 26 steps · calls a model · WhatsApp](https://millionrounds.com/workflow/ai-powered-whatsapp-chatbot-for-text-voice-images-and-pdfs)
