This workflow follows the Google Drive → 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": "z-Api",
"nodes": [
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.message_type }}",
"rightValue": "audio",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "f1f4f21d-7bac-4148-8fa5-eb91e67e3f5e"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "audio"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.message_type }}",
"rightValue": "text",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "53ea1f96-c52a-4d1f-a00d-c0cafb1feb82"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "text"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.message_type }}",
"rightValue": "image",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "b2b2b2b2-2222-3333-4444-555555555555"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "image"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.message_type }}",
"rightValue": "button_response",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "c3c3c3c3-3333-4444-5555-666666666666"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "button"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.2,
"position": [
-3584,
536
],
"id": "237866ff-421e-4a1e-a7f7-4a813555b9af",
"name": "Message Type Router"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "credentials-object",
"name": "credentials",
"value": "={{ { \"z_api_token\": $json.headers['z-api-token'], \"instance_id\": $json.body.instanceId } }}",
"type": "object"
},
{
"id": "system-object",
"name": "system",
"value": "={{ { \"execution_mode\": $json.executionMode, \"webhook_url\": $json.webhookUrl, \"user_agent\": $json.headers['user-agent'], \"origin_server\": $json.headers.origin, \"client_ip\": $json.headers['x-real-ip'] } }}",
"type": "object"
},
{
"id": "user-object",
"name": "user",
"value": "={{ { \"sender_phone\": $json.body.phone, \"connected_phone\": $json.body.connectedPhone, \"chat_name\": $json.body.chatName, \"sender_name\": $json.body.senderName, \"chat_lid\": $json.body.chatLid } }}",
"type": "object"
},
{
"id": "message-type-detector",
"name": "message_type",
"value": "={{ $json.body.text ? 'text' : $json.body.audio ? 'audio' : $json.body.image ? 'image' : $json.body.buttonsResponseMessage ? ($json.body.buttonsResponseMessage.buttonId === 'confirmar_pedido' ? 'text' : 'button_response') : $json.body.document ? ($json.body.document.mimeType && $json.body.document.mimeType.startsWith('audio/') ? 'audio_file' : $json.body.document.mimeType && $json.body.document.mimeType.startsWith('video/') ? 'video' : 'document') : 'unknown' }}",
"type": "string"
},
{
"id": "message-object",
"name": "message",
"value": "={{ { \"message_id\": $json.body.messageId, \"timestamp\": $json.body.momment, \"formatted_date\": DateTime.fromMillis($json.body.momment).toFormat('yyyy-MM-dd HH:mm:ss'), \"formatted_date_utc_minus_5\": DateTime.fromMillis($json.body.momment).setZone('UTC-5').toFormat('yyyy-MM-dd HH:mm:ss'), \"message_status\": $json.body.status, \"message_type\": ($json.body.text ? 'text' : $json.body.audio ? 'audio' : $json.body.image ? 'image' : $json.body.buttonsResponseMessage ? ($json.body.buttonsResponseMessage.buttonId === 'confirmar_pedido' ? 'text' : 'button_response') : $json.body.document ? ($json.body.document.mimeType && $json.body.document.mimeType.startsWith('audio/') ? 'audio_file' : $json.body.document.mimeType && $json.body.document.mimeType.startsWith('video/') ? 'video' : 'document') : 'unknown') } }}",
"type": "object"
},
{
"id": "content-text",
"name": "text_content",
"value": "={{ $json.body.text ? { \"message\": $json.body.text.message } : ($json.body.buttonsResponseMessage && $json.body.buttonsResponseMessage.buttonId === 'confirmar_pedido') ? { \"message\": $json.body.buttonsResponseMessage.buttonId } : null }}",
"type": "object"
},
{
"id": "content-audio",
"name": "audio_content",
"value": "={{ $json.body.audio ? { \"audio_url\": $json.body.audio.audioUrl, \"duration_seconds\": $json.body.audio.seconds, \"mime_type\": $json.body.audio.mimeType, \"is_ptt\": $json.body.audio.ptt, \"view_once\": $json.body.audio.viewOnce, \"source\": 'audio_object' } : null }}",
"type": "object"
},
{
"id": "content-audio-file",
"name": "audio_file_content",
"value": "={{ ($json.body.document && $json.body.document.mimeType && $json.body.document.mimeType.startsWith('audio/')) ? { \"audio_url\": $json.body.document.documentUrl, \"file_name\": $json.body.document.fileName, \"mime_type\": $json.body.document.mimeType, \"caption\": $json.body.document.caption, \"title\": $json.body.document.title, \"source\": 'document_object' } : null }}",
"type": "object"
},
{
"id": "content-image",
"name": "image_content",
"value": "={{ $json.body.image ? { \"image_url\": $json.body.image.imageUrl, \"thumbnail_url\": $json.body.image.thumbnailUrl, \"caption\": $json.body.image.caption, \"mime_type\": $json.body.image.mimeType, \"view_once\": $json.body.image.viewOnce, \"width\": $json.body.image.width, \"height\": $json.body.image.height } : null }}",
"type": "object"
},
{
"id": "content-video",
"name": "video_content",
"value": "={{ ($json.body.document && $json.body.document.mimeType && $json.body.document.mimeType.startsWith('video/')) ? { \"video_url\": $json.body.document.documentUrl, \"file_name\": $json.body.document.fileName, \"mime_type\": $json.body.document.mimeType, \"caption\": $json.body.document.caption, \"title\": $json.body.document.title, \"source\": 'document_object' } : null }}",
"type": "object"
},
{
"id": "content-document",
"name": "document_content",
"value": "={{ ($json.body.document && (!$json.body.document.mimeType || (!$json.body.document.mimeType.startsWith('audio/') && !$json.body.document.mimeType.startsWith('video/')))) ? { \"document_url\": $json.body.document.documentUrl, \"file_name\": $json.body.document.fileName, \"title\": $json.body.document.title, \"caption\": $json.body.document.caption, \"mime_type\": $json.body.document.mimeType, \"page_count\": $json.body.document.pageCount } : null }}",
"type": "object"
},
{
"id": "content-button",
"name": "button_content",
"value": "={{ $json.body.buttonsResponseMessage ? { \"button_id\": $json.body.buttonsResponseMessage.buttonId, \"button_text\": $json.body.buttonsResponseMessage.message, \"button_response\": $json.body.buttonsResponseMessage.buttonId, \"display_text\": $json.body.buttonsResponseMessage.message } : null }}",
"type": "object"
},
{
"id": "flags-object",
"name": "flags",
"value": "={{ { \"from_me\": $json.body.fromMe, \"is_group\": $json.body.isGroup, \"is_newsletter\": $json.body.isNewsletter, \"is_forwarded\": $json.body.forwarded, \"is_broadcast\": $json.body.broadcast, \"callback_type\": $json.body.type, \"from_api\": $json.body.fromApi, \"is_status_reply\": $json.body.isStatusReply, \"is_edit\": $json.body.isEdit, \"waiting_message\": $json.body.waitingMessage, \"message_expiration_seconds\": $json.body.messageExpirationSeconds || 0 } }}",
"type": "object"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-3808,
568
],
"id": "97428728-1387-4471-843e-d40e55342fb7",
"name": "WhatsApp Message Parser"
},
{
"parameters": {
"httpMethod": "POST",
"path": "50a91089-2c34-4dd0-8896-2715bd6e9612",
"options": {}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
-4032,
568
],
"id": "85279fb6-44eb-4c87-abb5-136d904bc9a1",
"name": "Webhook"
},
{
"parameters": {
"amount": 1
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
-3360,
512
],
"id": "71e6cd3a-354a-44b6-bd64-1571ca494420",
"name": "Pausa"
},
{
"parameters": {
"url": "={{ $json.audio_content.audio_url }}",
"options": {
"response": {
"response": {
"neverError": true,
"responseFormat": "file"
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-3360,
320
],
"id": "2c33c2f9-6e82-4439-b507-d7e39496a786",
"name": "Download Audio File"
},
{
"parameters": {
"url": "={{ $json.image_content.image_url }}",
"options": {
"response": {
"response": {
"neverError": true,
"responseFormat": "file"
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-3360,
704
],
"id": "a5b6fc55-745f-4c9d-9145-28625fb98d8a",
"name": "Download Image File"
},
{
"parameters": {
"resource": "image",
"operation": "analyze",
"modelId": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "GPT-4O-MINI"
},
"text": "# Instrucciones para Descripci\u00f3n de Imagen\nDescribe esta imagen en espa\u00f1ol.",
"inputType": "base64",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.8,
"position": [
-3136,
704
],
"id": "8ce13deb-86aa-4456-9bb9-82246ee5272a",
"name": "Analyze Image",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "button-response-id",
"name": "button_id",
"value": "={{ $json.button_content.button_id }}",
"type": "string"
},
{
"id": "button-response-text",
"name": "button_text",
"value": "={{ $json.button_content.button_text || $json.button_content.display_text }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-3360,
1672
],
"id": "73fabaf7-eecd-42bf-ba1e-51b7f974deea",
"name": "Process Button Response"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.button_id }}",
"rightValue": "catalogo",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "catalog-button-condition"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Catalogo"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.button_id }}",
"rightValue": "ofertas",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "offers-button-condition"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Ofertas"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.button_id }}",
"rightValue": "comprar",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "buy-button-condition"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Comprar"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.button_id }}",
"rightValue": "pedido",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "order-button-condition"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Pedido"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "ca097790-b652-48d1-8181-c16fcef7a6bd",
"leftValue": "={{ ['contra_entrega', 'interrapidisimo'].includes($json.button_id) }}",
"rightValue": "contra_entrega",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Contra_Entrega"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "0aab0b48-271c-4b6d-85d1-4ae926a7829a",
"leftValue": "={{ $json.button_id }}",
"rightValue": "transferencia",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Transferencia"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "e3943a52-8a51-413b-a5f2-89c394584dc5",
"leftValue": "={{ $json.button_id }}",
"rightValue": "modificar_producto",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "modificar_producto"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "bae55070-387b-41d8-9c87-9b671231afb3",
"leftValue": "={{ $json.button_id }}",
"rightValue": "modificar_pedido",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "modificar_pedido"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "c6c49f16-27fd-4763-bde2-d5b388e27b6f",
"leftValue": "={{ $json.button_id }}",
"rightValue": "confirmar_pedido",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "confirmar_pedido"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.2,
"position": [
-3136,
1560
],
"id": "37cd6414-4f3b-44ca-bd52-5b29894e1b11",
"name": "Button Response Router"
},
{
"parameters": {
"resource": "audio",
"operation": "transcribe",
"options": {
"language": "es",
"temperature": 0
}
},
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.8,
"position": [
-3136,
320
],
"id": "f85b465d-d4f1-43f1-8e1c-f4dc7f72fe61",
"name": "Transcribe a recording",
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "23b785c3-f38e-4706-80b7-51f333bba3bd",
"name": "mensaje",
"type": "string",
"value": "={{ $json.text || $json.content || $json.button_text || $json.button_id }}"
}
]
},
"options": {}
},
"id": "d07f2b8c-1c2f-4413-bad5-e73ab873355e",
"name": "Extract Message Content",
"type": "n8n-nodes-base.set",
"position": [
-2912,
512
],
"typeVersion": 3.4
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d4b9efeb-9a68-43e3-bc4c-cd207510bddf",
"name": "text",
"value": "={{ $json.text_content.message }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-3136,
512
],
"id": "ea82046b-0cd4-49de-a2f7-c63b6fc52033",
"name": "Obtener Texto"
},
{
"parameters": {
"operation": "push",
"list": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}",
"messageData": "={{ $json.mensaje }}",
"tail": true
},
"type": "n8n-nodes-base.redis",
"typeVersion": 1,
"position": [
-2688,
512
],
"id": "09f9a486-7671-4cdb-aac2-73b57d21e33c",
"name": "Store Message in Buffer",
"credentials": {
"redis": {
"name": "<your credential>"
}
}
},
{
"parameters": {},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
-2464,
512
],
"id": "b7de2491-d077-441b-be17-20e8afe58c45",
"name": "Wait for Buffer"
},
{
"parameters": {
"operation": "get",
"key": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}",
"options": {}
},
"type": "n8n-nodes-base.redis",
"typeVersion": 1,
"position": [
-2240,
512
],
"id": "27847417-324b-4cd7-932f-2bf97c2072d4",
"name": "Retrieve Messages from Buffer",
"credentials": {
"redis": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "87d5a006-5e35-4dbf-a3dc-e5420b918845",
"leftValue": "={{ $json.propertyName.last() }}",
"rightValue": "={{ $('Extract Message Content').item.json.mensaje }}",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
-2016,
512
],
"id": "a5e06155-a2f3-49b4-bf12-2afc4c23993e",
"name": "Check for Duplicate Message"
},
{
"parameters": {
"operation": "delete",
"key": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
},
"type": "n8n-nodes-base.redis",
"typeVersion": 1,
"position": [
-1792,
328
],
"id": "3eb73ad4-282a-4e09-b607-ce098b798512",
"name": "Clear Buffer Cache",
"credentials": {
"redis": {
"name": "<your credential>"
}
}
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
-1792,
520
],
"id": "7161aaac-7c78-4fe1-acd3-214f7033d134",
"name": "Skip Duplicate Message"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "f6459d32-0468-4e3c-8572-7b36e1fc2172",
"name": "conversation_content",
"value": "={{ $json.propertyName.join('\\n') }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-1568,
328
],
"id": "d5d5d181-6670-4d5d-a9b9-95967daaf732",
"name": "Format Final Output"
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT \n '{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}' as session_id,\n CASE \n WHEN NOT EXISTS (\n SELECT 1 \n FROM n8n_pro_conversation_states \n WHERE session_id = '{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}'\n ) THEN false -- No hay registros, no existe\n WHEN EXISTS (\n SELECT 1 \n FROM n8n_pro_conversation_states \n WHERE session_id = '{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}'\n AND ultima_actividad = (\n SELECT MAX(ultima_actividad) \n FROM n8n_pro_conversation_states \n WHERE session_id = '{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}'\n )\n AND estado_actual = 'ventas' \n AND estado_ventas = 'FIN'\n ) THEN false -- El m\u00e1s reciente est\u00e1 finalizado, no existe (crear nuevo)\n ELSE true -- En cualquier otro caso, existe\n END as existe",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
-1344,
328
],
"id": "48c96b6b-2886-4e8a-8d13-93a6db341cb2",
"name": "Get session_id",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "7500bd18-477a-4fbe-b21d-ea6bbcc0a5d5",
"leftValue": "={{ $json.existe }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
-1120,
328
],
"id": "521c0fcd-6e0b-4d6a-ac20-31eb8bff8d7f",
"name": "If"
},
{
"parameters": {
"jsCode": "// Obtener hora UTC y ajustarla a UTC-5\nconst ahora = new Date();\nconst horaUTC = ahora.getUTCHours();\nconst horaUTC5 = (horaUTC + 24 - 5) % 24;\n\n// Determinar per\u00edodo del d\u00eda\nlet periodo = '';\n\nif (horaUTC5 >= 5 && horaUTC5 < 12) {\n periodo = 'ma\u00f1ana';\n} else if (horaUTC5 >= 12 && horaUTC5 < 18) {\n periodo = 'tarde';\n} else {\n periodo = 'noche';\n}\n\n// Retornar per\u00edodo junto con datos necesarios\nreturn [\n {\n json: {\n periodo: periodo,\n hora: horaUTC5,\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-2912,
960
],
"id": "c632ef10-86cc-4da7-9b0f-90b5775432ca",
"name": "Dynamic Time Greeting"
},
{
"parameters": {
"jsCode": "const saludos = [\n`\ud83c\udf38 \u00a1Hola! Gracias por escribir a *Ed Perfumer\u00eda* \nEstamos encantados de ayudarte a encontrar la fragancia ideal.`,\n\n`\ud83d\udcac \u00a1Bienvenido a *Ed Perfumer\u00eda*! \nGracias por elegirnos para tu pr\u00f3xima compra de perfumes.`,\n\n`\ud83c\udf89 \u00a1Hola! Qu\u00e9 gusto tenerte en *Ed Perfumer\u00eda* \nEstamos aqu\u00ed para ayudarte a encontrar tu aroma perfecto.`,\n\n`\ud83c\udf1f \u00a1Gracias por comunicarte con *Ed Perfumer\u00eda*! \nNos alegra poder atenderte \ud83d\ude0a`,\n\n`\ud83d\ude80 \u00a1Hola y bienvenido a *Ed Perfumer\u00eda*! \nEs un placer atenderte hoy \u2728`,\n\n`\ud83d\ude4c \u00a1Hola! Gracias por escribir a *Ed Perfumer\u00eda* \nEstamos encantados de atenderte. \ud83d\udc90`,\n\n`\ud83d\udc4b \u00a1Bienvenid@ a *Ed Perfumer\u00eda*! \nNos alegra recibir tu mensaje. \ud83d\udc96`,\n\n`\u2728 \u00a1Hola! Gracias por contactar a *Ed Perfumer\u00eda* \nNos alegra mucho tenerte por aqu\u00ed \ud83d\ude0a`,\n\n`\ud83c\udf1f \u00a1Gracias por comunicarte con *Ed Perfumer\u00eda*! \nEstamos aqu\u00ed para ayudarte a encontrar tu fragancia ideal. \ud83e\uddf4\u2728`,\n\n`\ud83c\udf89 \u00a1Bienvenido a *Ed Perfumer\u00eda*! \nGracias por escribirnos. Estamos listos para asesorarte.`\n];\n\n// Selecciona uno al azar\nconst saludoAleatorio = saludos[Math.floor(Math.random() * saludos.length)];\nreturn [\n {\n json: {\n output: saludoAleatorio\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-896,
16
],
"id": "f358cc82-9b58-4644-b652-1490f0e179bc",
"name": "Dynamic Greeting"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.periodo }}",
"rightValue": "ma\u00f1ana",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "eb8f4c83-efd2-4595-b674-25dc1c0ad1b8"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "ma\u00f1ana"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "dcc3cd98-a426-4020-8af1-a851981f2055",
"leftValue": "={{ $json.periodo }}",
"rightValue": "tarde",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "tarde"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "b515e6bc-c3a2-4471-b9ee-ff723e6ff6cc",
"leftValue": "={{ $json.periodo }}",
"rightValue": "noche",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "noche"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.2,
"position": [
-2688,
944
],
"id": "b7635ca3-aed1-46bf-ba90-49b7cf334461",
"name": "Switch1"
},
{
"parameters": {
"method": "POST",
"url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-text",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "client-token",
"value": "F71f72d577fd94b2995487e18acdaa9ceS"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "phone",
"value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
},
{
"name": "message",
"value": "={{ $json.output }}"
},
{
"name": "delayTyping",
"value": "={{ parseInt( $json.output.length() * 25) }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-672,
16
],
"id": "921c6f10-25cc-483a-8739-3454edb0cb9e",
"name": "Send Dynamic Greeting"
},
{
"parameters": {
"method": "POST",
"url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-button-list",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "client-token",
"value": "F71f72d577fd94b2995487e18acdaa9ceS"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"phone\": \"{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}\",\n \"message\": \"{{ (() => { const h = new Date(new Date().getTime() - 18000000).getHours(); return h >= 5 && h < 12 ? '\u00a1Buenos d\u00edas!' : h >= 12 && h < 18 ? '\u00a1Buenas tardes!' : '\u00a1Buenas noches!'; })() }} \ud83c\udf38\\n\\n\u00bfQu\u00e9 te gustar\u00eda hacer?\",\n \"delayTyping\": 1500,\n \"buttonList\": {\n \"buttons\": [\n {\n \"id\": \"comprar\",\n \"label\": \"\ud83d\uded2 Comprar\"\n },\n {\n \"id\": \"catalogo\",\n \"label\": \"\ud83d\udccb Cat\u00e1logo\"\n },\n {\n \"id\": \"ofertas\",\n \"label\": \"\ud83d\udd25 Ofertas\"\n },\n {\n \"id\": \"pedido\",\n \"label\": \"\ud83d\udce6 Consultar Pedido\"\n }\n ]\n }\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-448,
16
],
"id": "6504ee10-7d85-4f13-be1c-876d473693b2",
"name": "Send Buttons"
},
{
"parameters": {
"numberInputs": 3
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
-2240,
976
],
"id": "f8d915bd-26be-4e51-b663-3ed6ccb630ba",
"name": "Merge Audio"
},
{
"parameters": {
"method": "POST",
"url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-audio",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "client-token",
"value": "F71f72d577fd94b2995487e18acdaa9ceS"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "phone",
"value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
},
{
"name": "audio",
"value": "=data:{{ $('Merge Audio').item.binary.data.mimeType }};base64,{{ $('Merge Audio').item.binary.data.data }}"
},
{
"name": "delayTyping",
"value": "6"
},
{
"name": "waveform",
"value": "true"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-2016,
992
],
"id": "8f824568-bbdc-40cb-b280-4f77ba774cd0",
"name": "Send Audio"
},
{
"parameters": {
"method": "POST",
"url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-document/pdf",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "client-token",
"value": "F71f72d577fd94b2995487e18acdaa9ceS"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "phone",
"value": "={{ $('WhatsApp Message Parser').first().json.user.sender_phone }}"
},
{
"name": "document",
"value": "https://drive.google.com/uc?export=download&id=1z1N-NqCHW2PrC1_HJS01MP6geTL6Jf_S"
},
{
"name": "fileName",
"value": "Cat\u00e1logo Ed Perfumer\u00eda Hombre"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-1792,
992
],
"id": "18a6db3f-da38-4996-9d5c-d951231f9e7b",
"name": "Send Catalog Man"
},
{
"parameters": {
"method": "POST",
"url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-document/pdf",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "client-token",
"value": "F71f72d577fd94b2995487e18acdaa9ceS"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "phone",
"value": "={{ $('WhatsApp Message Parser').first().json.user.sender_phone }}"
},
{
"name": "document",
"value": "https://drive.google.com/uc?export=download&id=1sf7vcqR6USGi-b496e7kCshxMNwI-4c4"
},
{
"name": "fileName",
"value": "Cat\u00e1logo Ed Perfumer\u00eda Mujer"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-1568,
992
],
"id": "e4e15277-293c-4b58-a92b-e61a3198c0bb",
"name": "Send Catalog Women"
},
{
"parameters": {
"operation": "download",
"fileId": {
"__rl": true,
"value": "1UND_G3K4tu_xmjsTOSyq3ypRVpzg95HH",
"mode": "list",
"cachedResultName": "Buenos Dias.ogg",
"cachedResultUrl": "https://drive.google.com/file/d/1UND_G3K4tu_xmjsTOSyq3ypRVpzg95HH/view?usp=drivesdk"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-2464,
712
],
"id": "a23ec4e3-8d46-447b-9908-fb3256da08b2",
"name": "Download Good Morning",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "download",
"fileId": {
"__rl": true,
"value": "1oFABnmJkXuevND9TxwJP_zcM2VLsDPtb",
"mode": "list",
"cachedResultName": "Buenas Tardes.ogg",
"cachedResultUrl": "https://drive.google.com/file/d/1oFABnmJkXuevND9TxwJP_zcM2VLsDPtb/view?usp=drivesdk"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-2464,
904
],
"id": "0e96d7ce-3ef6-4b64-8b44-48a1074254e9",
"name": "Download Good Afternoon",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "download",
"fileId": {
"__rl": true,
"value": "16PkBRIK-Iv-VKInmhW1nq5Qfjc0EKWn2",
"mode": "list",
"cachedResultName": "Buenas Noches.ogg",
"cachedResultUrl": "https://drive.google.com/file/d/16PkBRIK-Iv-VKInmhW1nq5Qfjc0EKWn2/view?usp=drivesdk"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
-2464,
1096
],
"id": "016bf72d-7e98-4f37-aac3-4c978d9381ee",
"name": "Download Good Night",
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "const ofertas = [\n`\ud83c\udf80 *Promociones especiales de Ed Perfumer\u00eda*\n\n\ud83d\udc8e **Ofertas disponibles:**\n1 unidad \u2192 $60.000\n2 unidades \u2192 $100.000 \n3 unidades \u2192 $120.000\n6 unidades \u2192 $210.000\n\n\ud83d\udd25 \u00a1Fragancias incre\u00edbles a precios \u00fanicos!`,\n\n`\ud83c\udf81 *Ofertas Ed Perfumer\u00eda*\n\n\u2728 **Precios especiales:**\n1 por $60.000\n2 por $100.000\n3 por $120.000\n6 por $210.000\n\n\ud83d\udcab \u00a1Aprovecha nuestros mejores precios!`,\n\n`\ud83d\udc8e *Promoci\u00f3n de la semana*\n\n\ud83d\udd25 **Ofertas vigentes:**\n1 unidad: $60.000\n2 unidades: $100.000\n3 unidades: $120.000\n6 unidades: $210.000\n\n\ud83c\udf89 \u00a1No dejes pasar estas ofertas!`,\n\n`\ud83c\udf1f *Ofertas especiales*\n\n\ud83d\udca5 **Promociones disponibles:**\n1 x $60.000 | 2 x $100.000 | 3 x $120.000 | 6 x $210.000\n\n\u2728 \u00a1Solo por tiempo limitado!`,\n\n`\ud83c\udf8a *Ed Perfumer\u00eda - Ofertas*\n\n\ud83c\udf81 **Precios incre\u00edbles:**\n1 fragancia \u2192 $60.000\n2 fragancias \u2192 $100.000\n3 fragancias \u2192 $120.000\n6 fragancias \u2192 $210.000\n\n\ud83d\udd25 \u00a1Te van a encantar!`,\n\n`\ud83d\udc96 *Promociones actuales*\n\n\ud83c\udf38 **Ofertas de hoy:**\n1 unidad por $60.000\n2 unidades por $100.000\n3 unidades por $120.000\n6 unidades por $210.000\n\n\ud83d\udc8e \u00a1Aprovecha esta oportunidad!`,\n\n`\ud83d\ude80 *Ofertas Ed Perfumer\u00eda*\n\n\u2b50 **Precios especiales:**\n1 \u2192 $60.000\n2 \u2192 $100.000\n3 \u2192 $120.000\n6 \u2192 $210.000\n\n\ud83c\udf89 \u00a1Promociones por tiempo limitado!`,\n\n`\ud83c\udf08 *Promoci\u00f3n especial*\n\n\ud83d\udcab **Ofertas vigentes:**\n1 unidad: $60.000\n2 unidades: $100.000\n3 unidades: $120.000\n6 unidades: $210.000\n\n\ud83d\udd25 \u00a1No te las pierdas!`,\n\n`\ud83c\udf80 *Ofertas de la semana*\n\n\u2728 **Precios \u00fanicos:**\n1 x $60.000 \u2022 2 x $100.000 \u2022 3 x $120.000 \u2022 6 x $210.000\n\n\ud83c\udf81 \u00a1Fragancias incre\u00edbles a precios especiales!`,\n\n`\ud83d\udc9d *Ed Perfumer\u00eda - Promociones*\n\n\ud83c\udf1f **Ofertas disponibles:**\n1 unidad = $60.000\n2 unidades = $100.000\n3 unidades = $120.000\n6 unidades = $210.000\n\n\ud83d\udc8e \u00a1Aprovecha nuestras mejores ofertas!`\n];\n\n// Selecciona uno al azar\nconst ofertaAleatoria = ofertas[Math.floor(Math.random() * ofertas.length)];\nreturn [\n {\n json: {\n output: ofertaAleatoria\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-2912,
1288
],
"id": "aa04ceb2-4a01-47e6-910a-93c99c49aef2",
"name": "Dynamic Offers"
},
{
"parameters": {
"method": "POST",
"url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-text",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "client-token",
"value": "F71f72d577fd94b2995487e18acdaa9ceS"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "phone",
"value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
},
{
"name": "message",
"value": "={{ $json.output }}"
},
{
"name": "delayTyping",
"value": "={{ parseInt( $json.output.length() * 25) }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-2688,
1288
],
"id": "3290edea-f50e-4fc7-97a3-0e99d24a2567",
"name": "Send Dynamic Offers"
},
{
"parameters": {
"jsCode": "const comprar = [\n`\ud83d\uded2 *\u00a1Perfecto! Veamos qu\u00e9 te interesa*\n\n\u00bfEn qu\u00e9 fragancia est\u00e1s pensando?\n- \u00bfTienes alguna en mente?\n- \u00bfBuscas algo espec\u00edfico?\n\n\ud83d\udc8e \u00a1Cu\u00e9ntanos para ayudarte mejor!`,\n\n`\ud83d\udecd\ufe0f *\u00a1Excelente!*\n\n\u00bfQu\u00e9 tipo de fragancia te llama la atenci\u00f3n?\n- \u00bfAlgo dulce o fresco?\n- \u00bfPara hombre o mujer?\n\n\u2728 \u00a1Dinos qu\u00e9 buscas!`,\n\n`\ud83c\udf81 *\u00a1Genial! Hablemos de fragancias*\n\n\u00bfQu\u00e9 producto te interesa?\n- \u00bfTienes marca favorita?\n- \u00bfBuscas algo nuevo?\n\n\ud83d\ude80 \u00a1Comp\u00e1rtenos tu preferencia!`,\n\n`\ud83d\udcb3 *\u00a1Listo para ayudarte!*\n\n\u00bfEn qu\u00e9 fragancia est\u00e1s interesado/a?\n- \u00bfAlgo en particular?\n- \u00bfNecesitas recomendaciones?\n\n\ud83c\udf1f \u00a1Cu\u00e9ntanos qu\u00e9 buscas!`,\n\n`\ud83d\uded2 *\u00a1Vamos a encontrar tu fragancia ideal!*\n\n\u00bfQu\u00e9 tipo de aroma prefieres?\n- \u00bfDulce, fresco, amaderado?\n- \u00bfPara ocasi\u00f3n especial?\n\n\ud83d\udc8e \u00a1Dinos qu\u00e9 te gusta!`,\n\n`\ud83c\udf89 *\u00a1Perfecto! Descubramos tu fragancia*\n\n\u00bfQu\u00e9 producto tienes en mente?\n- \u00bfAlguna marca espec\u00edfica?\n- \u00bfBuscas algo trending?\n\n\u2728 \u00a1Comparte tu inter\u00e9s!`,\n\n`\ud83d\udecd\ufe0f *\u00a1Excelente elecci\u00f3n!*\n\n\u00bfEn qu\u00e9 fragancia est\u00e1s pensando?\n- \u00bfAlgo cl\u00e1sico o moderno?\n- \u00bfTienes preferencias?\n\n\ud83d\udd25 \u00a1Cu\u00e9ntanos qu\u00e9 buscas!`,\n\n`\ud83d\udc9d *\u00a1Hablemos de tu fragancia perfecta!*\n\n\u00bfQu\u00e9 tipo de aroma te interesa?\n- \u00bfPara uso diario o especial?\n- \u00bfTienes alguna en mente?\n\n\ud83c\udf08 \u00a1Dinos qu\u00e9 prefieres!`,\n\n`\ud83c\udf8a *\u00a1Genial! Encontremos tu aroma*\n\n\u00bfQu\u00e9 fragancia te llama la atenci\u00f3n?\n- \u00bfBuscas algo espec\u00edfico?\n- \u00bfNecesitas sugerencias?\n\n\ud83d\udcab \u00a1Comparte tu gusto!`,\n\n`\ud83d\ude80 *\u00a1Perfecto! Hablemos de fragancias*\n\n\u00bfEn qu\u00e9 producto est\u00e1s interesado/a?\n- \u00bfTienes marca favorita?\n- \u00bfAlgo dulce o fresco?\n\n\ud83c\udf81 \u00a1Cu\u00e9ntanos tu preferencia!`\n];\n\n// Selecciona uno al azar\nconst comprarAleatorio = comprar[Math.floor(Math.random() * comprar.length)];\nreturn [\n {\n json: {\n output: comprarAleatorio\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-2912,
1480
],
"id": "27c02b64-1150-4c9f-a757-aa5f7452f21f",
"name": "Dynamic Buy"
},
{
"parameters": {
"method": "POST",
"url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-text",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "client-token",
"value": "F71f72d577fd94b2995487e18acdaa9ceS"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "phone",
"value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
},
{
"name": "message",
"value": "={{ $json.output }}"
},
{
"name": "delayTyping",
"value": "={{ parseInt( $json.output.length() * 25) }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-2688,
1480
],
"id": "3e1d49a5-f209-4904-a207-1bcd000bc461",
"name": "Send Dynamic Buy"
},
{
"parameters": {
"jsCode": "const consultarPedido = [\n`\ud83d\udce6 *\u00a1Perfecto! Consultemos tu pedido*\n\n\u00bfQu\u00e9 necesitas saber sobre tu compra?\n- \u00bfEstado del env\u00edo?\n- \u00bfN\u00famero de gu\u00eda?\n- \u00bfTiempo de entrega?\n\n\ud83d\ude9a \u00a1Estamos aqu\u00ed para ayudarte!`,\n\n`\ud83d\udd0d *\u00a1Excelente! Revisemos tu orden*\n\n\u00bfSobre qu\u00e9 quieres consultar?\n- \u00bfD\u00f3nde est\u00e1 mi pedido?\n- \u00bfCu\u00e1ndo llega?\n- \u00bfDatos de env\u00edo?\n\n\ud83d\udccb \u00a1Dinos qu\u00e9 necesitas saber!`,\n\n`\ud83d\udcf1 *\u00a1Genial! Veamos tu pedido*\n\n\u00bfQu\u00e9 informaci\u00f3n necesitas?\n- \u00bfEstado actual del env\u00edo?\n- \u00bfN\u00famero de seguimiento?\n- \u00bfFecha estimada de entrega?\n\n\u2728 \u00a1Consultemos juntos!`,\n\n`\ud83d\ude9b *\u00a1Listo para ayudarte!*\n\n\u00bfQu\u00e9 quieres saber de tu compra?\n- \u00bfEst\u00e1 en camino?\n- \u00bfTienes la gu\u00eda?\n- \u00bfAlg\u00fan problema?\n\n\ud83c\udf1f \u00a1Revisemos tu pedido!`,\n\n`\ud83d\udce6 *\u00a1Vamos a consultar tu env\u00edo!*\n\n\u00bfSobre qu\u00e9 necesitas informaci\u00f3n?\n- \u00bfEstado del pedido?\n- \u00bfSeguimiento de env\u00edo?\n- \u00bfTiempo de llegada?\n\n\ud83d\udc8e \u00a1Estamos para resolver tus dudas!`,\n\n`\ud83d\udd0e *\u00a1Perfecto! Consultemos tu orden*\n\n\u00bfQu\u00e9 informaci\u00f3n buscas?\n- \u00bfD\u00f3nde est\u00e1 mi compra?\n- \u00bfN\u00famero de gu\u00eda?\n- \u00bfCu\u00e1ndo llega?\n\n\ud83c\udf89 \u00a1Revisemos juntos!`,\n\n`\ud83d\udccb *\u00a1Excelente! Veamos tu pedido*\n\n\u00bfQu\u00e9 necesitas consultar?\n- \u00bfEstado de env\u00edo?\n- \u00bfDatos de seguimiento?\n- \u00bfInformaci\u00f3n de entrega?\n\n\ud83d\udd25 \u00a1Dinos qu\u00e9 quieres saber!`,\n\n`\ud83d\ude9a *\u00a1Consultemos tu compra!*\n\n\u00bfSobre qu\u00e9 tienes dudas?\n- \u00bfMi pedido ya sali\u00f3?\n- \u00bfCu\u00e1l es mi gu\u00eda?\n- \u00bfCu\u00e1ndo llega?\n\n\ud83c\udf08 \u00a1Estamos para ayudarte!`,\n\n`\ud83d\udcf1 *\u00a1Genial! Revisemos tu env\u00edo*\n\n\u00bfQu\u00e9 informaci\u00f3n necesitas?\n- \u00bfEstado actual?\n- \u00bfN\u00famero de seguimiento?\n- \u00bfFecha de entrega?\n\n\ud83d\udcab \u00a1Consultemos tu pedido!`,\n\n`\ud83d\udd0d *\u00a1Perfecto! Veamos tu orden*\n\n\u00bfQu\u00e9 quieres saber?\n- \u00bfD\u00f3nde est\u00e1 mi pedido?\n- \u00bfGu\u00eda de env\u00edo?\n- \u00bfTiempo estimado?\n\n\ud83c\udf81 \u00a1Resolvamos tus dudas!`\n];\n\n// Selecciona uno al azar\nconst consultarPedidoAleatorio = consultarPedido[Math.floor(Math.random() * consultarPedido.length)];\nreturn [\n {\n json: {\n output: consultarPedidoAleatorio\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-2912,
1672
],
"id": "fa72af87-8adb-42ee-a5fd-61f29459d5ba",
"name": "Dynamic Order"
},
{
"parameters": {
"method": "POST",
"url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-text",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "client-token",
"value": "F71f72d577fd94b2995487e18acdaa9ceS"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "phone",
"value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
},
{
"name": "message",
"value": "={{ $json.output }}"
},
{
"name": "delayTyping",
"value": "={{ parseInt( $json.output.length() * 25) }}"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-2688,
1672
],
"id": "755816dc-47ae-4f6a-98c1-9a76bc346634",
"name": "Send Dynamic Order"
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT actualizar_estado_principal_pro('{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}', 'SALUDO');",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
-224,
16
],
"id": "7e747686-1afe-45cf-86b5-cdb9e655a198",
"name": "Execute Status Greeting",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT actualizar_estado_principal_pro('{{ $('WhatsApp Message Parser').first().json.user.sender_phone }}', 'CATALOGO');",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
-1344,
992
],
"id": "cbd1e3e4-a81e-4f75-82b1-6a1755ade6a3",
"name": "Execute Status Catalog",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT actualizar_estado_principal_pro('{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}', 'OFERTAS');",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
-2464,
1288
],
"id": "85b9ade9-afb7-49b2-9662-6a0bd1542af2",
"name": "Execute Status Offers",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT actualizar_estado_principal_pro('{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}', 'VENTAS');",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
-2464,
1480
],
"id": "a1b179a3-1b19-416d-89e2-0ee5773e56cf",
"name": "Execute Status Buy",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT actualizar_estado_principal_pro('{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}', 'SOPORTE');",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
-2464,
1672
],
"id": "f6c9b4b2-9a40-4fb2-b7cf-7ebd4b43e600",
"name": "Execute Status Order",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.estado }}",
"rightValue": "VENTAS",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "ventas-condition"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "sales"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.estado }}",
"rightValue": "SOPORTE",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "soporte-condition"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "order"
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.2,
"position": [
-672,
504
],
"id": "13d14846-7d2e-4d8e-a16c-edee3414ba3f",
"name": "Status Response IA"
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
-448,
640
],
"id": "a87f7ddf-58f0-4ea8-b26a-e343faba00d8",
"name": "No Operation, do nothing"
}
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.
googleDriveOAuth2ApiopenAiApipostgresredis
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
How this works
This workflow automates intelligent handling of incoming WhatsApp messages via a webhook trigger, enabling businesses to respond seamlessly to customer interactions without manual intervention. It parses messages, downloads and analyses media like audio or images using OpenAI for insights, and routes responses based on content type, ideal for support teams or e-commerce owners managing high-volume chats. The key step involves the OpenAI integration to classify and process elements such as images or button clicks, ensuring context-aware replies stored in Postgres and Redis for efficiency.
Use this workflow when scaling WhatsApp support with AI-driven analysis, particularly for media-rich conversations requiring quick, accurate processing. Avoid it for simple text-only bots lacking media needs, or if your setup doesn't involve Postgres for data persistence. Common variations include adding Google Drive for file backups or custom text classifiers to refine sentiment detection in responses.
About this workflow
z-Api. Uses httpRequest, openAi, redis, postgres. Webhook trigger; 61 nodes.
Source: https://github.com/SeredDEV/n8n/blob/5e5b212ca45d761d5b31d9eafc460d03e74a2087/workflows/z-Api.json — 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
This template automates the extraction of structured data from Thai government letters received via LINE or uploaded to Google Drive. It uses Mistral AI for OCR and OpenAI for information extraction,
I'll be honest, I built this because I was getting lazy in meetings and missing key details. I started with a simple VEXA integration for transcripts, then added AI to pull out summaries and tasks. Bu
This workflow is ideal for HR professionals, recruiters, and small businesses looking to streamline resume screening with AI-powered analysis and CRM integration.
I made this little workflow with care for people like you who are part of busy WhatsApp groups and want a simple way to keep track of everything.