{
  "name": "Turn Telegram into an AI assistant with OpenAI voice, memory and tools",
  "nodes": [
    {
      "id": "bb4b8f62-17a9-40ad-8ad6-ac810a85ee91",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        800,
        1168
      ]
    },
    {
      "id": "73f0455a-d35f-4da1-a539-13a7795dd8a7",
      "name": "Email Agent",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        1072,
        1168
      ]
    },
    {
      "id": "fc113e51-b1c8-430c-b432-987ce0f9c5a2",
      "name": "CalendarAgent",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        1216,
        1168
      ]
    },
    {
      "id": "05ab59ea-3a31-47d8-83c8-70f25fb24fc3",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1488,
        1168
      ]
    },
    {
      "id": "74b705a6-3baa-4d6b-9808-bbafc386e175",
      "name": "ResearchAgent",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        1360,
        1168
      ]
    },
    {
      "id": "980bb84d-9308-4b79-95e3-d8505de00a1b",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        1600,
        1168
      ]
    },
    {
      "id": "04a0ad29-8ef7-4bd7-ae42-033c58571819",
      "name": "ContactAgent",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        944,
        1168
      ]
    },
    {
      "id": "0e3be517-996f-47c0-b169-664e91d13a75",
      "name": "Telegram Trigger2",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -688,
        944
      ]
    },
    {
      "id": "d2fdac2e-b342-411c-9e40-12829bc238ef",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -256,
        928
      ]
    },
    {
      "id": "30852e6d-2aa2-457a-a53f-677ad9ce65fe",
      "name": "Get a file",
      "type": "n8n-nodes-base.telegram",
      "position": [
        64,
        768
      ]
    },
    {
      "id": "198795a8-f237-4b19-a833-3f6e92d301f7",
      "name": "OpenAI2",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        240,
        768
      ]
    },
    {
      "id": "cad03fd3-d8fe-4242-bbab-5f97993376a0",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        -480,
        944
      ]
    },
    {
      "id": "e4d12df9-764e-4f79-a62c-2a6d4efd57e5",
      "name": "No Operation, do nothing1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -464,
        1184
      ]
    },
    {
      "id": "5cc9e7a6-9c3f-461a-9e0a-08cb5338c026",
      "name": "Switch2",
      "type": "n8n-nodes-base.switch",
      "position": [
        -64,
        928
      ]
    },
    {
      "id": "08a1355b-e837-4d0b-8a2d-c0dfe08a2b4d",
      "name": "Lucy",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        992,
        944
      ]
    },
    {
      "id": "abeddc9a-0449-4679-93fc-eeff5be7bd87",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        624,
        1168
      ]
    },
    {
      "id": "ea2241de-b447-47a4-a2aa-9ef625f17151",
      "name": "Auto-fixing Output Parser2",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        2224,
        624
      ]
    },
    {
      "id": "f4898385-3728-4dcf-b8df-ab67268c29ed",
      "name": "OpenAI Chat Model8",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2000,
        848
      ]
    },
    {
      "id": "1d7169a2-6745-462a-b821-1d68a2cdb09c",
      "name": "Structured Output Parser2",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2288,
        832
      ]
    },
    {
      "id": "60f7a4f6-0dd0-4835-8132-597b9aad2357",
      "name": "Wait5",
      "type": "n8n-nodes-base.wait",
      "position": [
        2896,
        336
      ]
    },
    {
      "id": "04763596-1f66-477f-b7ce-8786d8e3412d",
      "name": "Wait6",
      "type": "n8n-nodes-base.wait",
      "position": [
        3536,
        336
      ]
    },
    {
      "id": "39ee5e66-7e2e-4e35-bba8-94a5021f84ab",
      "name": "Wait7",
      "type": "n8n-nodes-base.wait",
      "position": [
        4160,
        352
      ]
    },
    {
      "id": "40376b08-db4f-4865-8d0d-4e72194ecd4f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        -400
      ],
      "parameters": {
        "width": 1040,
        "height": 992,
        "content": "## Who this template is for\n\nThis workflow is designed for users who want to turn Telegram into a personal AI-powered assistant capable of handling everyday tasks through natural language. It is ideal"
      }
    },
    {
      "id": "584eb6ea-e2e1-4fe0-96d6-b03ac0653d48",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        1152
      ],
      "parameters": {
        "width": 512,
        "height": 128,
        "content": "## B. Sticky: “Message type detection”\n\nThis step detects whether the incoming Telegram message is text or voice and routes the workflow accordingly."
      }
    },
    {
      "id": "646059f7-6bed-4cb3-9e02-e14c5fa8d874",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        1152
      ],
      "parameters": {
        "width": 400,
        "height": 240,
        "content": "## A. Sticky: “Workflow entry & user validation”\n\nThis section listens for incoming Telegram messages and validates the sender.\n\nOnly authorized user IDs are allowed to continue. Unauthorized messages"
      }
    },
    {
      "id": "395d9995-1e6d-499c-87a8-ca73da44cd29",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        1328
      ],
      "parameters": {
        "width": 400,
        "height": 272,
        "content": "## C. Sticky: “AI personal assistant agent”\n\nThis is the core AI agent. It uses an OpenAI chat model, short-term memory, and multiple tools to understand user requests and execute actions such as send"
      }
    },
    {
      "id": "2eb4e873-a24d-4b43-a29f-8c4f4ba6db16",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2528,
        1088
      ],
      "parameters": {
        "width": 400,
        "height": 208,
        "content": "## D. Sticky: “Response formatting and delivery”\n\nThe assistant response is cleaned and formatted before delivery. Depending on the output type, the response is sent as plain text or converted into au"
      }
    },
    {
      "id": "c4d6afe4-241d-4452-b885-7cc186fb1a29",
      "name": "Text Message",
      "type": "n8n-nodes-base.set",
      "position": [
        240,
        944
      ]
    },
    {
      "id": "5c19d85b-1035-4aab-873e-74923e4c5486",
      "name": "audio message",
      "type": "n8n-nodes-base.set",
      "position": [
        416,
        768
      ]
    },
    {
      "id": "c209d9f7-0454-45f0-bfbd-9cb4e1361ec4",
      "name": "Clean Message",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        944
      ]
    },
    {
      "id": "8839cbf8-6a95-4fd8-80cd-727558d7f4b0",
      "name": "final message",
      "type": "n8n-nodes-base.set",
      "position": [
        784,
        944
      ]
    },
    {
      "id": "0e4eb989-c94f-4bc4-81a0-2c7337db0015",
      "name": "transform text",
      "type": "n8n-nodes-base.code",
      "position": [
        1312,
        944
      ]
    },
    {
      "id": "65e8ed72-30a4-4f3b-a7d8-d2a868578609",
      "name": "swich",
      "type": "n8n-nodes-base.code",
      "position": [
        1504,
        944
      ]
    },
    {
      "id": "5a5b50a5-cf24-4548-b4dc-f985273d47fd",
      "name": "path",
      "type": "n8n-nodes-base.if",
      "position": [
        1696,
        944
      ]
    },
    {
      "id": "cbe9a08b-b570-407a-9a41-e0cf8abd20a3",
      "name": "message breakdown",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2000,
        448
      ]
    },
    {
      "id": "26e9a797-e9fc-4e65-baf0-2bd69f1d1f01",
      "name": "message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3408,
        960
      ]
    },
    {
      "id": "493612f4-f5b7-4303-8691-ebbe79e8c403",
      "name": "1st bubble",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2480,
        448
      ]
    },
    {
      "id": "06512c43-4276-460a-8a49-7c44101b8407",
      "name": "2nd?",
      "type": "n8n-nodes-base.if",
      "position": [
        2688,
        448
      ]
    },
    {
      "id": "f33a0ef5-3ac0-48e6-a360-ff9d83815699",
      "name": "3rd?",
      "type": "n8n-nodes-base.if",
      "position": [
        3296,
        464
      ]
    },
    {
      "id": "12edb49c-ef12-4eeb-83fa-8711a9f83906",
      "name": "2nd bubble",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3104,
        336
      ]
    },
    {
      "id": "9e3d28b3-67c4-42a6-8cf9-a92e7a0a0973",
      "name": "3rd bubble",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3728,
        336
      ]
    },
    {
      "id": "0ae532d3-d604-46a0-8578-6171fe31d8fb",
      "name": "4th?",
      "type": "n8n-nodes-base.if",
      "position": [
        3936,
        480
      ]
    },
    {
      "id": "cf710ea4-1aa6-404b-b1b6-9c77e5f9ca51",
      "name": "4th bubble",
      "type": "n8n-nodes-base.telegram",
      "position": [
        4352,
        352
      ]
    }
  ],
  "connections": {
    "If1": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2nd?": {
      "main": [
        [
          {
            "node": "Wait5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "3rd?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3rd?": {
      "main": [
        [
          {
            "node": "Wait6",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "4th?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4th?": {
      "main": [
        [
          {
            "node": "Wait7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lucy": {
      "main": [
        [
          {
            "node": "transform text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "path": {
      "main": [
        [
          {
            "node": "message breakdown",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "Lucy",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wait5": {
      "main": [
        [
          {
            "node": "2nd bubble",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait6": {
      "main": [
        [
          {
            "node": "3rd bubble",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait7": {
      "main": [
        [
          {
            "node": "4th bubble",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "swich": {
      "main": [
        [
          {
            "node": "path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI2": {
      "main": [
        [
          {
            "node": "audio message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch2": {
      "main": [
        [
          {
            "node": "Get a file",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Text Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1st bubble": {
      "main": [
        [
          {
            "node": "2nd?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2nd bubble": {
      "main": [
        [
          {
            "node": "3rd?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3rd bubble": {
      "main": [
        [
          {
            "node": "4th?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "Lucy",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get a file": {
      "main": [
        [
          {
            "node": "OpenAI2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Switch2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Agent": {
      "ai_tool": [
        [
          {
            "node": "Lucy",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "ContactAgent": {
      "ai_tool": [
        [
          {
            "node": "Lucy",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Text Message": {
      "main": [
        [
          {
            "node": "Clean Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CalendarAgent": {
      "ai_tool": [
        [
          {
            "node": "Lucy",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Clean Message": {
      "main": [
        [
          {
            "node": "final message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ResearchAgent": {
      "ai_tool": [
        [
          {
            "node": "Lucy",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Lucy",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "audio message": {
      "main": [
        [
          {
            "node": "Clean Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "final message": {
      "main": [
        [
          {
            "node": "Lucy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "transform text": {
      "main": [
        [
          {
            "node": "swich",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger2": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "message breakdown": {
      "main": [
        [
          {
            "node": "1st bubble",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Lucy",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model8": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser2",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "message breakdown",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser2": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser2",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser2": {
      "ai_outputParser": [
        [
          {
            "node": "message breakdown",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}