This workflow corresponds to n8n.io template #17220 — we link there as the canonical source.
This workflow follows the Agent → HTTP Request recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "WhatsApp AI customer support agent for text and voice messages with memory using OpenAI",
"nodes": [
{
"id": "667f0c2e-c637-4f92-936e-624c67cccfd4",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-608,
-208
],
"parameters": {
"width": 480,
"height": 896,
"content": "## WhatsApp AI customer support agent for text and voice messages with memory using OpenAI\n\n### How it works\n\nThis workflow turns WhatsApp into an AI customer support channel for both text and voice messages. It receives an inbound WhatsApp message, applies business-specific settings, routes text directly to the AI agent, and transcribes voice notes before sending them to the same agent. The agent uses an OpenAI chat model with per-contact memory, then sends the generated answer back over WhatsApp; unsupported inputs receive a prompt asking for text or voice.\n\n### Setup steps\n\n- Configure WhatsApp Cloud API credentials for the trigger and WhatsApp action nodes, including access token, phone number ID, and webhook subscription settings.\n- Edit the \u201cYour Settings (EDIT ME)\u201d node with the correct businessName, aboutBusiness, senderPhoneNumberId, and handoffEmail values.\n- Configure OpenAI credentials for the transcription node and the GPT-5 Mini chat model used by the AI agent.\n- Verify the WhatsApp media download HTTP request can authenticate against the media URL returned by WhatsApp, usually by including the required bearer token if not inherited from credentials.\n- Test with both a text message and a voice note to confirm the shared userMessage field reaches the AI agent and replies are sent to the correct contact.\n\n### Customization\n\nAdjust the business details, AI agent instructions, OpenAI model, memory window size, and fallback message text to match the support tone and escalation process for the business."
},
"typeVersion": 1
},
{
"id": "3d6921a4-9ed6-426c-9cfa-0f66286a1eb1",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-48,
32
],
"parameters": {
"color": 7,
"width": 640,
"height": 352,
"content": "## Receive and route messages\n\nStarts when a WhatsApp message arrives, applies editable business settings, and routes the incoming payload based on whether it is text, voice, or another message type."
},
"typeVersion": 1
},
{
"id": "0b4d9430-00be-489d-bdfe-3f76db117d12",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
624,
-208
],
"parameters": {
"color": 7,
"width": 240,
"height": 384,
"content": "## Extract text messages\n\nHandles the upper text-message branch by normalizing the inbound WhatsApp text into the shared userMessage field used by the AI agent."
},
"typeVersion": 1
},
{
"id": "e69b2da7-c819-4635-8d5a-773739cb9afd",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
624,
208
],
"parameters": {
"color": 7,
"width": 864,
"height": 304,
"content": "## Transcribe voice notes\n\nHandles the central voice-note branch by retrieving the WhatsApp media URL, downloading the audio, transcribing it with OpenAI, and converting the transcript into the shared userMessage field."
},
"typeVersion": 1
},
{
"id": "b41ba112-a6af-4d98-8009-ce8713e65e25",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1520,
-64
],
"parameters": {
"color": 7,
"width": 352,
"height": 544,
"content": "## Generate AI answer\n\nUses the AI support agent to answer the customer message with an OpenAI chat model and per-contact conversation memory for contextual replies."
},
"typeVersion": 1
},
{
"id": "713fd5d3-547d-4b92-9dbf-e950e97ac95f",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1904,
-48
],
"parameters": {
"color": 7,
"width": 240,
"height": 320,
"content": "## Send support reply\n\nSends the AI-generated support response back to the customer through WhatsApp."
},
"typeVersion": 1
},
{
"id": "2953a975-3924-43ff-abc2-02cc101fc5a9",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
352,
416
],
"parameters": {
"color": 7,
"width": 240,
"height": 400,
"content": "## Handle unsupported input\n\nHandles the lower fallback branch for unsupported message types by asking the customer to send either text or a voice message."
},
"typeVersion": 1
},
{
"id": "db925614",
"name": "When WhatsApp Message Received",
"type": "n8n-nodes-base.whatsAppTrigger",
"position": [
0,
208
],
"parameters": {
"updates": [
"messages"
]
},
"typeVersion": 1
},
{
"id": "f821312f",
"name": "Set Business Details",
"type": "n8n-nodes-base.set",
"position": [
224,
208
],
"parameters": {
"mode": "manual",
"assignments": {
"assignments": [
{
"id": "s1",
"name": "businessName",
"type": "string",
"value": "Acme Store"
},
{
"id": "s2",
"name": "aboutBusiness",
"type": "string",
"value": "Acme Store sells eco-friendly home goods. Opening hours: Mon-Sat 9am-6pm. Free shipping over $50. 30-day returns. Support email: user@example.com."
},
{
"id": "s3",
"name": "senderPhoneNumberId",
"type": "string",
"value": "123456789012345"
},
{
"id": "s4",
"name": "handoffEmail",
"type": "string",
"value": "user@example.com"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "4f2d90fa",
"name": "Route by WhatsApp Message Type",
"type": "n8n-nodes-base.switch",
"position": [
448,
192
],
"parameters": {
"mode": "rules",
"rules": {
"values": [
{
"outputKey": "text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.messages[0].type }}",
"rightValue": "text"
}
]
},
"renameOutput": true
},
{
"outputKey": "audio",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.messages[0].type }}",
"rightValue": "audio"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra",
"renameFallbackOutput": "other"
}
},
"typeVersion": 3.4
},
{
"id": "cb08e901",
"name": "Extract Text Message",
"type": "n8n-nodes-base.set",
"position": [
672,
16
],
"parameters": {
"mode": "manual",
"assignments": {
"assignments": [
{
"id": "t1",
"name": "userMessage",
"type": "string",
"value": "={{ $json.messages[0].text.body }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "87028b02",
"name": "Retrieve Voice Note URL",
"type": "n8n-nodes-base.whatsApp",
"position": [
672,
336
],
"parameters": {
"resource": "media",
"operation": "mediaUrlGet",
"mediaGetId": "={{ $json.messages[0].audio.id }}"
},
"typeVersion": 1.1
},
{
"id": "cab602bb",
"name": "Fetch Voice Note Audio",
"type": "n8n-nodes-base.httpRequest",
"position": [
896,
336
],
"parameters": {
"url": "={{ $json.url }}",
"method": "GET",
"options": {
"response": {
"response": {
"responseFormat": "file",
"outputPropertyName": "data"
}
}
},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "whatsAppApi"
},
"typeVersion": 4.4
},
{
"id": "638c32e3",
"name": "Transcribe Audio to Text",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1120,
336
],
"parameters": {
"options": {},
"resource": "audio",
"operation": "transcribe",
"binaryPropertyName": "data"
},
"typeVersion": 2.3
},
{
"id": "7d35b859",
"name": "Extract Text from Voice Note",
"type": "n8n-nodes-base.set",
"position": [
1344,
336
],
"parameters": {
"mode": "manual",
"assignments": {
"assignments": [
{
"id": "v1",
"name": "userMessage",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "fe54bf7b",
"name": "AI Support Response Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1568,
112
],
"parameters": {
"text": "={{ $json.userMessage }}",
"options": {
"systemMessage": "=You are a friendly WhatsApp customer-support assistant for {{ $('Set Business Details').item.json.businessName }}.\n\nAnswer ONLY using the business information below. If the answer is not covered, say you are not sure and offer to connect the customer to a human at {{ $('Set Business Details').item.json.handoffEmail }}. Never invent policies, prices or hours.\n\nKeep replies short and WhatsApp-friendly (2-4 sentences, plain text, no markdown symbols). Reply in the same language the customer used.\n\nBusiness information:\n{{ $('Set Business Details').item.json.aboutBusiness }}"
},
"promptType": "define"
},
"typeVersion": 3.1
},
{
"id": "304e1b67",
"name": "OpenAI GPT-5 Mini Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1584,
336
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5-mini"
}
},
"typeVersion": 1.3
},
{
"id": "650c657e",
"name": "Memory for Each Contact",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
1712,
336
],
"parameters": {
"sessionKey": "={{ $('When WhatsApp Message Received').item.json.messages[0].from }}",
"sessionIdType": "customKey",
"contextWindowLength": 12
},
"typeVersion": 1.3
},
{
"id": "57d00372",
"name": "Prompt for Text or Voice Message",
"type": "n8n-nodes-base.whatsApp",
"position": [
400,
656
],
"parameters": {
"resource": "message",
"textBody": "Hi! I can help you over text or a voice note. Please send your question as a message and I will get right back to you.",
"operation": "send",
"messageType": "text",
"phoneNumberId": "={{ $('Set Business Details').item.json.senderPhoneNumberId }}",
"recipientPhoneNumber": "={{ $('When WhatsApp Message Received').item.json.messages[0].from }}"
},
"typeVersion": 1.1
},
{
"id": "9693fadc",
"name": "Send WhatsApp Response",
"type": "n8n-nodes-base.whatsApp",
"position": [
1952,
112
],
"parameters": {
"resource": "message",
"textBody": "={{ $json.output }}",
"operation": "send",
"messageType": "text",
"phoneNumberId": "={{ $('Set Business Details').item.json.senderPhoneNumberId }}",
"recipientPhoneNumber": "={{ $('When WhatsApp Message Received').item.json.messages[0].from }}"
},
"typeVersion": 1.1
}
],
"connections": {
"Extract Text Message": {
"main": [
[
{
"node": "AI Support Response Agent",
"type": "main",
"index": 0
}
]
]
},
"Set Business Details": {
"main": [
[
{
"node": "Route by WhatsApp Message Type",
"type": "main",
"index": 0
}
]
]
},
"Fetch Voice Note Audio": {
"main": [
[
{
"node": "Transcribe Audio to Text",
"type": "main",
"index": 0
}
]
]
},
"Memory for Each Contact": {
"ai_memory": [
[
{
"node": "AI Support Response Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"OpenAI GPT-5 Mini Model": {
"ai_languageModel": [
[
{
"node": "AI Support Response Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Retrieve Voice Note URL": {
"main": [
[
{
"node": "Fetch Voice Note Audio",
"type": "main",
"index": 0
}
]
]
},
"Transcribe Audio to Text": {
"main": [
[
{
"node": "Extract Text from Voice Note",
"type": "main",
"index": 0
}
]
]
},
"AI Support Response Agent": {
"main": [
[
{
"node": "Send WhatsApp Response",
"type": "main",
"index": 0
}
]
]
},
"Extract Text from Voice Note": {
"main": [
[
{
"node": "AI Support Response Agent",
"type": "main",
"index": 0
}
]
]
},
"Route by WhatsApp Message Type": {
"main": [
[
{
"node": "Extract Text Message",
"type": "main",
"index": 0
}
],
[
{
"node": "Retrieve Voice Note URL",
"type": "main",
"index": 0
}
],
[
{
"node": "Prompt for Text or Voice Message",
"type": "main",
"index": 0
}
]
]
},
"When WhatsApp Message Received": {
"main": [
[
{
"node": "Set Business Details",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow responds to incoming WhatsApp Business messages, handling both text and voice notes by transcribing audio with OpenAI and replying with an OpenAI chat agent that uses per-contact conversation memory and answers only from the business information you provide.…
Source: https://n8n.io/workflows/17220/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Transform your salon/service business with this streamlined WhatsApp automation system featuring Claude integration, zero-setup database management, and intelligent conversation handling. Claude MCP I
48_WAgentEnhancement. Uses whatsAppTrigger, whatsApp, openAi, httpRequest. Event-driven trigger; 56 nodes.
This workflow creates a complete AI-powered restaurant ordering system through WhatsApp. It receives customer messages, processes multimedia content (text, voice, images, PDFs, location), uses GPT-4 t
This template is designed for anyone who wants to use WhatsApp as a personal AI assistant hub. If you often juggle tasks, emails, calendars, and expenses across multiple tools, this workflow consolida
⚠️ EDUCATIONAL DEMONSTRATION ONLY - NOT FOR PRODUCTION MEDICAL USE ⚠️