This workflow corresponds to n8n.io template #15619 — 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 →
{
"id": "QMP9g3bJFHcP05BI",
"name": "WhatsApp Marketing Campaign Engine",
"tags": [],
"nodes": [
{
"id": "f5e7a6a8-fd44-46c9-a049-7f52786c3adf",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-672,
-160
],
"parameters": {
"width": 920,
"height": 912,
"content": "## WhatsApp Marketing Campaign Engine\n\nThis workflow automatically launches AI-powered personalized promotional campaigns to WhatsApp users. It handles audience segmentation, message personalization, delivery via WhatsApp Business API, and tracks performance in Google Sheets.\n\n### Who\u2019s it for\n\u2022 Digital marketers and growth teams running high-volume WhatsApp campaigns\n\u2022 E-commerce businesses with opt-in customer lists\n\u2022 SaaS companies promoting features/upgrades\n\u2022 Businesses using WhatsApp for marketing and sales\n\n### How it works / What it does\n1. Triggers on campaign launch (webhook/schedule)\n2. Loads audience data and performs AI-powered segmentation\n3. Generates highly personalized messages based on user behavior/demographics\n4. Sends messages via WhatsApp Business API\n5. Tracks delivery, engagement, and conversions\n6. Logs all data and metrics in Google Sheets\n\n### How to set up\n1. Import this workflow\n2. Set up credentials (WhatsApp Business API, Google Sheets, OpenAI)\n3. Configure audience source and campaign templates\n4. Update AI prompt and segmentation logic\n5. Activate workflow\n\n### Requirements\n\u2022 WhatsApp Business Account & API access (Meta)\n\u2022 Google Sheets for audience & tracking\n\u2022 OpenAI / Anthropic / Grok API\n\u2022 Opt-in compliant user data\n\n### How to customize the workflow\n\u2022 Modify AI tone/offers in AI node\n\u2022 Update Python segmentation rules\n\u2022 Change Google Sheet columns\n\u2022 Add A/B testing or more conditions"
},
"typeVersion": 1
},
{
"id": "f357183e-7092-4f35-8db8-eb05352c959e",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
352,
112
],
"parameters": {
"color": 4,
"width": 732,
"height": 480,
"content": "## 1. Trigger & Audience Intake"
},
"typeVersion": 1
},
{
"id": "2a0a0ef9-300c-45cf-a111-bb60a6dfa33f",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1184,
80
],
"parameters": {
"color": 3,
"width": 988,
"height": 620,
"content": "## 2. AI Segmentation & Personalization"
},
"typeVersion": 1
},
{
"id": "533027dc-34fe-4694-a751-63b02834bcb4",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
2208,
64
],
"parameters": {
"color": 6,
"width": 944,
"height": 580,
"content": "## 3. Send & Track"
},
"typeVersion": 1
},
{
"id": "3af9fa9c-7678-48cb-a73b-4fb3deee93df",
"name": "Webhook - Launch Campaign",
"type": "n8n-nodes-base.webhook",
"position": [
448,
224
],
"parameters": {
"path": "whatsapp-campaign-launch",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 1.1
},
{
"id": "e9ee70ea-6d6d-401d-9cb5-b93f5180ea0b",
"name": "Schedule Campaign",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
448,
432
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 9 * * *"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "37572c31-f81a-433f-ae3b-648e22c65730",
"name": "Prepare Campaign Context",
"type": "n8n-nodes-base.set",
"position": [
688,
304
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"name": "campaignName",
"type": "string",
"value": "={{ $json.campaignName || $json.body?.campaignName || 'Default Promotion' }}"
},
{
"name": "goals",
"type": "string",
"value": "={{ $json.goals || $json.body?.goals }}"
},
{
"name": "phone",
"type": "string",
"value": "={{ $json.phone || $json.body?.phone }}"
},
{
"name": "name",
"type": "string",
"value": "={{ $json.name || $json.body?.name }}"
},
{
"name": "userData",
"type": "string",
"value": "={{ JSON.stringify($json.userData || $json.body?.userData || {}) }}"
},
{
"name": "messageId",
"type": "string",
"value": "={{ $json.messageId || Date.now().toString() }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b329b141-5d31-494d-9313-3993facd23f2",
"name": "Python - Segment Audience",
"type": "n8n-nodes-base.code",
"position": [
912,
304
],
"parameters": {
"mode": "runOnceForEachItem",
"language": "pythonNative",
"pythonCode": "# Add a new field called 'my_new_field' to the JSON of the item\n_item[\"json\"][\"my_new_field\"] = 1\nreturn _item"
},
"typeVersion": 2
},
{
"id": "fa9fe8fb-15f0-4f5e-bff1-87c540ecc46b",
"name": "Filter Eligible Contacts",
"type": "n8n-nodes-base.filter",
"position": [
1472,
320
],
"parameters": {
"options": {},
"conditions": {
"conditions": [
{
"operator": {
"type": "boolean",
"operation": "true"
},
"leftValue": "={{ $json.isEligible || true }}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "8155c3c8-ef98-4d20-a68b-abbe29861f1e",
"name": "Wait 1 - Rate Limit",
"type": "n8n-nodes-base.wait",
"position": [
1696,
320
],
"parameters": {},
"typeVersion": 1
},
{
"id": "a32afede-8cf5-4e3e-abff-7ae489aa5a20",
"name": "AI - Generate Personalized Message",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1920,
320
],
"parameters": {
"text": "=Act as an expert WhatsApp marketing copywriter and data analyst. Perform audience segmentation and write a professional, engaging, personalized promotional message for this contact.\n\nCampaign:\nName: {{ $json.campaignName }}\nGoals: {{ $json.goals }}\n\nUser Data:\nName: {{ $json.name }}\nPhone: {{ $json.phone }}\nProfile: {{ $json.userData }}\n\nSegment the user (e.g. high-value, new, lapsed) and generate a concise, natural WhatsApp message under 160 characters. Include strong personalization, offer, and clear CTA (link/button if applicable).",
"options": {},
"promptType": "define"
},
"typeVersion": 1.6
},
{
"id": "9d8bd73d-1fdd-4cd4-ae6d-e24518633afa",
"name": "JS - Format Message",
"type": "n8n-nodes-base.code",
"position": [
2272,
320
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "const item = $input.item.json;\nreturn {\n json: {\n ...item,\n personalizedMessage: item.response || item.text || 'Hi {{name}}, check out our latest offer!',\n status: 'Sent',\n sentDate: new Date().toISOString().split('T')[0],\n campaignName: item.campaignName\n }\n};"
},
"typeVersion": 2
},
{
"id": "e039699a-25f1-4490-9a3a-44881dd9eab9",
"name": "Wait 2 - Review Buffer",
"type": "n8n-nodes-base.wait",
"position": [
2496,
320
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c2e207e6-a0ae-46a8-903f-2cb5bc25bf72",
"name": "Send WhatsApp Message",
"type": "n8n-nodes-base.httpRequest",
"position": [
2720,
224
],
"parameters": {
"url": "https://graph.facebook.com/v20.0/{{ $json.phoneNumberId || 'YOUR_PHONE_NUMBER_ID' }}/messages",
"method": "POST",
"options": {},
"jsonBody": "={\n \"messaging_product\": \"whatsapp\",\n \"to\": \"{{ $json.phone }}\",\n \"type\": \"text\",\n \"text\": {\"body\": \"{{ $json.personalizedMessage }}\"}\n}",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "54224bf5-52cc-4149-9b18-eee3061744c5",
"name": "Update Analytics Sheet",
"type": "n8n-nodes-base.httpRequest",
"position": [
2720,
416
],
"parameters": {
"url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_SHEET_ID/values/Sheet1!A1:append?valueInputOption=USER_ENTERED",
"method": "POST",
"options": {},
"jsonBody": "={\n \"values\": [[\"{{ $json.sentDate }}\", \"{{ $json.campaignName }}\", \"{{ $json.name }}\", \"{{ $json.phone }}\", \"{{ $json.personalizedMessage }}\", \"Sent\", \"{{ new Date().toISOString() }}\"]]\n}",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "3df47196-ca8d-495b-8570-a4adad19d12f",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1792,
528
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "05ef9ca2-1c05-438d-9e47-322e799d9f78",
"name": "Wait For Data",
"type": "n8n-nodes-base.wait",
"position": [
1232,
320
],
"parameters": {},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "e83a10aa-90a0-46b4-871b-6e5861879b78",
"connections": {
"Wait For Data": {
"main": [
[
{
"node": "Filter Eligible Contacts",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI - Generate Personalized Message",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Schedule Campaign": {
"main": [
[
{
"node": "Prepare Campaign Context",
"type": "main",
"index": 0
}
]
]
},
"JS - Format Message": {
"main": [
[
{
"node": "Wait 2 - Review Buffer",
"type": "main",
"index": 0
}
]
]
},
"Wait 1 - Rate Limit": {
"main": [
[
{
"node": "AI - Generate Personalized Message",
"type": "main",
"index": 0
}
]
]
},
"Wait 2 - Review Buffer": {
"main": [
[
{
"node": "Send WhatsApp Message",
"type": "main",
"index": 0
},
{
"node": "Update Analytics Sheet",
"type": "main",
"index": 0
}
]
]
},
"Filter Eligible Contacts": {
"main": [
[
{
"node": "Wait 1 - Rate Limit",
"type": "main",
"index": 0
}
]
]
},
"Prepare Campaign Context": {
"main": [
[
{
"node": "Python - Segment Audience",
"type": "main",
"index": 0
}
]
]
},
"Python - Segment Audience": {
"main": [
[
{
"node": "Wait For Data",
"type": "main",
"index": 0
}
]
]
},
"Webhook - Launch Campaign": {
"main": [
[
{
"node": "Prepare Campaign Context",
"type": "main",
"index": 0
}
]
]
},
"AI - Generate Personalized Message": {
"main": [
[
{
"node": "JS - Format Message",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow automatically launches AI-powered personalized promotional campaigns to WhatsApp users. It handles audience segmentation, message personalization, delivery via WhatsApp Business API, and tracks performance in Google Sheets.
Source: https://n8n.io/workflows/15619/ — 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.
⏺ 🚀 How it works
L&D_AgentsAI_ATIVO. Uses httpRequest, agent, googleCalendarTool, toolSerpApi. Webhook trigger; 93 nodes.
CLINICAINTEGRAL_secretary. Uses postgres, mcpClientTool, googleDriveTool, toolWorkflow. Webhook trigger; 89 nodes.
Remi 1.1. Uses lmChatOpenAi, memoryPostgresChat, openAi, postgres. Webhook trigger; 89 nodes.
This n8n workflow orchestrates a powerful suite of AI Agents and automations to manage and optimize various aspects of an e-commerce operation, particularly for platforms like Shopify. It leverages La