← Back

WhatsApp Voice & Business Agent with n8n

Turning customer voice notes, photos and text messages on WhatsApp into instant, database-backed answers through an n8n workflow.

n8n Automations AI Agents for WhatsApp
Works with
  • n8n
  • WhatsApp
  • Supabase
  • OpenAI
  • Shopify

Overview

This project is a WhatsApp business assistant for an online store. Customers write, speak or send a photo, and the workflow replies on WhatsApp with facts taken from the store’s Supabase product database, answering by voice when the customer used voice. It runs on n8n cloud with OpenAI models and replaces manual answering of repetitive product questions.

The business problem

Store owners answer the same questions all day: is this in stock, what does it cost, how long is delivery. Customers send these as voice notes, typed messages or screenshots of a product, so a simple keyword bot cannot read them. Slow replies lose sales, and a bot that guesses prices or stock damages trust.

The solution

An n8n workflow receives every WhatsApp message and routes it by type. Voice notes are transcribed, photos are described by a vision model, and text goes straight through. All three are normalized into one message and passed to an AI agent that must look up facts in Supabase before answering. The reply goes back as text, or as a voice note when the customer sent audio. Memory keyed on the customer’s phone number keeps the conversation connected.

Project snapshot

ItemDetail
Platformn8n cloud
ChannelWhatsApp Business Cloud API
Input typesVoice note, text, photo
AI modelsOpenAI transcription, GPT-4o-mini vision, GPT-4.1-mini agent, OpenAI speech
Knowledge baseSupabase vector store, products table
Workflow size21 nodes after cleanup (22 in the first export)

How the System Works

Every message passes through six stages, from the customer’s WhatsApp message to the reply, in a single n8n workflow.

StepProcess
1. WhatsApp inputThe customer sends a voice note, a text or a photo. The WhatsApp Trigger node receives it.
2. RoutingA Switch node checks the message type and sends it down the audio, text or image path.
3. Media handlingVoice notes and photos are downloaded through the WhatsApp media API. A voice note is transcribed and a photo is described by a vision model.
4. NormalizingEdit Fields nodes turn each path into the same two fields: the message text and the customer’s phone number as session id.
5. AI agentThe agent looks up facts in the Supabase products table, thinks again, and writes a short reply. It remembers the conversation by phone number.
6. ReplyIf the customer sent audio, the reply is converted to speech and sent as a voice note. Otherwise it is sent as text.
The top branch handles voice notes, the middle branch handles text, and the bottom branch handles photos. All three meet at the AI Agent, which has its model, memory, a Think tool and the Supabase Vector Store attached.
  • WhatsApp Business Cloud API: receives customer messages, downloads media and sends replies.
  • OpenAI: transcribes audio, describes images, runs the agent (GPT-4.1-mini) and creates the spoken reply.
  • Supabase: vector store over the products table, queried by the agent as a tool.
  • n8n Simple Memory: keeps recent messages per customer phone number.

Core Workflow Configuration

The workflow is built from a handful of node groups. Each one has a single job and passes the same two fields forward, so the agent never needs to know how the message arrived.

Node groupConfiguration
WhatsApp TriggerListens for message updates from the WhatsApp Business Cloud API.
SwitchThree rules: audio (by mime type), text (by message type) and image (by mime type).
Download media + HTTP RequestGets the media URL from WhatsApp, then downloads the file with the WhatsApp credential. Used for both audio and images.
Transcribe a recordingOpenAI audio transcription of the downloaded voice note.
Analyze imageOpenAI vision (GPT-4o-mini) on the downloaded photo, returned as a text description.
Edit Fields (three)Set userMessage (the text, transcript or image description) and sessionId (the customer’s phone number).
AI AgentGPT-4.1-mini with a system prompt: short WhatsApp-style replies under 80 words, one emoji at most, never guess, answer only from the database, hand complex issues to human support.
Simple MemoryWindow memory keyed on the customer’s phone number.
Supabase Vector StoreRetrieve-as-tool on the products table, with OpenAI embeddings.
ThinkA reasoning tool the agent can use before answering.
IfChecks whether the original message was audio.
Generate audio + Send voice replyTurns the answer into speech and sends it back as an audio message.
Send messageSends the answer as a WhatsApp text message.

Product Experience

These three mockups show how the assistant is meant to feel on the customer’s phone, one for each input type. They are illustrative designs, not screenshots of live conversations. The status messages (“Transcribing…”, “Searching our catalog…”) and the Shopify order lookup and replacement order shown in scenarios 1 and 3 are not in the current workflow and belong to a planned extension.

Scenario 1: voice input

The customer sends a voice note. The workflow transcribes it, the agent finds the answer, and the reply comes back as a voice note because the customer used voice.

Scenario 2: text input

A typed question goes straight to the agent, which checks the product data and answers in two or three short lines, with a follow-up question to move the sale forward.

Scenario 3: image input

A photo is described by the vision model, and that description is handled as the customer’s message. In the current workflow the agent matches it against the product table. Order lookup and replacement orders are future work.

Results & Metrics

The workflow is built and cleaned up, and no live customer data has been measured yet. The figures below describe what was delivered. Response time, accuracy and conversion numbers should be added after a pilot with real conversations.

MetricResult
Production workflows1 main agent workflow
n8n nodes21 after cleanup
Input types supported3: voice note, text, photo
Reply formats2: text and voice note
AI models used4: transcription, vision, agent, speech
Knowledge sourceSupabase products table, searched by the agent as a tool
Workflow defects fixed2 (placeholder Code node, wrong message type)
Live response time and accuracyNot measured yet

Technical Challenges & Solutions

Reviewing the exported workflow turned up problems that would have stopped it from working in production.

Voice reply could not be sent

The voice path ended in a Code node that still held the placeholder YOUR_BASE64_STRING_HERE, and the send node used the document message type.

Removed the Code node, connected “Generate audio” directly to the send node, renamed it “Send voice reply”, and set its message type to audio with the customer’s number as recipient.

The voice path is complete from the audio message to the voice reply.

Credentials missing after import

After importing the workflow into a new n8n account, every WhatsApp, OpenAI and Supabase node showed a warning.

Reselect the credentials on each flagged node. For presentations, a demo copy with sample output pinned on the main-path nodes can be used.

The nodes can be run green once credentials are set. A demo copy was prepared for the voice path.

AI answers must stay factual

A sales assistant that invents prices or stock levels loses customer trust.

The system prompt requires the agent to retrieve facts from Supabase before answering, to ask when data is missing, and to hand complex issues to human support. Replies are capped at 80 words.

Answers stay short and grounded in the product table.

Secrets inside workflow files

A related Shopify workflow contains an access token written directly into its HTTP nodes.

Rotate the token and move it into an n8n credential before sharing or publishing that workflow.

Open item, to be done by the store owner.

Key Takeaways & Future Development

Key takeaways

  • One agent for three input types: routing by message type and normalizing to the same two fields keeps the agent simple.
  • Grounded answers: forcing a database lookup before every reply is what keeps the assistant safe to put in front of customers.
  • Voice in, voice out: answering in the customer’s own format makes the assistant feel natural on WhatsApp.

Future development

  • Connect Shopify so the agent can check order status and create replacement orders, as shown in the mockups.
  • Add progress messages such as “Transcribing your voice message” while longer steps run.
  • Hand over to a human on WhatsApp, with the conversation passed to the support team.
  • Run a pilot with real customers and record response time, answer accuracy and sales conversion.
  • Move secrets such as the Shopify token into n8n credentials.