{
  "name": "AI-powered Telegram bot for data extraction with Bright Data MCP",
  "nodes": [
    {
      "id": "9be111d1-4ea3-4c43-8b75-66a1123002fd",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1580,
        840
      ]
    },
    {
      "id": "860579ca-110e-4b7d-848a-e4085e05a6a6",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -1520,
        1060
      ]
    },
    {
      "id": "b9b2b497-1018-40ad-b1bd-0e04cbfdb95b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2480,
        400
      ],
      "parameters": {
        "width": 560,
        "height": 640,
        "content": "## Receive Webhook from Telegram\nSetup telegram hook using the HTTP node below. Replace the api key placeholder in the URL field of the node.\nReplace the URL with the one generated from the Webhook tr"
      }
    },
    {
      "id": "6fd8fd1b-0ec2-402a-8d97-13bbc6ca6ca2",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -1660,
        1060
      ]
    },
    {
      "id": "273d9378-bbea-49ea-8a4c-cf473da4639e",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -2400,
        580
      ]
    },
    {
      "id": "4f77a573-e729-4ca2-9263-005c9c67b21a",
      "name": "Set Telegram Webhook",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2140,
        580
      ]
    },
    {
      "id": "b29f6cbd-2ca1-455e-9372-4d7c1aee2811",
      "name": "Receive Message Trigger from Telegram",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -2280,
        840
      ]
    },
    {
      "id": "f8b25f38-143b-4fc8-890c-03701bde0809",
      "name": "Typing action",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1040,
        260
      ]
    },
    {
      "id": "22d5b740-0ad4-4e4d-b5b4-7961e131d3bd",
      "name": "Sub-workflow to trigger Typing Action",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        -1580,
        260
      ]
    },
    {
      "id": "a2d0a7ba-df6b-43d3-9fb4-1026e3d4d154",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1760,
        680
      ],
      "parameters": {
        "width": 620,
        "height": 560,
        "content": "## AI Agent with Bright Data MCP as a tool\nHost your SSE server using Supergateway or similar tools. Please check the template’s description for more instruction to setup the SSE from STDIO  command. "
      }
    },
    {
      "id": "a4dd5168-8a4f-4ec6-8d3c-992ceb7db7ff",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -820,
        700
      ],
      "parameters": {
        "width": 560,
        "height": 460,
        "content": "## Send the agent's message via Telegram Bot"
      }
    },
    {
      "id": "84999800-2659-4e4d-8771-d9c5f7ff4e2a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1720,
        120
      ],
      "parameters": {
        "width": 1560,
        "height": 500,
        "content": "## Loop the typing action in Telegram\nTyping action last fro 10 seconds only, so while the agent is still processing query, execute this tool in a loop until it succeed"
      }
    },
    {
      "id": "266b1d20-452b-47fc-9632-437bf7f3abac",
      "name": "Reply Error Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        320,
        280
      ]
    },
    {
      "id": "4be1ec2b-3ef2-45b8-b1d4-cf39791654f2",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        80
      ],
      "parameters": {
        "width": 560,
        "height": 500,
        "content": "## Reply error message to the user on error"
      }
    },
    {
      "id": "a3d321c8-4e9d-4c0e-86b5-da002b0ac29d",
      "name": "MCP Client",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        -1340,
        1080
      ]
    },
    {
      "id": "c716a991-17e0-4de4-af0d-ba6e44b5c6d2",
      "name": "Check if the execution in N8N is finished",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -600,
        260
      ]
    },
    {
      "id": "b6f08d79-16a5-47a7-800d-7c8ba902ab52",
      "name": "If the N8N execution is finished",
      "type": "n8n-nodes-base.if",
      "position": [
        -340,
        320
      ]
    },
    {
      "id": "38342c4f-b020-4dc5-b633-ebaaf2582fef",
      "name": "Check if the N8N status is success",
      "type": "n8n-nodes-base.if",
      "position": [
        100,
        280
      ]
    },
    {
      "id": "dd3c7d3e-b011-4856-b41e-c17882a19aab",
      "name": "Send AI’s output to the user via Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -580,
        840
      ]
    },
    {
      "id": "d415ca44-e93b-4e10-8af6-f0f6cc059e26",
      "name": "Wait for the typing action to finish by 10 seconds",
      "type": "n8n-nodes-base.wait",
      "position": [
        -820,
        260
      ]
    },
    {
      "id": "6d7822c9-ac66-443f-909b-83596dd738c0",
      "name": "Trigger by the main workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -1300,
        260
      ]
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send AI’s output to the user via Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MCP Client": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Typing action": {
      "main": [
        [
          {
            "node": "Wait for the typing action to finish by 10 seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Trigger by the main workflow": {
      "main": [
        [
          {
            "node": "Typing action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If the N8N execution is finished": {
      "main": [
        [
          {
            "node": "Typing action",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check if the N8N status is success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set Telegram Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if the N8N status is success": {
      "main": [
        [
          {
            "node": "Reply Error Message",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Receive Message Trigger from Telegram": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "Sub-workflow to trigger Typing Action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if the execution in N8N is finished": {
      "main": [
        [
          {
            "node": "If the N8N execution is finished",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for the typing action to finish by 10 seconds": {
      "main": [
        [
          {
            "node": "Check if the execution in N8N is finished",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}