AutomationFlowsAI & RAG › Facebook Messenger Chatbot with Gpt-4.1 & Human Escalation Support

Facebook Messenger Chatbot with Gpt-4.1 & Human Escalation Support

BySpaGreen Creative @spagreen on n8n.io

This n8n workflow is designed for businesses, customer support teams, and page administrators who want to automate their Facebook Messenger responses while maintaining the ability to escalate to human agents when needed. It's perfect for e-commerce stores, service providers, and…

Webhook trigger★★★★★ complexityAI-powered32 nodesAgentTool ThinkHTTP Request ToolGoogle Docs ToolMemory Buffer WindowFacebook Graph ApiOpenAI ChatOpenAI
AI & RAG Trigger: Webhook Nodes: 32 Complexity: ★★★★★ AI nodes: yes Added:

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

This workflow follows the Agent → Facebookgraphapi 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": "JYcvkULVcMN3xRmu",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI-Powered Facebook Page Support Chatbot: Auto Reply & Smart Customer Handling",
  "tags": [],
  "nodes": [
    {
      "id": "8fd8c105-3183-4b16-998c-bec0a66ef9d3",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -352,
        368
      ],
      "parameters": {},
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 2,
      "alwaysOutputData": false
    },
    {
      "id": "fdf6fb02-7811-425f-b308-0b57f04ae3e6",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        576,
        336
      ],
      "parameters": {},
      "typeVersion": 1.4
    },
    {
      "id": "23d555f7-dd7a-495c-a6d4-f5323ac0126a",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1120,
        624
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "ed206620-e550-4cfd-a23f-aaaec680d71d",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "notes": "You are a friendly and intelligent customer support assistant for a business.\n\nYour job is to:\n\nUnderstand the user\u2019s message carefully and respond in a way that shows you understand the question or issue.\n\nAutomatically reply in Bengali if the user writes in Bengali, and in English if the user writes in English.\n\nSound like a helpful human, not like a robot. Be clear, warm, and polite.\n\n\ud83d\udde3\ufe0f Tone Guide:\nUse simple, everyday language. Don\u2019t use overly formal or robotic phrases.\nExample Bengali:\n\n\u201c\u09a7\u09a8\u09cd\u09af\u09ac\u09be\u09a6 \u0986\u09aa\u09a8\u09be\u09b0 \u09aa\u09cd\u09b0\u09b6\u09cd\u09a8\u09c7\u09b0 \u099c\u09a8\u09cd\u09af! \u0986\u09ae\u09bf \u09a6\u09c7\u0996\u099b\u09bf\u2026\u201d\n\n\u201c\u098f\u0987 \u09ac\u09bf\u09b7\u09df\u09c7 \u098f\u0995\u099f\u09c1 \u09ac\u09bf\u09b8\u09cd\u09a4\u09be\u09b0\u09bf\u09a4 \u09ac\u09b2\u09ac\u09c7\u09a8?\u201d\nExample English:\n\n\u201cThanks for your message! Let me check that for you.\u201d\n\n\u201cCould you please give me a bit more detail?\u201d\n\n\u2757 If you're unsure or can\u2019t answer, say:\n\n\u201c\u098f\u0987 \u09ac\u09bf\u09b7\u09df\u099f\u09be \u098f\u0995\u099c\u09a8 \u09b8\u09b9\u0995\u09be\u09b0\u09c0 \u09a6\u09c7\u0996\u09c7 \u09a6\u09c7\u09ac\u09c7\u0964\u201d\n\n\u201cLet me forward this to a human assistant for better help.\u201d\n\nNever guess or make up information. Keep replies short, helpful, and natural.",
      "position": [
        1200,
        848
      ],
      "parameters": {},
      "notesInFlow": true,
      "typeVersion": 1.1
    },
    {
      "id": "2c2792b4-c4d3-4d19-9cb1-968486e61b67",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1648,
        624
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "5cd9578c-2619-4d28-9293-ce332d843b4b",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        480,
        1024
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "7c26a106-2562-4705-adb1-9802ec8806cd",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -16,
        784
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "ff62b18c-4770-4b2d-9c42-ef493a02d0a3",
      "name": "HTTP",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        1328,
        848
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "aa32f617-6a44-41dd-bb63-ad727385bf03",
      "name": "Google Docs",
      "type": "n8n-nodes-base.googleDocsTool",
      "position": [
        1456,
        848
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "8d01dc1b-30a8-4ea0-8e73-fb913507d2e3",
      "name": "Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1072,
        848
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "c433f959-b495-4fc9-a695-cec427e4ea94",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        784,
        1024
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "c66511c7-db66-49e3-9304-98b5d45bb728",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1232,
        1024
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "ce53539d-f846-4fdc-b899-2a625af8ff31",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        1120,
        384
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "b89a5e6e-8e52-4072-937f-664e4f330e21",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        768,
        512
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "6704b261-754e-4cce-9de2-e02456654d20",
      "name": "Wait3",
      "type": "n8n-nodes-base.wait",
      "position": [
        1648,
        384
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "983dbe1e-b0f3-4e9f-ab13-ee3aab98ca20",
      "name": "Admin Message",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1904,
        288
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "63009f02-5c12-4aca-8624-411ae7dd1660",
      "name": "User Message",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1904,
        464
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "27149952-d3e1-4a40-b76f-9727063be7c2",
      "name": "Admin Message1",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1904,
        1024
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f53eade6-0680-4344-ac53-03c44780b899",
      "name": "User Replay Message",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1904,
        624
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a108028e-1233-49d2-87f8-e387da054198",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        80
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4e0146d7-e0c0-4d4f-86b4-b1b0f29e0450",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1872,
        160
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2a621ce0-f8bc-4fcb-b882-32c768d1f403",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1872,
        944
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "a0a7f878-2774-4ba6-9b94-a65f3079089b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2016,
        432
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "63eaa3a4-a545-4978-b4d7-6190c4a4a370",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1872,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "947d05db-9937-45ed-8239-a6743be4011d",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        1008
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "395fbcf9-9248-4480-86e3-4e7385df3b75",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        496
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e2296442-2615-414c-b9fd-5b732a949e2e",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        608
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b617714f-8cfe-4802-8be5-4f191a9b1d2c",
      "name": "If3",
      "type": "n8n-nodes-base.if",
      "position": [
        -16,
        352
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "0b078ace-f67e-4fc4-896a-3cb0d17fda14",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        480,
        1216
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "a6310755-b471-4f6a-85b8-f08b9776f92c",
      "name": "Classify text",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        480,
        512
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "2d3e5185-b81b-47bc-840c-4fc9db6149ac",
      "name": "OpenAI Chat",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        960,
        848
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "afb09507-d8d3-4400-a299-516c9eff4abc",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2080,
        80
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "b105f592-5f3f-49a0-abc1-7e1d9cdc3fae",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Classify text",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If3": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "User Replay Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait3": {
      "main": [
        [
          {
            "node": "User Message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Admin Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "If3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Admin Message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Docs": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Wait3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify text": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Respond to Webhook": {
      "main": [
        []
      ]
    },
    "User Replay Message": {
      "main": [
        []
      ]
    }
  }
}
Pro

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

About this workflow

This n8n workflow is designed for businesses, customer support teams, and page administrators who want to automate their Facebook Messenger responses while maintaining the ability to escalate to human agents when needed. It's perfect for e-commerce stores, service providers, and…

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

More AI & RAG workflows → · Browse all categories →

Related workflows

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

AI & RAG

This n8n workflow is designed for Facebook Page administrators, social media managers, and community moderators who want to automate comment management on their Facebook Pages. It's perfect for busine

Facebook Graph Api, Agent, HTTP Request +8
AI & RAG

This n8n workflow creates an intelligent WhatsApp customer support bot that can handle text, image, audio, and document messages. The workflow automatically processes incoming messages through differe

HTTP Request, N8N Nodes Rapiwa, Agent Tool +9
AI & RAG

AI marketing Team Agent. Uses toolWorkflow, telegram, memoryBufferWindow, openAi. Event-driven trigger; 46 nodes.

Tool Workflow, Telegram, Memory Buffer Window +10
AI & RAG

This workflow transforms WhatsApp into a powerful personal AI using n8n + Green-API. Send text or voice messages — the assistant understands intent and handles daily tasks automatically. 💰 Expense & i

Tool Calculator, Google Sheets Tool, OpenAI Chat +10
AI & RAG

This n8n automation workflow is designed for customer support teams, business owners, or service providers who want to automate customer interactions on WhatsApp.

Tool Think, N8N Nodes Rapiwa, Agent +6