Back to templates
AI & Productivity

Telegram AI Assistant

Personal AI assistant via Telegram with voice support, Gmail, Google Calendar, and Google Tasks integration.

Telegram
AI Agent
Gmail
Google Calendar
Voice

About this template

Build your own AI-powered personal assistant that works through Telegram. Supports both voice and text messages, integrates with Gmail for email management, Google Calendar for scheduling, and Google Tasks for to-do management. Uses OpenRouter for flexible LLM selection and OpenAI for voice transcription.

Workflow JSON

{
  "name": "Telegram AI Assistant",
  "meta": {
    "instanceId": "template-instance-id"
  },
  "nodes": [
    {
      "id": "b70bab99-2919-42c0-a64f-ea8340503a81",
      "name": "Google Calendar",
      "type": "n8n-nodes-base.googleCalendarTool",
      "position": [
        3232,
        560
      ],
      "parameters": {
        "options": {
          "fields": "=items(summary, start(dateTime))",
          "timeMax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Before', ``, 'string') }}",
          "timeMin": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('After', ``, 'string') }}"
        },
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "=YOUR_EMAIL_HERE"
        },
        "operation": "getAll"
      },
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "YOUR_GOOGLE_CALENDAR_CREDENTIAL_ID",
          "name": "Google Calendar"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "621a4839-bc0d-4c73-b228-3831ad50ca3c",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        2016,
        560
      ],
      "parameters": {
        "sessionKey": "={{ $('Listen for incoming events').first().json.message.from.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.2
    },
    {
      "id": "89d9a5d9-d3c7-48c1-98cf-cc8987ba9391",
      "name": "Get Email",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        2800,
        560
      ],
      "parameters": {
        "limit": 20,
        "filters": {
          "labelIds": [
            "INBOX"
          ],
          "readStatus": "unread",
          "receivedAfter": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Received_After', ``, 'string') }}",
          "receivedBefore": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Received_Before', ``, 'string') }}"
        },
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "YOUR_GMAIL_CREDENTIAL_ID",
          "name": "Gmail"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "88f2bfc3-a997-4838-a4e6-911c60d377ec",
      "name": "Listen for incoming events",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        880,
        208
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "YOUR_TELEGRAM_CREDENTIAL_ID",
          "name": "Telegram"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fe37d04d-2bb4-4130-8386-665364195dce",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueErrorOutput",
      "position": [
        2688,
        192
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Listen for incoming events').first().json.message.from.id }}",
        "additionalFields": {
          "parse_mode": "Markdown",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "YOUR_TELEGRAM_CREDENTIAL_ID",
          "name": "Telegram"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "a5717776-2c85-4dfb-9e05-bf9b805f9004",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1328,
        208
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a0bf9719-4272-46f6-ab3b-eda6f7b44fd8",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "dc3d741a-2ed6-4c34-b14f-91a728b3fffd",
      "name": "Voice or Text",
      "type": "n8n-nodes-base.set",
      "position": [
        1104,
        208
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "text",
              "stringValue": "={{ $json?.message?.text || \"\" }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "7c7cbb13-8b9d-4e98-9287-4002166ff159",
      "name": "Get Voice File",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1552,
        128
      ],
      "parameters": {
        "fileId": "={{ $('Listen for incoming events').item.json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "YOUR_TELEGRAM_CREDENTIAL_ID",
          "name": "Telegram"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "8078f53c-0aed-4f01-bf8f-f0e65a8291c0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        96
      ],
      "parameters": {
        "color": 7,
        "width": 624,
        "height": 279,
        "content": "## Process Telegram Request\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9006e460-0a4f-4250-876c-1743d7526909",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1584,
        512
      ],
      "parameters": {
        "color": 3,
        "width": 294,
        "height": 316,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n1. [In OpenRouter](https://openrouter.ai/settings/keys) click **\"Create API key\"** and copy it.\n\n2. Open the ```OpenRouter``` node:\n   * **Select Credential → Create New**\n   * Paste into **API Key** and **Save**\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7e0fa1ed-2cd6-48a6-bf04-d67d4d7fe842",
      "name": "OpenRouter",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1680,
        544
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "YOUR_OPENROUTER_CREDENTIAL_ID",
          "name": "OpenRouter"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f326d185-cd53-421e-a3d1-ae3b0d162bfa",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1904,
        512
      ],
      "parameters": {
        "color": 7,
        "width": 308,
        "height": 260,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis node helps your agent remember the last few messages to stay on topic."
      },
      "typeVersion": 1
    },
    {
      "id": "48c06490-e261-45f5-ad0c-2b2648203ab0",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2240,
        512
      ],
      "parameters": {
        "color": 7,
        "width": 484,
        "height": 260,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis node allows your agent create and get tasks from Google Tasks\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8bb0d940-eda3-4ecf-8a1d-15b1a6445a83",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2752,
        512
      ],
      "parameters": {
        "color": 7,
        "width": 308,
        "height": 260,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis node allows your agent access your gmail\n"
      },
      "typeVersion": 1
    },
    {
      "id": "cf8916e8-4701-4644-9d92-e2dd78665448",
      "name": "Sticky Note19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3088,
        512
      ],
      "parameters": {
        "color": 7,
        "width": 404,
        "height": 260,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis node allows your agent access your Google calendar\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a5db0c52-ba8d-4622-8a0a-eae3a7f0d90f",
      "name": "Sticky Note20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        96
      ],
      "parameters": {
        "color": 7,
        "width": 324,
        "height": 276,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nUses OpenAI to convert voice to text.\n[In OpenAI](https://platform.openai.com/api-keys) click **\"Create new secret key\"** and copy it."
      },
      "typeVersion": 1
    },
    {
      "id": "fd8b069a-19da-4740-a3ce-d88ee0e81331",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2144,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 396,
        "height": 380,
        "content": "Your personal AI Assistant:\n1. Get email\n2. Check calendar\n3. Get and create to-do tasks \n\nEdit the **System Message** to adjust your agent's behavior and replies.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1c27ac6c-39d7-4f07-8134-624e1cb21e07",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        -32
      ],
      "parameters": {
        "color": 4,
        "width": 460,
        "height": 520,
        "content": "## Template by Harshith Vaddiparthy\n\n\n**Learn to Build AI Automations**\nMaster n8n, AI agents, and no-code automation in my comprehensive course.\n→ harshith.com/vibecode\n\n\n**Content Automation Consulting**\nI help businesses automate video creation, social media, blogs, and newsletters.\n→ harshith.com/meet\n\n\n**Connect with me**\n→ linkedin.com/in/harshith-vaddiparthy"
      },
      "typeVersion": 1
    },
    {
      "id": "fd801aac-5dfa-4a51-abbd-b187a6e588e8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2592,
        96
      ],
      "parameters": {
        "color": 7,
        "width": 304,
        "height": 288,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nSend message back to Telegram\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4a44f67a-65b1-4de7-898f-ee7724e33bb1",
      "name": "Create a task in Google Tasks",
      "type": "n8n-nodes-base.googleTasksTool",
      "position": [
        2336,
        576
      ],
      "parameters": {
        "task": "YOUR_TASK_LIST_ID",
        "title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', ``, 'string') }}",
        "additionalFields": {}
      },
      "credentials": {
        "googleTasksOAuth2Api": {
          "id": "YOUR_GOOGLE_TASKS_CREDENTIAL_ID",
          "name": "Google Tasks"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0262484e-23cc-49b3-be29-8f205e49077a",
      "name": "Get many tasks in Google Tasks",
      "type": "n8n-nodes-base.googleTasksTool",
      "position": [
        2528,
        576
      ],
      "parameters": {
        "task": "YOUR_TASK_LIST_ID",
        "operation": "getAll",
        "additionalFields": {}
      },
      "credentials": {
        "googleTasksOAuth2Api": {
          "id": "YOUR_GOOGLE_TASKS_CREDENTIAL_ID",
          "name": "Google Tasks"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3acacedb-bafa-4fbf-8d3e-f198b19b9308",
      "name": "Transcribe a recording",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1872,
        128
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "id": "YOUR_OPENAI_CREDENTIAL_ID",
          "name": "OpenAI"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "2ea5b79c-2e49-4d7e-933c-8b1a58d2415c",
      "name": "Send Email",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        2944,
        560
      ],
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', `Please format this nicely in html`, 'string') }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "YOUR_GMAIL_CREDENTIAL_ID",
          "name": "Gmail"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "4ec85126-51da-4f3b-a04f-16552fdcb244",
      "name": "AI Assistant",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2224,
        192
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "=You are a helpful personal assistant.\n\nToday's date is {{ $today.format('yyyy-MM-dd') }}.\n\nGuidelines:\n- When summarizing emails, include Sender, Message date, subject, and brief summary of email.\n- If the user did not specify a date in the request assume they are asking for today\n- When answering questions about calendar events, filter out events that don't match the question.\n- When creating calendar entry, the attendee email is optional"
        },
        "promptType": "define"
      },
      "typeVersion": 1.6
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Get Voice File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Email": {
      "ai_tool": [
        [
          {
            "node": "AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter": {
      "ai_languageModel": [
        [
          {
            "node": "AI Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send Email": {
      "ai_tool": [
        [
          {
            "node": "AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Voice or Text": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Voice File": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar": {
      "ai_tool": [
        [
          {
            "node": "AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Assistant",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "AI Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Listen for incoming events": {
      "main": [
        [
          {
            "node": "Voice or Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a task in Google Tasks": {
      "ai_tool": [
        [
          {
            "node": "AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many tasks in Google Tasks": {
      "ai_tool": [
        [
          {
            "node": "AI Assistant",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Assistant": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  }
}

Copy this JSON and import it into n8n via Settings → Import from File/URL → Paste JSON

Free n8n Automation Templates | Production-Ready Workflows | Harshith Vaddiparthy