This workflow turns a Telegram bot into a fully functional personal AI assistant capable of handling your schedule and inbox through natural conversation. Send it a text message, record a voice note, or snap a photo — it understands all three and responds intelligently.
The assistant is powered by Claude Haiku (via OpenRouter) and comes with a built-in 30-message memory buffer, so it remembers context across a conversation just like a real assistant would. It has full read/write access to Google Calendar and Gmail, meaning it can book meetings, check your availability, send emails, reply to threads, and clean up your inbox — all from a single Telegram chat.
Multi-modal input handling
All three input types are normalized into a unified context object before reaching the agent, so the AI always receives clean, structured input regardless of how the user communicated.
Authorization layer
Only the allowlisted Telegram User ID can interact with the assistant. Any unauthorized message receives an instant rejection and the workflow stops — no agent calls are made.
AI agent with tools
The LangChain agent receives the full context and decides autonomously whether to reply conversationally or invoke one of the connected tools. It uses the current date/time from n8n to handle scheduling requests accurately.
Google Calendar tools: check availability, create events, list upcoming events, fetch a specific event, update event details, delete events.
Gmail tools: send new emails, search the inbox, read a specific email, reply to a thread, delete messages.
Persistent memory
Each user's conversation is tracked using a sliding window of the last 30 messages, keyed by their Telegram User ID. The assistant remembers what was said earlier in the same session without needing reminders.
If node and replace the placeholder value with your own Telegram numeric User ID. You can find this by messaging @userinfobot on Telegram.If node with a list-based check or a Code node that checks against an array of allowed IDs.contextWindowLength value in the Simple Memory node (currently 30 messages).