Plugin de IA para respuestas automáticas en redes sociales (Instagram, Facebook y WhatsApp)

Intermedio

Este es unSupport Chatbot, AI Chatbotflujo de automatización del dominio deautomatización que contiene 12 nodos.Utiliza principalmente nodos como Code, Switch, Webhook, WhatsApp, HttpRequest. Sistema de respuesta automática para mensajes de redes sociales basado en Llama 3.2 (Instagram, Facebook, WhatsApp)

Requisitos previos
  • Punto final de HTTP Webhook (n8n generará automáticamente)
  • Pueden requerirse credenciales de autenticación para la API de destino
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
{
  "id": "CiNwrwKWPu3H2Je8",
  "meta": {
    "instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281"
  },
  "name": "AI Social Media Auto-Responder Add-on (Instagram, Facebook & WhatsApp)",
  "tags": [],
  "nodes": [
    {
      "id": "a6f84e67-3376-41fe-9f84-79c20b9abd5e",
      "name": "WhatsApp Trigger",
      "type": "n8n-nodes-base.whatsAppTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "0d34f8e7-7cae-4aac-8b56-c1ea698bde5e",
      "parameters": {
        "options": {},
        "updates": [
          "messages"
        ]
      },
      "credentials": {
        "whatsAppTriggerApi": {
          "id": "jt1wbDtaEmlHpPFc",
          "name": "WhatsApp -test"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "03c454b3-c54a-4137-8f0b-70e77f04eb6a",
      "name": "Instagram Disparador Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        200
      ],
      "webhookId": "1366ec6d-04d2-4019-93d6-c3578fa106ba",
      "parameters": {
        "path": "1366ec6d-04d2-4019-93d6-c3578fa106ba",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "e7f9f0b3-62a1-4efb-b29f-a80a59e57781",
      "name": "Facebook Disparador Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        400
      ],
      "webhookId": "ead9ab3d-3c85-45bd-800c-85661b2d4c48",
      "parameters": {
        "path": "ead9ab3d-3c85-45bd-800c-85661b2d4c48",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "3f48de85-02f1-4227-b913-ef5fa501a9ff",
      "name": "Message Processor",
      "type": "n8n-nodes-base.code",
      "position": [
        220,
        200
      ],
      "parameters": {
        "jsCode": "const inputData = $input.first().json;\n\n// WhatsApp Message Processing - Based on your actual data structure\nif (inputData.messaging_product === 'whatsapp' && inputData.messages && inputData.messages[0]) {\n  return {\n    platform: 'whatsapp',\n    senderId: inputData.contacts[0].wa_id,\n    senderName: inputData.contacts[0].profile.name || 'User',\n    message: inputData.messages[0].text.body,\n    messageId: inputData.messages[0].id,\n    timestamp: inputData.messages[0].timestamp\n  };\n}\n\n// Instagram DM Processing\nif (inputData.object === 'instagram' && inputData.entry && inputData.entry[0]) {\n  const entry = inputData.entry[0];\n  const messaging = entry.messaging ? entry.messaging[0] : null;\n  \n  if (messaging) {\n    return {\n      platform: 'instagram',\n      senderId: messaging.sender.id,\n      senderName: 'Instagram User',\n      message: messaging.message.text,\n      messageId: messaging.message.mid,\n      timestamp: messaging.timestamp || Date.now()\n    };\n  }\n}\n\n// Facebook Messenger Processing\nif (inputData.object === 'page' && inputData.entry && inputData.entry[0]) {\n  const entry = inputData.entry[0];\n  const messaging = entry.messaging ? entry.messaging[0] : null;\n  \n  if (messaging) {\n    return {\n      platform: 'facebook',\n      senderId: messaging.sender.id,\n      senderName: 'Facebook User',\n      message: messaging.message.text,\n      messageId: messaging.message.mid,\n      timestamp: messaging.timestamp\n    };\n  }\n}\n\n// Default WhatsApp fallback based on your current data\nreturn {\n  platform: 'whatsapp',\n  senderId: inputData.contacts ? inputData.contacts[0].wa_id : 'unknown',\n  senderName: inputData.contacts ? (inputData.contacts[0].profile.name || 'User') : 'Unknown User',\n  message: inputData.messages ? inputData.messages[0].text.body : 'Hello',\n  messageId: inputData.messages ? inputData.messages[0].id : 'unknown',\n  timestamp: inputData.messages ? inputData.messages[0].timestamp : Date.now()\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "f7cbdab7-7712-4dbd-a384-2e93cec174ce",
      "name": "AI Travel Agente",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        440,
        200
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "options": {
          "systemMessage": "=You are {{ assistant\\_name }}, a professional, friendly, and smart virtual assistant for {{ business\\_name }}.\nYour role is to handle conversations across WhatsApp, Instagram DMs, and Facebook Messenger with clarity, relevance, and an engaging tone.\n\nYou can assist with:\n\n* Answering any type of message (questions, feedback, greetings, etc.)\n* Offering help, recommendations, or information based on user intent\n* Generating leads and qualifying users for follow-up\n* Providing support, updates, or guidance on services/products\n* Driving user engagement with helpful and human-like interactions\n\n---\n\n**Current Platform:** `{{ $json.platform }}`\n**User:** `{{ $json.senderName }}`\n\nAdapt your tone and message style to the platform:\n\n* **WhatsApp** → Friendly and professional\n* **Instagram** → Trendy, casual, and emoji-friendly 😄\n* **Facebook** → Warm and informative\n\nStart new conversations with a personalized greeting using their name when available.\n\n**Example Greetings:**\n\n* WhatsApp: `\"Hi {{ $json.senderName }}! 👋 I'm {{ assistant_name }} from {{ business_name }}. How can I assist you today?\"`\n* Instagram: `\"Hey {{ $json.senderName }}! 💬 I’m {{ assistant_name }} from {{ business_name }} — ready to help or chat! 😊\"`\n* Facebook: `\"Hello {{ $json.senderName }}! 👋 Welcome to {{ business_name }}. I'm {{ assistant_name }} — here to assist you with anything you need!\"`\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "138d5a96-77df-4090-9638-f97fefb86077",
      "name": "Platform Memoria",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        588,
        420
      ],
      "parameters": {
        "sessionKey": "={{ $json.platform }}_{{ $json.senderId }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 150
      },
      "typeVersion": 1.3
    },
    {
      "id": "2511ccf9-d304-4bf5-87c5-a9df08d349fd",
      "name": "Ollama Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "position": [
        400,
        420
      ],
      "parameters": {
        "model": "llama3.2-16000:latest",
        "options": {}
      },
      "credentials": {
        "ollamaApi": {
          "id": "7td3WzXCW2wNhraP",
          "name": "Ollama - test"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2768f9da-efd0-4b4a-9363-efca330bc365",
      "name": "Response Router",
      "type": "n8n-nodes-base.switch",
      "position": [
        816,
        200
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "df1409ea-c9f3-49db-8211-09ebc3d6a4dc",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "rightType": "any"
                    },
                    "leftValue": "={{ $('Message Processor').item.json.platform }}",
                    "rightValue": "whatsapp"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "3abbb56f-b057-4fee-acbd-b668e8a82f7d",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "rightType": "any"
                    },
                    "leftValue": "={{ $('Message Processor').item.json.platform }}",
                    "rightValue": "instagram"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "fbbe45de-f30a-4fc1-8c97-36c13c4a55fa",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "rightType": "any"
                    },
                    "leftValue": "={{ $('Message Processor').item.json.platform }}",
                    "rightValue": "facebook"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "662582af-b7f0-4019-9aee-acb4d07d8f1e",
      "name": "Instagram Sender",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1036,
        200
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v18.0/{{ $('Message Processor').item.json.senderId }}/messages",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer YOUR_INSTAGRAM_ACCESS_TOKEN"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "KCqBydsOZHvzNKAI",
          "name": "Header Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ed99f2fc-74b7-441b-9811-b106203dd117",
      "name": "Facebook Sender",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1036,
        400
      ],
      "parameters": {
        "url": "https://graph.facebook.com/v18.0/me/messages",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer YOUR_FACEBOOK_ACCESS_TOKEN"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "KCqBydsOZHvzNKAI",
          "name": "Header Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c2225425-78df-44da-a5b4-4113dfcfba8c",
      "name": "Send message",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1036,
        0
      ],
      "webhookId": "20a10490-a88a-4f19-b262-3e3055884ac5",
      "parameters": {
        "textBody": "={{ $json.output }}",
        "operation": "send",
        "phoneNumberId": "=550325331503475",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('Message Processor').item.json.senderId }}"
      },
      "credentials": {
        "whatsAppApi": {
          "id": "b0PxTDPdWzznWnfG",
          "name": "WhatsApp-test "
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fad91265-1b34-4e8a-b6e9-303a7bb9b154",
      "name": "Nota adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -220
      ],
      "parameters": {
        "width": 780,
        "height": 280,
        "content": "## Purpose:\nEnable your AI assistant to automatically respond to Instagram DMs, Facebook messages, and WhatsApp chats using Meta’s APIs—ideal for customer support, lead generation, and smart engagement at scale.\n\n## Requirements:\n\n1. Access to Meta’s Instagram Graph API, Facebook Messenger API, and WhatsApp Business Cloud API\n2. Approved Meta Developer App\n3. Webhook setup and persistent token management for real-time messaging"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "03c4ca8e-da13-4c0c-84e1-8762522da61d",
  "connections": {
    "c2225425-78df-44da-a5b4-4113dfcfba8c": {
      "main": [
        []
      ]
    },
    "AI Travel Agent": {
      "main": [
        [
          {
            "node": "2768f9da-efd0-4b4a-9363-efca330bc365",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ed99f2fc-74b7-441b-9811-b106203dd117": {
      "main": [
        []
      ]
    },
    "Platform Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Travel Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "2768f9da-efd0-4b4a-9363-efca330bc365": {
      "main": [
        [
          {
            "node": "c2225425-78df-44da-a5b4-4113dfcfba8c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "662582af-b7f0-4019-9aee-acb4d07d8f1e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ed99f2fc-74b7-441b-9811-b106203dd117",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Facebook Webhook": {
      "main": [
        [
          {
            "node": "3f48de85-02f1-4227-b913-ef5fa501a9ff",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "662582af-b7f0-4019-9aee-acb4d07d8f1e": {
      "main": [
        []
      ]
    },
    "a6f84e67-3376-41fe-9f84-79c20b9abd5e": {
      "main": [
        [
          {
            "node": "3f48de85-02f1-4227-b913-ef5fa501a9ff",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram Webhook": {
      "main": [
        [
          {
            "node": "3f48de85-02f1-4227-b913-ef5fa501a9ff",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3f48de85-02f1-4227-b913-ef5fa501a9ff": {
      "main": [
        [
          {
            "node": "AI Travel Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2511ccf9-d304-4bf5-87c5-a9df08d349fd": {
      "ai_languageModel": [
        [
          {
            "node": "AI Travel Agent",
            "type": "ai_languageModel",
            "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?

Intermedio - Chatbot de soporte, Chatbot de IA

¿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
Intermedio
Número de nodos12
Categoría2
Tipos de nodos10
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Autor
Oneclick AI Squad

Oneclick AI Squad

@oneclick-ai

The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34