Crear un chatbot de WhatsApp con GPT-4o, transcripción de Whisper y búfer de Redis

Avanzado

Este es unautomatización que contiene 35 nodos.Utiliza principalmente nodos como Set, Code, Wait, Merge, Redis. Usar GPT-4o, transcripción Whisper y búfer Redis para crear un chatbot de WhatsApp

Requisitos previos
  • Información de conexión del servidor Redis
  • Pueden requerirse credenciales de autenticación para la API de destino
  • Clave de API de OpenAI

Categoría

-
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "meta": {
    "instanceId": "7de9c03c5df732f2294cfa53379db42b70689739afb5ed84c40dd844fed72f02"
  },
  "nodes": [
    {
      "id": "ffb21e8f-9568-4e5f-a7dc-9ede3cb3529d",
      "name": "Agente de IA",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        4080,
        416
      ],
      "parameters": {
        "text": "={{ $json.chat_input }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "5598448f-1646-4299-923a-2dcf6707b4f2",
      "name": "Memoria Simple",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        4240,
        656
      ],
      "parameters": {
        "sessionKey": "={{ $('Set fields1').item.json.message.chat_id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "9929d34c-2954-4272-861a-57b441c7eec0",
      "name": "Esperar3",
      "type": "n8n-nodes-base.wait",
      "position": [
        1456,
        544
      ],
      "webhookId": "96c27c05-96e6-490e-ac24-3c38c75c7d9b",
      "parameters": {
        "amount": 7
      },
      "typeVersion": 1.1
    },
    {
      "id": "9975c463-56c0-463c-8311-2d56b20e0684",
      "name": "Sin operación, no hacer nada3",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1456,
        112
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c21ec32e-ad73-4fac-8442-30d8906e1a5e",
      "name": "Switch Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        2288,
        304
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a1ae30d8-caca-41ff-857b-ed9f55b09ca1",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.content_type }}",
                    "rightValue": "text"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Audio",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "11e0f3f8-1dd2-4efd-aad1-cf42c96bbc5d",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.content_type }}",
                    "rightValue": "audio"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Image",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "c338dd6b-e18d-4528-95e7-990cd94d5da7",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.content_type }}",
                    "rightValue": "image"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "5371ce24-b650-47de-a77c-5b8438cbcca4",
      "name": "Transcribir una grabación",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2960,
        384
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "id": "Kviz2ptGHoqK8BIL",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "a8a2f5e1-d9d1-46ab-8b1b-af95fcb1a3d8",
      "name": "Contenido de Audio",
      "type": "n8n-nodes-base.set",
      "position": [
        3152,
        384
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5f4831a4-5837-492f-b7a9-84b8e9f1f3a9",
              "name": "content",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "85531cdf-5fc0-41f6-bed9-da0dfaa517ba",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $('Code in JavaScript').item.json.timestamp }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "45c98f8a-81ac-4e99-a85b-3401b04e5c40",
      "name": "Analizar imagen",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2912,
        656
      ],
      "parameters": {
        "text": "What's in the image?",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "GPT-4O"
        },
        "options": {},
        "resource": "image",
        "imageUrls": "={{ $json.publicUrl }}",
        "operation": "analyze"
      },
      "credentials": {
        "openAiApi": {
          "id": "Kviz2ptGHoqK8BIL",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "0347c99c-b10b-49cb-acc4-6bb1522fe85c",
      "name": "Contenido de Imagen",
      "type": "n8n-nodes-base.set",
      "position": [
        3136,
        656
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ac66cc5d-a460-43d6-8932-7a5fb3c63daf",
              "name": "=Image",
              "type": "string",
              "value": "=Caption written by User: {{ $('Code in JavaScript').item.json.content }}\n\nImage analysis: {{ $json.content }}\n\n"
            },
            {
              "id": "3a54bf57-8d27-4857-bef9-614e505ec802",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $('Code in JavaScript').item.json.timestamp }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e147bb2c-4b47-43d4-891f-3307afb7046c",
      "name": "Contenido de Texto",
      "type": "n8n-nodes-base.set",
      "position": [
        2864,
        128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5f4cdc1a-fc80-4aed-9493-38caeb7103f9",
              "name": "content",
              "type": "string",
              "value": "={{ $('Code in JavaScript').item.json.content }}"
            },
            {
              "id": "203a7e05-03f0-413a-90ac-aade62096999",
              "name": "timestamp",
              "type": "string",
              "value": "={{ $('Code in JavaScript').item.json.timestamp }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a78497d6-29ec-4019-a8c8-fb3eebc76e53",
      "name": "Entrada de Chat",
      "type": "n8n-nodes-base.set",
      "position": [
        3872,
        416
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "866095be-3f42-4f6a-a7f1-67adec82bf58",
              "name": "chat_input",
              "type": "string",
              "value": "={{ $json.Content.map(msg => msg.content || msg.Image).join('\\n') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "078ca1b6-4baf-42f3-bef5-6fca9f8dad7a",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        1232,
        288
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Ignore",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "81c7205c-84c9-480e-8b5a-1a12b5ff7baa",
                    "operator": {
                      "type": "string",
                      "operation": "notEquals"
                    },
                    "leftValue": "={{ JSON.parse($json.Mensaje.last()).message_id }}",
                    "rightValue": "={{ $('Set fields1').item.json.message.message_id }}"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Continue",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4fca4c39-e8bf-490b-8e2e-176c95d9156e",
                    "operator": {
                      "type": "dateTime",
                      "operation": "before"
                    },
                    "leftValue": "={{ DateTime.fromISO(JSON.parse($json.Mensaje.last()).timestamp).toUTC().toISO() }}",
                    "rightValue": "={{ $now.minus(7, 'seconds').toUTC().toISO() }}"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "Wait"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "bf1f8bcc-2cf6-4fb9-9a07-29196c621701",
      "name": "Código en JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        2080,
        320
      ],
      "parameters": {
        "jsCode": "// Code node in n8n\n// Loops through all input items and parses the \"Mensaje\" field\nreturn items.map(item => {\n  let parsed = {};\n  try {\n    parsed = JSON.parse(item.json.Mensaje);\n  } catch (error) {\n    // If parsing fails, log it and continue\n    parsed = { error: 'Invalid JSON', raw: item.json.Mensaje };\n  }\n  \n  return {\n    json: parsed\n  };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "2de4aea2-00fa-4f32-9172-420b59c96e93",
      "name": "Enviar mensaje al usuario",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4768,
        416
      ],
      "parameters": {
        "url": "https://www.wasenderapi.com/api/send-message",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "to",
              "value": "={{ $('Set fields1').item.json.message.chat_id }}"
            },
            {
              "name": "text",
              "value": "={{ $json.output }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR API KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "33193b50-0af9-4883-abd5-55a087dcca6a",
      "name": "Obtener el audio",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2608,
        384
      ],
      "parameters": {
        "url": "https://www.wasenderapi.com/api/decrypt-media",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"data\": {\n    \"messages\": {\n      \"key\": {\n        \"id\": \"{{ $json.message_id }}\"\n      },\n      \"message\": {\n        \"audioMessage\": {\n          \"url\": \"{{ $json.url }}\",\n          \"mimetype\": \"{{ $json.mimetype }}\",\n          \"mediaKey\": \"{{ $json.mediaKey }}\",\n          \"fileSha256\": \"{{ $json.fileSha256 }}\",\n          \"fileLength\": \"{{ $json.fileLength }}\",\n          \"fileName\": \"audio/mpeg\"\n        }\n      }\n    }\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR API KEY "
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4c87722c-fac4-48ff-9d51-3747211dfa0a",
      "name": "Descargar el audio",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2784,
        384
      ],
      "parameters": {
        "url": "={{ $json.publicUrl }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "04c92b95-1756-4b11-8829-224ebcc5686b",
      "name": "Dividir",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1872,
        320
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "Mensaje"
      },
      "typeVersion": 1
    },
    {
      "id": "0c0914f9-c5c4-49a7-a1d4-7b59ea71fe54",
      "name": "Obtener la foto",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2704,
        656
      ],
      "parameters": {
        "url": "https://www.wasenderapi.com/api/decrypt-media",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"data\": {\n    \"messages\": {\n      \"key\": {\n        \"id\": \"{{ $json.message_id }}\"\n      },\n      \"message\": {\n        \"imageMessage\": {\n          \"url\": \"{{ $json.url }}\",\n          \"mimetype\": \"{{ $json.mimetype }}\",\n          \"mediaKey\": \"{{ $json.mediaKey }}\",\n          \"fileSha256\": \"{{ $json.fileSha256 }}\",\n          \"fileLength\": \"{{ $json.fileLength }}\",\n          \"fileName\": \"image.jpg\"\n\n        }\n      }\n    }\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR API KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "22c600ee-a27d-4619-8f83-a4f70a221b3a",
      "name": "Modelo de Chat OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        4048,
        624
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "Kviz2ptGHoqK8BIL",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "217076f7-8505-48a0-80f3-f3160c09f99a",
      "name": "Esperar",
      "type": "n8n-nodes-base.wait",
      "position": [
        4560,
        416
      ],
      "webhookId": "a8ae67f6-7e4d-4647-9511-30040d764dc6",
      "parameters": {
        "amount": 6
      },
      "typeVersion": 1.1
    },
    {
      "id": "72c7bc0f-827d-4f17-b83c-c7df897e4235",
      "name": "Agregar",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3440,
        400
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "Content"
      },
      "typeVersion": 1
    },
    {
      "id": "d3b853a8-0318-4e70-b742-56e0b394efb8",
      "name": "Combinar",
      "type": "n8n-nodes-base.merge",
      "position": [
        3648,
        400
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "7781dec5-b1db-4e85-8033-fd232f98fb3c",
      "name": "Redis",
      "type": "n8n-nodes-base.redis",
      "position": [
        736,
        304
      ],
      "parameters": {
        "list": "={{ $json.message.chat_id }}_buffer",
        "tail": true,
        "operation": "push",
        "messageData": "={{ JSON.stringify({\n  message_id: $('Set fields1').item.json.message.message_id,\n  chat_id: $('Set fields1').item.json.message.chat_id,\n  content_type: $('Set fields1').item.json.message.content_type,\n  content: $('Set fields1').item.json.message.content,\n  timestamp: $('Set fields1').item.json.message.timestamp,\n  url: $('Set fields1').item.json.url,\n  mimetype: $('Set fields1').item.json.mimetype,\n  mediaKey: $('Set fields1').item.json.mediaKey,\n  fileSha256: $('Set fields1').item.json.fileSha256,\n  fileLength: $('Set fields1').item.json.fileLength,\n  jpegThumbnail: $('Set fields1').item.json.jpegThumbnail,\n  user: $('Set fields1').item.json.user\n}) }}"
      },
      "credentials": {
        "redis": {
          "id": "kzytmvxt89OIjX1i",
          "name": "Redis account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "627b5411-38d2-4399-b71d-3e11ad01ff6e",
      "name": "Redis1",
      "type": "n8n-nodes-base.redis",
      "position": [
        976,
        304
      ],
      "parameters": {
        "key": "={{ $('Set fields1').item.json.message.chat_id }}_buffer",
        "options": {},
        "operation": "get",
        "propertyName": "Mensaje"
      },
      "credentials": {
        "redis": {
          "id": "kzytmvxt89OIjX1i",
          "name": "Redis account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e6ab5949-7386-4a93-bc37-019f554f83da",
      "name": "Redis2",
      "type": "n8n-nodes-base.redis",
      "position": [
        1456,
        304
      ],
      "parameters": {
        "key": "={{ $('Set fields1').item.json.message.chat_id }}_buffer",
        "operation": "delete"
      },
      "credentials": {
        "redis": {
          "id": "kzytmvxt89OIjX1i",
          "name": "Redis account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "01c8625c-a36a-45d9-b27d-dfc85e093e38",
      "name": "Nota Adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        64
      ],
      "parameters": {
        "width": 320,
        "height": 480,
        "content": "## WasenderAPI Setup\n\n**Quick Start:**\n1. Sign up at [wasenderapi.com](https://wasenderapi.com)\n2. Choose a plan ($6-$45)\n3. Create session with your WhatsApp number\n4. Scan QR code to connect\n5. Enable webhook with `messages.received` event\n\n**⚠️ Tip:** For new numbers, use manually for 7 days first to avoid detection."
      },
      "typeVersion": 1
    },
    {
      "id": "a29ed058-4dfa-433e-b653-7a642fbeee82",
      "name": "Nota Adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        64
      ],
      "parameters": {
        "width": 320,
        "height": 592,
        "content": "## Set Fields Node\n\n**Purpose:** Extracts and organizes WhatsApp message data\n\n**Key Fields:**\n- `message_id` - Unique message identifier\n- `chat_id` - Conversation identifier  \n- `content_type` - text/audio/image\n- `content` - Message text/caption\n- `timestamp` - Message date/time\n- Media fields: `url`, `mimetype`, `mediaKey`, etc.\n\n**Result:** Clean, structured data for processing"
      },
      "typeVersion": 1
    },
    {
      "id": "0c3a30af-c954-4378-84c4-795069c8b80b",
      "name": "Nota Adhesiva6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        -288
      ],
      "parameters": {
        "color": 3,
        "width": 848,
        "height": 1072,
        "content": "## Message Buffer System\n\n**Flow:**\n1. **Redis** - Stores messages in buffer\n2. **Redis1** - Reads accumulated messages\n3. **Switch** - Decides action:\n   - Ignore duplicates\n   - Continue if 7s elapsed\n   - Wait if messages still arriving\n4. **Wait3** - Pauses 7s for more messages\n5. **Redis2** - Cleans buffer after processing\n\n**Why?** Groups consecutive messages for smarter AI responses\n\n**Redis Setup:** Free tier at [redis.io](https://redis.io)"
      },
      "typeVersion": 1
    },
    {
      "id": "e02f45ab-8b2a-4a3c-81b2-3db89912663d",
      "name": "Nota Adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1808,
        -16
      ],
      "parameters": {
        "width": 624,
        "height": 576,
        "content": "## Message Processing\n\n**Split Out** - Separates buffered messages into individual items\n\n**Code** - Parses JSON messages safely with error handling\n\n**Switch Type** - Routes by content:\n- **Text** → Direct processing\n- **Audio** → Transcription flow\n- **Image** → Vision analysis flow\n\n**Result:** Each message type gets specialized handling"
      },
      "typeVersion": 1
    },
    {
      "id": "0e8c3e7a-7f5b-4e18-a1ca-63e9bb4ec89d",
      "name": "Nota Adhesiva3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2480,
        -464
      ],
      "parameters": {
        "color": 4,
        "width": 896,
        "height": 1392,
        "content": "## Content Processing\n\n**TEXT:** Extract content + timestamp\n\n**AUDIO:**\n1. Decrypt via WasenderAPI\n2. Download file\n3. Transcribe with OpenAI Whisper\n4. Format as text\n\n**IMAGE:**\n1. Decrypt via WasenderAPI  \n2. Analyze with GPT-4O Vision\n3. Combine user caption + AI description\n\n**OpenAI Setup:**\n- Get API key at [platform.openai.com](https://platform.openai.com)\n- Add payment method\n- Costs: ~$0.006/min audio, ~$0.01/image"
      },
      "typeVersion": 1
    },
    {
      "id": "9d02f39c-2589-4bb0-8a45-6b30c67e44e8",
      "name": "Nota Adhesiva4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3424,
        -128
      ],
      "parameters": {
        "width": 944,
        "height": 896,
        "content": "## AI Conversation System\n\n**Aggregate** - Combines all processed messages\n\n**Merge** - Joins data streams\n\n**Chat Input** - Creates unified text from all content types\n\n**AI Agent** - Processes with custom prompt\n\n**OpenAI Model** - GPT-4.1-mini for responses\n\n**Memory** - Remembers last 10 exchanges per chat\n\n**Result:** Context-aware AI that handles text, audio & images"
      },
      "typeVersion": 1
    },
    {
      "id": "f1048ef3-8096-4569-bdb8-2d398e37ae2f",
      "name": "Nota Adhesiva5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4480,
        -112
      ],
      "parameters": {
        "width": 464,
        "height": 720,
        "content": "## Response Delivery\n\n**Wait (6s)** - Critical anti-ban protection!\n- Simulates human typing time\n- Prevents instant bot detection\n- Protects WhatsApp account\n\n**Send Message** - Delivers AI response via WasenderAPI\n\n**⚠️ Important:** \n- Never remove the wait\n- 6-8s is optimal timing\n- Instant responses = account suspension risk"
      },
      "typeVersion": 1
    },
    {
      "id": "d800b3f3-d8ba-43ac-b7b6-b14e6843da95",
      "name": "Establecer campos1",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        496
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d3a9a053-6bc1-4b06-bd1d-66619c92154d",
              "name": "message.message_id",
              "type": "string",
              "value": "={{ $json.body.data.messages.key.id }}"
            },
            {
              "id": "00682555-4e80-4351-8ed3-71812ecd54f6",
              "name": "message.chat_id",
              "type": "string",
              "value": "={{ $json.body.data.messages.key.remoteJid }}"
            },
            {
              "id": "d28e7894-2df8-4ea4-bd01-8e4f285e3068",
              "name": "url",
              "type": "string",
              "value": "={{ $json.body?.data?.messages?.message?.imageMessage?.url || '' }}{{ $json.body?.data?.messages?.message?.audioMessage?.url || '' }}"
            },
            {
              "id": "c1e1ce53-ac41-4989-9f8d-e03f2a5395bf",
              "name": "message.content_type",
              "type": "string",
              "value": "={{ ($json.body.data.messages.message.extendedTextMessage && $json.body.data.messages.message.extendedTextMessage.text) || ($json.body.data.messages.message.conversation) ? 'text' : '' }}{{ $json.body.data.messages.message.audioMessage && $json.body.data.messages.message.audioMessage.mimetype ? 'audio' : '' }}{{ $json.body.data.messages.message.imageMessage && $json.body.data.messages.message.imageMessage.url ? 'image' : '' }}"
            },
            {
              "id": "46117b1c-4557-4354-8581-c5368b7b1bcf",
              "name": "message.content",
              "type": "string",
              "value": "={{ $json.body.data.messages.message.conversation || '' }}{{ $json.body.data.messages.message.extendedTextMessage?.text || ''}}{{ $json.body.data.messages.message.imageMessage?.caption || ''}}"
            },
            {
              "id": "2911cef7-00f5-4cf0-9e12-75509faf543a",
              "name": "message.timestamp",
              "type": "string",
              "value": "={{ DateTime.fromMillis($json.body.timestamp).toUTC().toISO() }}"
            },
            {
              "id": "23fd732c-6575-4b85-a3ba-b94ee137035f",
              "name": "mimetype",
              "type": "string",
              "value": "={{ $json.body?.data?.messages?.message?.audioMessage?.mimetype || '' }}{{ $json.body?.data?.messages?.message?.imageMessage?.mimetype || '' }}"
            },
            {
              "id": "db3fcae5-e030-4369-8738-08141e5a5184",
              "name": "mediaKey",
              "type": "string",
              "value": "={{ $json.body?.data?.messages?.message?.audioMessage?.mediaKey || '' }}{{ $json.body?.data?.messages?.message?.imageMessage?.mediaKey || '' }}"
            },
            {
              "id": "b629f260-390a-471b-8892-adb85a720ed1",
              "name": "fileSha256",
              "type": "string",
              "value": "={{ $json.body?.data?.messages?.message?.audioMessage?.fileSha256 || '' }}{{ $json.body?.data?.messages?.message?.imageMessage?.fileSha256 || '' }}"
            },
            {
              "id": "6b3ec16e-5e18-485a-9791-645ab1a49d98",
              "name": "fileLength",
              "type": "string",
              "value": "={{ $json.body?.data?.messages?.message?.audioMessage?.fileLength || '' }}{{ $json.body?.data?.messages?.message?.imageMessage?.fileLength || '' }}"
            },
            {
              "id": "759584be-888e-46b4-bf7c-0e9db2b39887",
              "name": "jpegThumbnail",
              "type": "string",
              "value": "={{ $json.body.data.messages.message.imageMessage?.jpegThumbnail ||''}}"
            },
            {
              "id": "019920f4-ce87-4c9a-be61-b11f4b0e13d7",
              "name": "user.name",
              "type": "string",
              "value": "={{ $json.body.data.messages.pushName }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ab0149b7-c162-427b-9d11-6a8f4866be7b",
      "name": "Al hacer clic en 'Ejecutar flujo de trabajo'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        48,
        80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "6e8a5c44-6a18-40e9-9b81-ed002c4473fe",
      "name": "Nota Adhesiva7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -16
      ],
      "parameters": {
        "height": 80,
        "content": "## Change to Webhook Trigger\nReplace manual trigger with webhook for production"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "217076f7-8505-48a0-80f3-f3160c09f99a": {
      "main": [
        [
          {
            "node": "2de4aea2-00fa-4f32-9172-420b59c96e93",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d3b853a8-0318-4e70-b742-56e0b394efb8": {
      "main": [
        [
          {
            "node": "a78497d6-29ec-4019-a8c8-fb3eebc76e53",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7781dec5-b1db-4e85-8033-fd232f98fb3c": {
      "main": [
        [
          {
            "node": "627b5411-38d2-4399-b71d-3e11ad01ff6e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9929d34c-2954-4272-861a-57b441c7eec0": {
      "main": [
        [
          {
            "node": "627b5411-38d2-4399-b71d-3e11ad01ff6e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "627b5411-38d2-4399-b71d-3e11ad01ff6e": {
      "main": [
        [
          {
            "node": "078ca1b6-4baf-42f3-bef5-6fca9f8dad7a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e6ab5949-7386-4a93-bc37-019f554f83da": {
      "main": [
        [
          {
            "node": "04c92b95-1756-4b11-8829-224ebcc5686b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "078ca1b6-4baf-42f3-bef5-6fca9f8dad7a": {
      "main": [
        [
          {
            "node": "9975c463-56c0-463c-8311-2d56b20e0684",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "e6ab5949-7386-4a93-bc37-019f554f83da",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "9929d34c-2954-4272-861a-57b441c7eec0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ffb21e8f-9568-4e5f-a7dc-9ede3cb3529d": {
      "main": [
        [
          {
            "node": "217076f7-8505-48a0-80f3-f3160c09f99a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "72c7bc0f-827d-4f17-b83c-c7df897e4235": {
      "main": [
        [
          {
            "node": "d3b853a8-0318-4e70-b742-56e0b394efb8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "04c92b95-1756-4b11-8829-224ebcc5686b": {
      "main": [
        [
          {
            "node": "bf1f8bcc-2cf6-4fb9-9a07-29196c621701",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a78497d6-29ec-4019-a8c8-fb3eebc76e53": {
      "main": [
        [
          {
            "node": "ffb21e8f-9568-4e5f-a7dc-9ede3cb3529d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d800b3f3-d8ba-43ac-b7b6-b14e6843da95": {
      "main": [
        [
          {
            "node": "7781dec5-b1db-4e85-8033-fd232f98fb3c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c21ec32e-ad73-4fac-8442-30d8906e1a5e": {
      "main": [
        [
          {
            "node": "e147bb2c-4b47-43d4-891f-3307afb7046c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "33193b50-0af9-4883-abd5-55a087dcca6a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "0c0914f9-c5c4-49a7-a1d4-7b59ea71fe54",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e147bb2c-4b47-43d4-891f-3307afb7046c": {
      "main": [
        [
          {
            "node": "72c7bc0f-827d-4f17-b83c-c7df897e4235",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "45c98f8a-81ac-4e99-a85b-3401b04e5c40": {
      "main": [
        [
          {
            "node": "0347c99c-b10b-49cb-acc4-6bb1522fe85c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a8a2f5e1-d9d1-46ab-8b1b-af95fcb1a3d8": {
      "main": [
        [
          {
            "node": "72c7bc0f-827d-4f17-b83c-c7df897e4235",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "33193b50-0af9-4883-abd5-55a087dcca6a": {
      "main": [
        [
          {
            "node": "4c87722c-fac4-48ff-9d51-3747211dfa0a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0c0914f9-c5c4-49a7-a1d4-7b59ea71fe54": {
      "main": [
        [
          {
            "node": "45c98f8a-81ac-4e99-a85b-3401b04e5c40",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0347c99c-b10b-49cb-acc4-6bb1522fe85c": {
      "main": [
        [
          {
            "node": "72c7bc0f-827d-4f17-b83c-c7df897e4235",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5598448f-1646-4299-923a-2dcf6707b4f2": {
      "ai_memory": [
        [
          {
            "node": "ffb21e8f-9568-4e5f-a7dc-9ede3cb3529d",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "22c600ee-a27d-4619-8f83-a4f70a221b3a": {
      "ai_languageModel": [
        [
          {
            "node": "ffb21e8f-9568-4e5f-a7dc-9ede3cb3529d",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "bf1f8bcc-2cf6-4fb9-9a07-29196c621701": {
      "main": [
        [
          {
            "node": "c21ec32e-ad73-4fac-8442-30d8906e1a5e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4c87722c-fac4-48ff-9d51-3747211dfa0a": {
      "main": [
        [
          {
            "node": "5371ce24-b650-47de-a77c-5b8438cbcca4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5371ce24-b650-47de-a77c-5b8438cbcca4": {
      "main": [
        [
          {
            "node": "a8a2f5e1-d9d1-46ab-8b1b-af95fcb1a3d8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ab0149b7-c162-427b-9d11-6a8f4866be7b": {
      "main": [
        [
          {
            "node": "d800b3f3-d8ba-43ac-b7b6-b14e6843da95",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Avanzado

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Avanzado
Número de nodos35
Categoría-
Tipos de nodos16
Descripción de la dificultad

Adecuado para usuarios avanzados, flujos de trabajo complejos con 16+ nodos

Autor
Jose Bossa

Jose Bossa

@bossa

AI consultant with over 3 months and high ticket salesman over 2 years.

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34