AutomationFlowsSocial Media › Auto-respond to Instagram, Facebook & Whatsapp with Llama 3.2

Auto-respond to Instagram, Facebook & Whatsapp with Llama 3.2

ByOneclick AI Squad @oneclick-ai on n8n.io

This automated n8n workflow enables AI-powered responses across multiple social media platforms, including Instagram DMs, Facebook messages, and WhatsApp chats using Meta's APIs. The system provides intelligent customer support, lead generation, and smart engagement at scale…

Event trigger★★★★☆ complexityAI-powered12 nodesWhatsApp TriggerAgentMemory Buffer WindowOllama ChatHTTP RequestWhatsApp
Social Media Trigger: Event Nodes: 12 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #6632 — we link there as the canonical source.

This workflow follows the Agent → 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 →

Download .json
{
  "id": "CiNwrwKWPu3H2Je8",
  "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
      ],
      "parameters": {
        "options": {},
        "updates": [
          "messages"
        ]
      },
      "credentials": {
        "whatsAppTriggerApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "03c454b3-c54a-4137-8f0b-70e77f04eb6a",
      "name": "Instagram Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        200
      ],
      "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
      ],
      "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** \u2192 Friendly and professional\n* **Instagram** \u2192 Trendy, casual, and emoji-friendly \ud83d\ude04\n* **Facebook** \u2192 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 }}! \ud83d\udc4b I'm {{ assistant_name }} from {{ business_name }}. How can I assist you today?\"`\n* Instagram: `\"Hey {{ $json.senderName }}! \ud83d\udcac I\u2019m {{ assistant_name }} from {{ business_name }} \u2014 ready to help or chat! \ud83d\ude0a\"`\n* Facebook: `\"Hello {{ $json.senderName }}! \ud83d\udc4b Welcome to {{ business_name }}. I'm {{ assistant_name }} \u2014 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": {
          "name": "<your credential>"
        }
      },
      "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_TOKEN_HERE"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "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_TOKEN_HERE"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c2225425-78df-44da-a5b4-4113dfcfba8c",
      "name": "Send message",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        1036,
        0
      ],
      "parameters": {
        "textBody": "={{ $json.output }}",
        "operation": "send",
        "phoneNumberId": "=550325331503475",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('Message Processor').item.json.senderId }}"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "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\u2019s APIs\u2014ideal for customer support, lead generation, and smart engagement at scale.\n\n## Requirements:\n\n1. Access to Meta\u2019s 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,
  "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
          }
        ]
      ]
    }
  }
}

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This automated n8n workflow enables AI-powered responses across multiple social media platforms, including Instagram DMs, Facebook messages, and WhatsApp chats using Meta's APIs. The system provides intelligent customer support, lead generation, and smart engagement at scale…

Source: https://n8n.io/workflows/6632/ — original creator credit. Request a take-down →

More Social Media workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Social Media

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI +8
Social Media

Workflow 3409. Uses httpRequest, executeWorkflowTrigger, memoryBufferWindow, memoryManager. Event-driven trigger; 39 nodes.

HTTP Request, Execute Workflow Trigger, Memory Buffer Window +2
Social Media

Automate Facebook Messenger orders to Google Sheets and Google Calendar

Agent, Memory Buffer Window, OpenRouter Chat +3
Social Media

This n8n workflow template automates the entire process of publishing Instagram Reels from content stored in Google Sheets and Google Drive. It's designed for content creators, social media managers,

Agent, Airtable, Facebook Graph Api +8
Social Media

Automate your cross-platform publishing workflow by automatically uploading Instagram videos to YouTube with AI-optimized titles and tags. 🚀🎬 This workflow runs every six hours, fetches newly posted I

HTTP Request, Facebook Graph Api, Agent +5