Your Telegram AI Assistant Can Email Anyone as You: 6 Checks to Run Before the Model Does
Description and use
A Telegram bot that sends emails on behalf of a user is protected against unauthorized use, duplicate processing, stale messages, costly transcription, ambiguous contacts, and time‑zone errors before invoking the AI model.
Problem
A Telegram bot that can send emails on behalf of a user must guard against unauthorized use, duplicate processing, stale messages, costly operations, ambiguous contacts, and time zone errors before invoking the AI model.
Outcome
The workflow prevents unauthorized email sending, duplicate processing, costly transcription, ambiguous contact resolution, and time zone misinterpretation, enabling a safe Telegram AI assistant.
Workflow
- Receive Telegram update via webhook
- Guard API checks chat ID allowlist
- Atomic deduplication of update_id
- Reject messages older than 10 minutes
- Reject voice notes longer than 120 seconds
- If voice, download and transcribe with Whisper
- Send prompt to AI Agent with tools: contacts, calendar, email
- Agent replies on Telegram
Evidence
The first node after the trigger asks the API one question: may this update run at all?
Atomic dedup on update_id
I also ran the whole n8n workflow locally (n8n 2.43.8) against the real API, with a fake Telegram, OpenAI and Google.
- Record date: 2026-11-02T07:13:47.458Z