This workflow corresponds to n8n.io template #12722 — we link there as the canonical source.
This workflow follows the HTTP Request → OpenAI 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": "37NGq2bi20AHoMgr",
"name": "whatsapp-demo-bot-whapi-n8n-moderation",
"tags": [],
"nodes": [
{
"id": "221ce7c6-3987-4463-9693-5959ab475597",
"name": "1\ufe0f\u20e3 Receive WhatsApp Message",
"type": "n8n-nodes-base.webhook",
"position": [
1232,
896
],
"parameters": {
"path": "8794014c-2794-418c-9432-14a27f49b964",
"options": {},
"httpMethod": "POST"
},
"typeVersion": 1
},
{
"id": "ec04f539-2ca5-4a7b-bc58-0c985160daca",
"name": "2\ufe0f\u20e3 Get Message Info",
"type": "n8n-nodes-base.set",
"position": [
1456,
896
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "message",
"name": "message",
"type": "object",
"value": "={{ $json.body.messages[0] }}"
},
{
"id": "chatId",
"name": "chatId",
"type": "string",
"value": "={{ $json.body.messages[0].chat_id }}"
},
{
"id": "textBody",
"name": "textBody",
"type": "string",
"value": "={{ $json.body.messages[0].text.body }}"
},
{
"id": "fromMe",
"name": "fromMe",
"type": "boolean",
"value": "={{ $json.body.messages[0].from_me }}"
},
{
"id": "commandInput",
"name": "commandInput",
"type": "string",
"value": "={{ $json.body.messages[0].text.body.trim() }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "89f18156-b6a7-46ad-b8fd-25c608d77160",
"name": "3\ufe0f\u20e3 Ignore Bot's Own Messages",
"type": "n8n-nodes-base.if",
"position": [
1664,
896
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "fromMe",
"operator": {
"type": "boolean",
"operation": "false"
},
"leftValue": "={{ $json.fromMe }}",
"rightValue": false
}
]
}
},
"typeVersion": 2
},
{
"id": "1db9f48c-b079-43df-afe2-3051242d682b",
"name": "4\ufe0f\u20e3 What Type of Command?",
"type": "n8n-nodes-base.switch",
"position": [
2400,
816
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "ai",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "isAiCommand",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput.toLowerCase() }}",
"rightValue": "/ai "
}
]
},
"renameOutput": true
},
{
"outputKey": "numeric",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "isNumeric",
"operator": {
"type": "string",
"operation": "regex"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput }}",
"rightValue": "^\\d+$"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"typeVersion": 3
},
{
"id": "9bf2270e-cc18-4fbd-853d-b57fd992c739",
"name": "Extract AI Question",
"type": "n8n-nodes-base.set",
"position": [
2928,
496
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "aiPrompt",
"name": "aiPrompt",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput.substring(4).trim() }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "8c497783-23ea-4e3b-8a59-d05291a39290",
"name": "Format AI Answer",
"type": "n8n-nodes-base.set",
"position": [
3472,
496
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.chatId }}"
},
{
"id": "body",
"name": "body",
"type": "string",
"value": "={{ $json.output[0].content[0].text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "9dbbb18d-ff8a-4243-84ab-c51a9267fe18",
"name": "5\ufe0f\u20e3 Which Number Command? (1-9)",
"type": "n8n-nodes-base.switch",
"position": [
2928,
1680
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "text",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "text",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput }}",
"rightValue": "1"
}
]
},
"renameOutput": true
},
{
"outputKey": "image",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "image",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput }}",
"rightValue": "2"
}
]
},
"renameOutput": true
},
{
"outputKey": "document",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "document",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput }}",
"rightValue": "3"
}
]
},
"renameOutput": true
},
{
"outputKey": "video",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "video",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput }}",
"rightValue": "4"
}
]
},
"renameOutput": true
},
{
"outputKey": "contact",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "contact",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput }}",
"rightValue": "5"
}
]
},
"renameOutput": true
},
{
"outputKey": "product",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "product",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput }}",
"rightValue": "6"
}
]
},
"renameOutput": true
},
{
"outputKey": "group_create",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "group_create",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput }}",
"rightValue": "7"
}
]
},
"renameOutput": true
},
{
"outputKey": "group_text",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "group_text",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput }}",
"rightValue": "8"
}
]
},
"renameOutput": true
},
{
"outputKey": "groups_ids",
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "groups_ids",
"operator": {
"type": "string",
"operation": "startsWith"
},
"leftValue": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.commandInput }}",
"rightValue": "9"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3
},
{
"id": "02d4a23b-fef4-410c-806b-e879b91a97aa",
"name": "Show Help Menu",
"type": "n8n-nodes-base.set",
"position": [
3424,
880
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.chatId }}"
},
{
"id": "body",
"name": "body",
"type": "string",
"value": "Hi. Send me a number from the list to try a command, or use /AI <your message> to chat with ChatGPT.\\n\\n1. Simple text message\\n2. Send image\\n3. Send document\\n4. Send video\\n5. Send contact\\n6. Send product\\n7. Create group\\n8. Simple text message for the group\\n9. Get the id's of your three groups"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "804f60e8-2ea4-47e0-808b-d605af8511b2",
"name": "Prepare: Simple Text",
"type": "n8n-nodes-base.set",
"position": [
3536,
1328
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.chatId }}"
},
{
"id": "body",
"name": "body",
"type": "string",
"value": "Simple text message"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "fd1d87b2-9f9a-4b54-99ce-a3445e986146",
"name": "\ud83d\udce4 Send Text Message",
"type": "n8n-nodes-base.httpRequest",
"position": [
4672,
624
],
"parameters": {
"url": "https://gate.whapi.cloud/messages/text",
"method": "POST",
"options": {},
"jsonBody": "={\"to\": \"{{ $json.to }}\", \"body\": \"{{ $json.body }}\"}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "whapiChannelApi"
},
"typeVersion": 4.2
},
{
"id": "71c4bbf6-f7e1-4056-99f9-c785d917809c",
"name": "Prepare: Image (Command 2)",
"type": "n8n-nodes-base.set",
"position": [
3536,
1488
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.chatId }}"
},
{
"id": "caption",
"name": "caption",
"type": "string",
"value": "Text under the photo."
},
{
"id": "mediaPath",
"name": "mediaPath",
"type": "string",
"value": "https://upload.wikimedia.org/wikipedia/commons/3/3f/JPEG_example_flower.jpg"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "d90091d7-4757-4191-9a01-99db453d906e",
"name": "\ud83d\udce4 Send Image",
"type": "n8n-nodes-base.httpRequest",
"position": [
3776,
1488
],
"parameters": {
"url": "https://gate.whapi.cloud/messages/image",
"method": "POST",
"options": {},
"jsonBody": "={\"to\": \"{{ $json.to }}\", \"media\": \"{{ $json.mediaPath }}\", \"caption\": \"{{ $json.caption }}\"}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "whapiChannelApi"
},
"typeVersion": 4.2
},
{
"id": "b5a42cc5-ceae-4885-90a8-e1611cf69147",
"name": "Prepare: Document (Command 3)",
"type": "n8n-nodes-base.set",
"position": [
3536,
1696
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.chatId }}"
},
{
"id": "caption",
"name": "caption",
"type": "string",
"value": "Text under the document."
},
{
"id": "mediaPath",
"name": "mediaPath",
"type": "string",
"value": "https://upload.wikimedia.org/wikipedia/commons/2/27/PDF_metadata.pdf"
},
{
"id": "02fb71b0-426b-40a3-8cd5-ba4d490cc5c8",
"name": "filename",
"type": "string",
"value": "Example"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "014a5025-5bfa-4c0d-8960-426d2356a17b",
"name": "\ud83d\udce4 Send Document",
"type": "n8n-nodes-base.httpRequest",
"position": [
3776,
1696
],
"parameters": {
"url": "https://gate.whapi.cloud/messages/document",
"method": "POST",
"options": {},
"jsonBody": "={\"to\": \"{{ $json.to }}\", \"media\": \"{{ $json.mediaPath }}\", \"filename\": \"{{ $json.filename }}\", \"caption\": \"{{ $json.caption }}\"}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "whapiChannelApi"
},
"typeVersion": 4.2
},
{
"id": "d67733e9-b334-42f8-a9d5-76aaf06e36b6",
"name": "Prepare: Video (Command 4)",
"type": "n8n-nodes-base.set",
"position": [
3536,
1904
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.chatId }}"
},
{
"id": "caption",
"name": "caption",
"type": "string",
"value": "Text under the video."
},
{
"id": "mediaPath",
"name": "mediaPath",
"type": "string",
"value": "https://download.samplelib.com/mp4/sample-5s.mp4"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f70c5397-aecf-40e1-8011-2648aa59f7ff",
"name": "\ud83d\udce4 Send Video",
"type": "n8n-nodes-base.httpRequest",
"position": [
3776,
1904
],
"parameters": {
"url": "https://gate.whapi.cloud/messages/video",
"method": "POST",
"options": {},
"jsonBody": "={\"to\": \"{{ $json.to }}\", \"media\": \"{{ $json.mediaPath }}\", \"caption\": \"{{ $json.caption }}\"}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "whapiChannelApi"
},
"typeVersion": 4.2
},
{
"id": "8590f37f-dd6d-411d-8ee8-0a6fab3466f2",
"name": "\ud83d\udce4 Send Contact",
"type": "n8n-nodes-base.httpRequest",
"position": [
3776,
2112
],
"parameters": {
"url": "https://gate.whapi.cloud/messages/contact",
"method": "POST",
"options": {},
"jsonBody": "={\"to\": \"{{ $json.to }}\", \"name\": \"{{ $json.name }}\", \"vcard\": \"{{ $json.vcard }}\"}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "whapiChannelApi"
},
"typeVersion": 4.2
},
{
"id": "ed7e0644-590b-4764-b16b-639d46469c6f",
"name": "Create WhatsApp Group",
"type": "n8n-nodes-base.httpRequest",
"position": [
3776,
2512
],
"parameters": {
"url": "https://gate.whapi.cloud/groups",
"method": "POST",
"options": {},
"jsonBody": "={\"subject\": \"{{ $json.subject }}\", \"participants\": [{{ $json.participants }}]}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "whapiChannelApi"
},
"typeVersion": 4.2
},
{
"id": "2643fb43-1ee7-4e9a-91da-05b83371b241",
"name": "Format Group Creation Result",
"type": "n8n-nodes-base.set",
"position": [
4016,
2512
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.chatId }}"
},
{
"id": "body",
"name": "body",
"type": "string",
"value": "={{ $json.group_id ? `Group created. Group id: ${$json.group_id}. Use it ID in node Prepare: Group Message - before executing command 8` : \"Error\" }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "c61c2d5d-0d9d-4d21-a739-72c13c2368fb",
"name": "Prepare: Group Message (Command 8)",
"type": "n8n-nodes-base.set",
"position": [
3536,
2720
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $env.GROUP_ID }}"
},
{
"id": "body",
"name": "body",
"type": "string",
"value": "Simple text message for the group"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "5e34de2e-7f0e-44a1-8bd5-5ee7d9d563fc",
"name": "Get Groups List (Command 9)",
"type": "n8n-nodes-base.httpRequest",
"position": [
3536,
2944
],
"parameters": {
"url": "https://gate.whapi.cloud/groups?count=3",
"options": {},
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "whapiChannelApi"
},
"typeVersion": 4.2
},
{
"id": "883de69f-e840-4107-bb90-702c487dc485",
"name": "Format Groups List",
"type": "n8n-nodes-base.set",
"position": [
3760,
2944
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.message.chat_id }}"
},
{
"id": "body",
"name": "body",
"type": "string",
"value": "={{ \n ($json.groups && $json.groups.length)\n ? $json.groups.map(g => `${g.id} - ${String(g.name).replace(/[\\r\\n]+/g, ' ')}`).join(' & ')\n : 'No groups'\n}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "df93303e-38b6-42fe-ae07-b0ce23c914bd",
"name": "Workflow Overview",
"type": "n8n-nodes-base.stickyNote",
"position": [
416,
704
],
"parameters": {
"width": 624,
"height": 608,
"content": "## How it works\n\nThis workflow is a WhatsApp bot built with the Whapi.Cloud API. Messages arrive through a webhook. The workflow reads each message and routes it. If the text starts with /AI, the rest is sent to OpenAI ChatGPT and the reply is sent back to the user. If the user sends a digit from 1 to 9, the bot runs one of the built\u2011in actions: send text, image, document, video, or contact; send a product; create a group; send a message to a group; or list groups. Any other text triggers the help menu with the command list.\n\n## Setup steps\n\n**1. Credentials.** Add your Whapi.Cloud [channel token](https://panel.whapi.cloud/dashboard). In each HTTP Request node, set the credential to your Whapi token. Or use a custom header: name `Authorization`, value `Bearer YOUR_TOKEN`.\n\n**2. Environment variables (optional).** Set `OPENAI_API_KEY` if you use AI chat; `PRODUCT_ID` for the product command; `GROUP_ID` for sending messages to a group. Replace `YOUR_PRODUCT_ID` in the Prepare: Product node with your real product ID from the catalogue.\n\n**3. Webhook.** Copy the Production URL from the webhook node. In Whapi.Cloud, open your channel and go to Webhooks. Add a webhook: event `messages`, method `POST`, mode `Body`. Paste the Production URL. Do not use the Test URL when the workflow is live.\n\n**4. Media (optional).** In the Prepare nodes for image, document, or video, use a direct, publicly accessible URL. The link must point to the final file."
},
"typeVersion": 1
},
{
"id": "9a30719d-2737-4ef7-9da0-c33f2946dc20",
"name": "Webhook Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
1072
],
"parameters": {
"color": 4,
"width": 336,
"content": "## Webhook Trigger\n\nReceives incoming WhatsApp messages from Whapi.Cloud. Configure the webhook URL in [Whapi.Cloud Channel settings](https://panel.whapi.cloud/dashboard) to point to this endpoint."
},
"typeVersion": 1
},
{
"id": "259ae736-a30c-4943-935d-988cfef54585",
"name": "Route Command Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
2256,
1024
],
"parameters": {
"color": 4,
"width": 352,
"height": 192,
"content": "Routes incoming messages to appropriate handlers:\n- **AI output:** Messages starting with `/AI ` \u2192 OpenAI integration\n- **Numeric output:** Messages with digits (1-9) \u2192 Command routing\n- **Default output:** Unknown commands \u2192 Help message"
},
"typeVersion": 1
},
{
"id": "5bbb02b8-1a4f-4211-9503-b9e2db5178a0",
"name": "AI Integration Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
2960,
368
],
"parameters": {
"color": 4,
"width": 576,
"height": 96,
"content": "Uses OpenAI ChatGPT for AI-powered responses. Requires `OPENAI_API_KEY` environment variable.\n\n**Usage:** Send `/AI <your message>` to chat with ChatGPT."
},
"typeVersion": 1
},
{
"id": "b6d0d848-10a8-4c70-b844-a3c9fc536c2e",
"name": "Switch Node Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
2832,
2112
],
"parameters": {
"color": 4,
"width": 288,
"height": 256,
"content": "Routes numeric commands (1-9) to specific handlers:\n- **1:** Text message\n- **2:** Image\n- **3:** Document\n- **4:** Video\n- **5:** Contact\n- **6:** Product\n- **7:** Create group\n- **8:** Group text\n- **9:** Get groups list"
},
"typeVersion": 1
},
{
"id": "49001bc0-deec-4099-b903-33b3c2696a64",
"name": "Command 1 Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
4544,
1360
],
"parameters": {
"color": 5,
"width": 544,
"height": 240,
"content": "## Command 1: Simple Text\n\n**User sends:** `1`\n\n**What happens:**\n1. Prepares text message\n2. Sends via Whapi.Cloud\n\n**To customize:** Edit \"Prepare: Simple Text\" node \u2192 Change `body` field"
},
"typeVersion": 1
},
{
"id": "56479bba-fb63-4e73-bd9a-7f0398660a7d",
"name": "Command 2 Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
5120,
1360
],
"parameters": {
"color": 5,
"width": 560,
"height": 240,
"content": "## Command 2: Send Image\n\n**User sends:** `2`\n\n**What happens:**\n1. Prepares image data (URL path, caption)\n2. Sends via Whapi.Cloud\n\n**To customize:** Edit \"Prepare: Image\" node \u2192 Change `mediaPath` and `caption`"
},
"typeVersion": 1
},
{
"id": "ab320567-1d57-4a65-8056-504ee61ee1c7",
"name": "Command 3 Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
4544,
1632
],
"parameters": {
"color": 5,
"width": 544,
"height": 256,
"content": "## Command 3: Send Document\n\n**User sends:** `3`\n\n**What happens:**\n1. Prepares PDF document data (URL path, caption, filename)\n2. Sends via Whapi.Cloud\n\n**To customize:** Edit \"Prepare: Document\" node \u2192 Change `mediaPath` and `caption` and `filename`"
},
"typeVersion": 1
},
{
"id": "d20b859e-1073-4f6c-9254-1a8ec4e7d413",
"name": "Command 4 Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
5120,
1632
],
"parameters": {
"color": 5,
"width": 560,
"height": 256,
"content": "## Command 4: Send Video\n\n**User sends:** `4`\n\n**What happens:**\n1. Prepares video data (URL path, caption)\n2. Sends via Whapi.Cloud\n\n**To customize:** Edit \"Prepare: Video\" node \u2192 Change `mediaPath` and `caption`"
},
"typeVersion": 1
},
{
"id": "9ae9c2a9-065f-49a7-83b5-78e022cfe129",
"name": "Command 5 Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
4544,
1920
],
"parameters": {
"color": 5,
"width": 544,
"height": 256,
"content": "## Command 5: Send Contact\n\n**User sends:** `5`\n\n**What happens:**\n1. Prepares contact data (name, vCard). You can use [the vCard generator in the dashboard](https://panel.whapi.cloud/tools/vcard-creation)\n2. Sends contact card via JSON\n\n**To customize:** Edit vCard file or \"Prepare: Contact\" node \u2192 Change `name`"
},
"typeVersion": 1
},
{
"id": "b26c453a-5122-4d20-871e-390363954543",
"name": "Command 6 Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
5120,
1920
],
"parameters": {
"color": 5,
"width": 560,
"height": 256,
"content": "## Command 6: Get Product\n\n**User sends:** `6`\n\nYou need [to find out your ProductID](https://whapi.readme.io/reference/getproducts) before you use this command. \n\n**To customize:** Edit \"Prepare: Product (Command 6)\" node \u2192 Change `ProductID`"
},
"typeVersion": 1
},
{
"id": "cce74f62-ba4d-47c1-969b-d1b3a210849b",
"name": "Command 7 Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
4544,
2208
],
"parameters": {
"color": 5,
"width": 544,
"height": 288,
"content": "## Command 7: Create Group\n\n**User sends:** `7`\n\n**What happens:**\n1. Extracts sender phone number\n2. Creates new WhatsApp group\n3. Adds the sender and several other numbers as participants\n4. Returns group ID\n\n**To customize:** Edit \"Prepare: Create Group\" node \u2192 Change `subject` (group name) and `participants`"
},
"typeVersion": 1
},
{
"id": "46e36acc-cb02-4aaa-9763-2b01962e947e",
"name": "Command 8 Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
5120,
2208
],
"parameters": {
"color": 5,
"width": 560,
"height": 288,
"content": "## Command 8: Group Message\n\n**User sends:** `8`\n\n**What happens:**\n1. Prepares message for group\n2. Uses GROUP_ID from environment or provide a specific identifier \n3. Sends message to group\n\n**Requires:** `GROUP_ID` in environment variables\n\n**To customize:** Set `GROUP_ID` in n8n environment variables (get from Command 9)"
},
"typeVersion": 1
},
{
"id": "7cb3653b-f3e6-4b80-9d06-0ef86c779bfa",
"name": "Command 9 Info",
"type": "n8n-nodes-base.stickyNote",
"position": [
4544,
2528
],
"parameters": {
"color": 5,
"width": 544,
"height": 256,
"content": "## Command 9: List Groups\n\n**User sends:** `9`\n\n**What happens:**\n1. Gets list of up to 3 groups\n2. Formats group IDs and names\n3. Sends list to user\n\n**Use this:** To get GROUP_ID for Command 8"
},
"typeVersion": 1
},
{
"id": "8e1e8fcc-3c71-4f99-a49b-d7e7c286f62c",
"name": "Message a model",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
3136,
496
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-3.5-turbo",
"cachedResultName": "GPT-3.5-TURBO"
},
"options": {
"store": false
},
"responses": {
"values": [
{
"content": "={{ $json.aiPrompt }}"
},
{
"role": "system",
"content": "You are an expert conversationalist who responds to users in line with their speech and writing patterns in a way that feels natural to human users. Adapt to the user's style and tone in a natural, conversational way, without expressing your own personal point of view. Use emojis, slang, colloquial language, etc. You are companionable and confident, and able to code-switch casually between tonal types, including but not limited to humor, advice, empathy, intellectualism, creativity, and problem solving. Responses must be interesting, engaging, or viable, never bland or boring.\n\nMatch the user's tone, formality level (casual, professional, formal, etc.) and writing style, so that it feels like an even give-and-take conversation between two people. Be natural, don't be bland or robotic. Mirror the user's intentionality and style in a natural, consistent way. For example, if they use proper grammar, then you use proper grammar. If they don't use proper grammar, you don't use proper grammar, etc.\n\nYou are mirroring the user but you are NOT taking on their identity or personality or point of view. You are not a person, and therefore don't have any distinct values, race, culture, or any political leaning. You do not express personal attachments, strong negative feelings toward anyone, or any individualized perspective of your own."
}
]
},
"builtInTools": {}
},
"typeVersion": 2
},
{
"id": "4a9b587a-7edc-426a-80b3-8d258a286e42",
"name": "\ud83d\udce4 Send Product",
"type": "n8n-nodes-base.httpRequest",
"position": [
3776,
2304
],
"parameters": {
"url": "=https://gate.whapi.cloud/business/products/{{ $json.ProductID }}",
"method": "POST",
"options": {},
"jsonBody": "={\"to\": \"{{ $json.to }}\"}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "whapiChannelApi"
},
"typeVersion": 4.2
},
{
"id": "2dec4c9f-4068-48e8-a5ce-fd7aa280a0e9",
"name": "Prepare: Contact (Command 5)",
"type": "n8n-nodes-base.set",
"position": [
3536,
2112
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.chatId }}"
},
{
"id": "name",
"name": "name",
"type": "string",
"value": "Whapi Test"
},
{
"id": "vcard",
"name": "vcard",
"type": "string",
"value": "=BEGIN:VCARD\\nVERSION:3.0\\nN:Last Name;Example First Name;;;\\nFN:Example First Name Last Name\\nORG:Company Name Department\\nTITLE:Job Title\\nNOTE:null\\nTEL;type=Mobile:+1 555 000 0000\\nitem1.URL:www.example.com\\nitem1.X-ABLabel:OTHER\\nEMAIL;TYPE=Home:contact@example.com\\nitem2.ADR;type=Home:;;Example Street;Example City;;;Country\\nitem2.X-ABADR:\\nEND:VCARD"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "405823af-b8ba-48d9-a86f-52b9aa0612f1",
"name": "Prepare: Product (Command 6)",
"type": "n8n-nodes-base.set",
"position": [
3536,
2304
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "to",
"name": "to",
"type": "string",
"value": "={{ $('2\ufe0f\u20e3 Get Message Info').item.json.chatId }}"
},
{
"id": "name",
"name": "ProductID",
"type": "string",
"value": "YOUR_PRODUCT_ID"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "53ff7c93-3dac-4319-acb4-d0a716bbc759",
"name": "Prepare: Create Group (Command 7)",
"type": "n8n-nodes-base.set",
"position": [
3536,
2512
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "name",
"name": "subject",
"type": "string",
"value": "My new group"
},
{
"id": "d01ca385-c765-4820-82d2-7272c0333198",
"name": "participants",
"type": "string",
"value": "=\"{{ $('2\ufe0f\u20e3 Get Message Info').item.json.message.from }}\", \"15550000001\", \"15550000002\""
}
]
}
},
"typeVersion": 3.4
},
{
"id": "98040a79-78ed-407b-9a10-65c38a3fb898",
"name": "\u2714\u2714 Mark message as read",
"type": "n8n-nodes-base.httpRequest",
"position": [
2016,
832
],
"parameters": {
"url": "=https://gate.whapi.cloud/messages/{{ $('2\ufe0f\u20e3 Get Message Info').item.json.message.id }}",
"method": "PUT",
"options": {},
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
},
"nodeCredentialType": "whapiChannelApi"
},
"executeOnce": false,
"notesInFlow": false,
"retryOnFail": false,
"typeVersion": 4.3,
"alwaysOutputData": false
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "5ba4cb4c-d865-452f-a5e5-f8fd9e39cfcf",
"connections": {
"Show Help Menu": {
"main": [
[
{
"node": "\ud83d\udce4 Send Text Message",
"type": "main",
"index": 0
}
]
]
},
"Message a model": {
"main": [
[
{
"node": "Format AI Answer",
"type": "main",
"index": 0
}
]
]
},
"Format AI Answer": {
"main": [
[
{
"node": "\ud83d\udce4 Send Text Message",
"type": "main",
"index": 0
}
]
]
},
"Format Groups List": {
"main": [
[
{
"node": "\ud83d\udce4 Send Text Message",
"type": "main",
"index": 0
}
]
]
},
"Extract AI Question": {
"main": [
[
{
"node": "Message a model",
"type": "main",
"index": 0
}
]
]
},
"Prepare: Simple Text": {
"main": [
[
{
"node": "\ud83d\udce4 Send Text Message",
"type": "main",
"index": 0
}
]
]
},
"Create WhatsApp Group": {
"main": [
[
{
"node": "Format Group Creation Result",
"type": "main",
"index": 0
}
]
]
},
"2\ufe0f\u20e3 Get Message Info": {
"main": [
[
{
"node": "3\ufe0f\u20e3 Ignore Bot's Own Messages",
"type": "main",
"index": 0
}
]
]
},
"Prepare: Image (Command 2)": {
"main": [
[
{
"node": "\ud83d\udce4 Send Image",
"type": "main",
"index": 0
}
]
]
},
"Prepare: Video (Command 4)": {
"main": [
[
{
"node": "\ud83d\udce4 Send Video",
"type": "main",
"index": 0
}
]
]
},
"Get Groups List (Command 9)": {
"main": [
[
{
"node": "Format Groups List",
"type": "main",
"index": 0
}
]
]
},
"\u2714\u2714 Mark message as read": {
"main": [
[
{
"node": "4\ufe0f\u20e3 What Type of Command?",
"type": "main",
"index": 0
}
]
]
},
"Format Group Creation Result": {
"main": [
[
{
"node": "\ud83d\udce4 Send Text Message",
"type": "main",
"index": 0
}
]
]
},
"Prepare: Contact (Command 5)": {
"main": [
[
{
"node": "\ud83d\udce4 Send Contact",
"type": "main",
"index": 0
}
]
]
},
"Prepare: Product (Command 6)": {
"main": [
[
{
"node": "\ud83d\udce4 Send Product",
"type": "main",
"index": 0
}
]
]
},
"4\ufe0f\u20e3 What Type of Command?": {
"main": [
[
{
"node": "Extract AI Question",
"type": "main",
"index": 0
}
],
[
{
"node": "5\ufe0f\u20e3 Which Number Command? (1-9)",
"type": "main",
"index": 0
}
],
[
{
"node": "Show Help Menu",
"type": "main",
"index": 0
}
]
]
},
"Prepare: Document (Command 3)": {
"main": [
[
{
"node": "\ud83d\udce4 Send Document",
"type": "main",
"index": 0
}
]
]
},
"1\ufe0f\u20e3 Receive WhatsApp Message": {
"main": [
[
{
"node": "2\ufe0f\u20e3 Get Message Info",
"type": "main",
"index": 0
}
]
]
},
"3\ufe0f\u20e3 Ignore Bot's Own Messages": {
"main": [
[
{
"node": "\u2714\u2714 Mark message as read",
"type": "main",
"index": 0
}
]
]
},
"Prepare: Create Group (Command 7)": {
"main": [
[
{
"node": "Create WhatsApp Group",
"type": "main",
"index": 0
}
]
]
},
"Prepare: Group Message (Command 8)": {
"main": [
[
{
"node": "\ud83d\udce4 Send Text Message",
"type": "main",
"index": 0
}
]
]
},
"5\ufe0f\u20e3 Which Number Command? (1-9)": {
"main": [
[
{
"node": "Prepare: Simple Text",
"type": "main",
"index": 0
}
],
[
{
"node": "Prepare: Image (Command 2)",
"type": "main",
"index": 0
}
],
[
{
"node": "Prepare: Document (Command 3)",
"type": "main",
"index": 0
}
],
[
{
"node": "Prepare: Video (Command 4)",
"type": "main",
"index": 0
}
],
[
{
"node": "Prepare: Contact (Command 5)",
"type": "main",
"index": 0
}
],
[
{
"node": "Prepare: Product (Command 6)",
"type": "main",
"index": 0
}
],
[
{
"node": "Prepare: Create Group (Command 7)",
"type": "main",
"index": 0
}
],
[
{
"node": "Prepare: Group Message (Command 8)",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Groups List (Command 9)",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
How it works: • Receives WhatsApp messages via webhook from Whapi.Cloud • Routes commands: AI chat (/ai), numeric commands (1-9), or help menu • Sends responses: text, images, documents, videos, contacts, product info • Manages WhatsApp groups: create, send messages, list groups…
Source: https://n8n.io/workflows/12722/ — 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.
The Ultimate Scraper for n8n uses Selenium and AI to retrieve any information displayed on a webpage. You can also use session cookies to log in to the targeted webpage for more advanced scraping need
z-Api. Uses httpRequest, openAi, redis, postgres. Webhook trigger; 61 nodes.
This workflow will allow you to use OpenAI Assistant API together with a chatting platform. This version is configured to work with Hubspot, however, the Hubspot modules can be replaced by other platf
Categories: AI, Productivity, Career
This n8n template demonstrates how you can generate an AI-produced weather analysis of your local radar loop and home assistant precipitation sensor(s) to keep your family informed of National Weather