N
n8n Store
Workflow Market
AI Social Media Auto-Responder Add-on (Instagram, Facebook & WhatsApp)

AI Social Media Auto-Responder Add-on (Instagram, Facebook & WhatsApp)

by oneclick-ai3 views

Description

Categories

🤖 AI & Machine Learning

Nodes Used

n8n-nodes-base.coden8n-nodes-base.switchn8n-nodes-base.webhookn8n-nodes-base.webhookn8n-nodes-base.whatsAppn8n-nodes-base.stickyNoten8n-nodes-base.httpRequestn8n-nodes-base.httpRequest@n8n/n8n-nodes-langchain.agentn8n-nodes-base.whatsAppTrigger
PriceKostenlos
Views3
Last Updated3/3/2026
workflow.json
{
  "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 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 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 Agent",
      "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 Memory",
      "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": "Sticky Note",
      "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": {
    "Send message": {
      "main": [
        []
      ]
    },
    "AI Travel Agent": {
      "main": [
        [
          {
            "node": "Response Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Facebook Sender": {
      "main": [
        []
      ]
    },
    "Platform Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Travel Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Response Router": {
      "main": [
        [
          {
            "node": "Send message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Instagram Sender",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Facebook Sender",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Facebook Webhook": {
      "main": [
        [
          {
            "node": "Message Processor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram Sender": {
      "main": [
        []
      ]
    },
    "WhatsApp Trigger": {
      "main": [
        [
          {
            "node": "Message Processor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Instagram Webhook": {
      "main": [
        [
          {
            "node": "Message Processor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message Processor": {
      "main": [
        [
          {
            "node": "AI Travel Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Travel Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流