{
  "name": "Multilingual voice & text Telegram bot with ElevenLabs TTS and LangChain agents",
  "nodes": [
    {
      "id": "83497222-5524-4f63-9e45-b1bfe3397de1",
      "name": "Telegram Input",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1680,
        -60
      ]
    },
    {
      "id": "743ec068-df01-4bcb-89a4-499da2de1c58",
      "name": "Adds SessionId",
      "type": "n8n-nodes-base.set",
      "position": [
        -1500,
        -60
      ]
    },
    {
      "id": "9bbb8ed4-2458-4072-98bc-ccde13b80af0",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1320,
        -60
      ]
    },
    {
      "id": "a5e0c4a8-041e-4252-8a77-7f090e565a5c",
      "name": "Get Voice File",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1120,
        -160
      ]
    },
    {
      "id": "3fe6c7c4-28ee-4bdb-9db6-67fd4b486b64",
      "name": "Transcribe ElevenLabs",
      "type": "@elevenlabs/n8n-nodes-elevenlabs.elevenLabs",
      "position": [
        -980,
        -160
      ]
    },
    {
      "id": "c8520675-e456-4ac6-9959-81068c371bd4",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -840,
        -160
      ]
    },
    {
      "id": "3eb68b11-1cca-4d03-ba1a-8f4e81199148",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -620,
        -60
      ]
    },
    {
      "id": "5f477900-a311-4b6e-ba2c-7a5460937978",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -720,
        200
      ]
    },
    {
      "id": "4948f23a-ddde-4973-963c-cfe1aec5119a",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -560,
        200
      ]
    },
    {
      "id": "dddd3d08-b63c-4a64-9def-e694ca2efd47",
      "name": "Voice Assistant",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -420,
        -60
      ]
    },
    {
      "id": "b459ce91-2261-4fc4-8cc0-8e39d2093512",
      "name": "If voice",
      "type": "n8n-nodes-base.if",
      "position": [
        -60,
        -60
      ]
    },
    {
      "id": "73d99c4c-c968-44ef-9196-94e5b372051c",
      "name": "ElevenLabs",
      "type": "@elevenlabs/n8n-nodes-elevenlabs.elevenLabs",
      "position": [
        160,
        -160
      ]
    },
    {
      "id": "4b661df9-08fc-498f-ae5f-945956120287",
      "name": "Telegram Send Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        160,
        20
      ]
    },
    {
      "id": "b68da635-54b8-4c42-8c72-2b12cc805b12",
      "name": "Telegram send voice message",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        380,
        -160
      ]
    },
    {
      "id": "420ec75a-87e4-4d29-b4b7-81299cc42760",
      "name": "Voice Assistant Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -420,
        200
      ]
    },
    {
      "id": "73674764-4bfd-4fc1-91ad-42ad03aae79d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -300
      ],
      "parameters": {
        "width": 300,
        "height": 180,
        "content": "**Auto-language detection**:  \n- Uses `message.from.language_code` (e.g., \"ru\", \"es\")  \n- Ensure ElevenLabs model = `eleven_multilingual_v2`  \n- Override with `languageCode` in TTS node if needed  "
      }
    },
    {
      "id": "6a439698-ca32-4188-a6ba-ac427cf995eb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1400,
        120
      ],
      "parameters": {
        "width": 300,
        "height": 300,
        "content": "🎙️ Voice/Text Routing Logic\n\n**How messages are processed:**\n\n- **Voice Message Path:**\n  1. Get voice file → ElevenLabs STT → Set `voice=true` flag\n  2. AI processes text → ElevenLabs TTS → Send voic"
      }
    },
    {
      "id": "d12487ce-023d-468d-9204-ebf4d86df3d8",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        140
      ],
      "parameters": {
        "width": 380,
        "height": 440,
        "content": "## 🛠️ Custom Tools Integration\n\n**To add your own tools:**\n1. Edit `systemMessage` in Voice Assistant node\n2. Add tool descriptions in format:\n```python\nTool(\n    name=\\\"YourTool\\\",\n    func=tool_func"
      }
    }
  ],
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Get Voice File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If voice": {
      "main": [
        [
          {
            "node": "ElevenLabs",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram Send Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Voice Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ElevenLabs": {
      "main": [
        [
          {
            "node": "Telegram send voice message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Adds SessionId": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Voice File": {
      "main": [
        [
          {
            "node": "Transcribe ElevenLabs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        []
      ]
    },
    "Voice Assistant": {
      "main": [
        [
          {
            "node": "If voice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe ElevenLabs": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Voice Assistant Memory": {
      "ai_memory": [
        [
          {
            "node": "Voice Assistant",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Voice Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}