{
  "name": "Build a Facebook Messenger customer service AI chatbot with Google Gemini",
  "nodes": [
    {
      "id": "09d0e55f-9758-46fe-919f-d29866635f62",
      "name": "Sticky Note - Section 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        384
      ],
      "parameters": {
        "width": 672,
        "height": 752,
        "content": "## 1. Webhook & Validation\n[Read more about the Webhook node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook)\n\nFacebook sends events to this webhook when users interact wit"
      }
    },
    {
      "id": "1d856115-11a5-49a5-871d-9422a742b672",
      "name": "Sticky Note - Section 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        384
      ],
      "parameters": {
        "width": 992,
        "height": 752,
        "content": "## 2. AI Processing & Memory\n[Read more about Google Gemini Chat Model](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.lmchatgooglegemini/)\n[Read more about Memo"
      }
    },
    {
      "id": "393b3906-3fb4-4a53-8dfe-0ba7056311b7",
      "name": "Sticky Note - Section 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        384
      ],
      "parameters": {
        "width": 848,
        "height": 752,
        "content": "## 3. Format & Send Response\n[Read more about the HTTP Request node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest)\n\nAI responses are formatted for Facebook Messenger "
      }
    },
    {
      "id": "34ad6797-0ba9-4800-9e15-4523aa86779f",
      "name": "Set Context",
      "type": "n8n-nodes-base.set",
      "position": [
        992,
        800
      ]
    },
    {
      "id": "f2a1a53f-1ff2-4d8b-ab8b-dfc89c2d3e77",
      "name": "Facebook Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        272,
        800
      ]
    },
    {
      "id": "e31b61ba-cddc-4d38-866c-d3e1affaaebb",
      "name": "Confirm Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        496,
        688
      ]
    },
    {
      "id": "a4340780-79d9-436a-99c6-ec183db134e0",
      "name": "Send Text",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2208,
        800
      ]
    },
    {
      "id": "da879b0b-f3ee-41e8-ac70-b1eb4dddcbb0",
      "name": "Is message",
      "type": "n8n-nodes-base.if",
      "position": [
        496,
        816
      ]
    },
    {
      "id": "a58a6832-7628-4f52-b55c-4a07f01a8ed9",
      "name": "Typing",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1408,
        800
      ]
    },
    {
      "id": "c6317f03-64a7-4482-8c2f-6f2abda7244d",
      "name": "From user?",
      "type": "n8n-nodes-base.if",
      "position": [
        720,
        816
      ]
    },
    {
      "id": "cdf77064-a608-421f-963d-29edc2d77ff6",
      "name": "Seen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1200,
        800
      ]
    },
    {
      "id": "d71c3244-8c5d-43ae-8a67-a959b2a6b0e0",
      "name": "Cut if reply more than 2000 characters",
      "type": "n8n-nodes-base.code",
      "position": [
        2016,
        800
      ]
    },
    {
      "id": "056d8116-080d-4348-9971-82aad2555323",
      "name": "Sticky Note - Main Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        128
      ],
      "parameters": {
        "width": 624,
        "height": 1008,
        "content": "## Try It Out!\n### This n8n template demonstrates how to build a simple but functional AI-powered customer service chatbot for Facebook Messenger using Google Gemini with conversation memory.\n\nThis is"
      }
    },
    {
      "id": "ab7be654-afd9-46d7-8982-ac6448689813",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        960
      ],
      "parameters": {
        "width": 320,
        "height": 208,
        "content": "## ⚠️ Important!\n\nReplace `YOUR_PAGE_ACCESS_TOKEN_HERE` in the **Set Context node** with your actual Facebook Page Access Token.\n\nGet your token at:\n[developers.facebook.com](https://developers.facebo"
      }
    },
    {
      "id": "19e6d753-7532-4a65-9eec-6c5f53730763",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2800,
        384
      ],
      "parameters": {
        "width": 336,
        "height": 752,
        "content": "## Limitations & When to Upgrade\n\n⚠️ **This is a simple version** with basic features:\n\n**Current limitations:**\n- No smart batching (responds to each message immediately)\n- No human takeover detectio"
      }
    },
    {
      "id": "36bf4d1f-8826-4efb-803b-4073453ef959",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        2400,
        800
      ]
    },
    {
      "id": "83590d96-f06d-4cd5-a395-e1f9158f12f0",
      "name": "Send image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2656,
        736
      ]
    },
    {
      "id": "ee63e73b-adcb-4186-83fa-b3e97a54ca76",
      "name": "Send video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2656,
        912
      ]
    },
    {
      "id": "f6e0d328-2534-4911-930f-45f760e0c7d6",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        128
      ],
      "parameters": {
        "width": 672,
        "height": 240,
        "content": "## ☕BUY ME A COFFEE?\nHi! I am  **Nguyễn Thiệu Toàn (or you can call me Jay / Jay Nguyen)** - a Verified n8n Creator. Thank you for using this template!\nThis workflow is shared with you for free. If it"
      }
    },
    {
      "id": "3aa761a2-3c51-48d7-9209-699373e1a046",
      "name": "Conversation Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1616,
        976
      ]
    },
    {
      "id": "45629f15-873d-4f05-8b51-6d15fb6d1295",
      "name": "Gemini Flash",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1504,
        976
      ]
    },
    {
      "id": "5aee82ff-5b54-4271-99c1-a70986736765",
      "name": "Process Merged Message",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1616,
        800
      ]
    },
    {
      "id": "8efa21c9-17f1-4306-93d1-475bb9ce1258",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1776,
        1008
      ]
    }
  ],
  "connections": {
    "Seen": {
      "main": [
        [
          {
            "node": "Typing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Send image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Typing": {
      "main": [
        [
          {
            "node": "Process Merged Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Text": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "From user?": {
      "main": [
        [
          {
            "node": "Set Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is message": {
      "main": [
        [
          {
            "node": "From user?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Context": {
      "main": [
        [
          {
            "node": "Seen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Flash": {
      "ai_languageModel": [
        [
          {
            "node": "Process Merged Message",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Facebook Webhook": {
      "main": [
        [
          {
            "node": "Confirm Webhook",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Confirm Webhook",
            "type": "main",
            "index": 0
          },
          {
            "node": "Is message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Conversation Memory": {
      "ai_memory": [
        [
          {
            "node": "Process Merged Message",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Process Merged Message": {
      "main": [
        [
          {
            "node": "Cut if reply more than 2000 characters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Process Merged Message",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Cut if reply more than 2000 characters": {
      "main": [
        [
          {
            "node": "Send Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}