Telegram to Gmail, inbox actions from chat commands
Your inbox gets messy in the boring ways. You spot an email, you mean to reply, then you get pulled into something else, and suddenly it’s tomorrow.
Sales reps feel it when leads go cold. Freelancers feel it when “quick replies” turn into a nightly cleanup ritual. Even YouTubers managing viewer requests end up doing the same thing: too many Gmail clicks, not enough follow-through. This Telegram Gmail automation fixes that.
You send a simple Telegram command, the workflow interprets what you mean, and Gmail gets handled. Below you’ll see what it automates, what results you can expect, and how to adapt it to your labels and contact list.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Telegram to Gmail, inbox actions from chat commands
flowchart LR
subgraph sg0["When chat message received Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "When chat message received", pos: "b", h: 48 }
n1@{ icon: "mdi:robot", form: "rounded", label: "AI Agent", pos: "b", h: 48 }
n2@{ icon: "mdi:message-outline", form: "rounded", label: "Send", pos: "b", h: 48 }
n3@{ icon: "mdi:message-outline", form: "rounded", label: "Reply", pos: "b", h: 48 }
n4@{ icon: "mdi:message-outline", form: "rounded", label: "Label", pos: "b", h: 48 }
n5@{ icon: "mdi:message-outline", form: "rounded", label: "Delete", pos: "b", h: 48 }
n6@{ icon: "mdi:message-outline", form: "rounded", label: "Get Many", pos: "b", h: 48 }
n7@{ icon: "mdi:database", form: "rounded", label: "Sheet", pos: "b", h: 48 }
n8@{ icon: "mdi:brain", form: "rounded", label: "Gemini", pos: "b", h: 48 }
n9@{ icon: "mdi:memory", form: "rounded", label: "Memory", pos: "b", h: 48 }
n2 -.-> n1
n4 -.-> n1
n3 -.-> n1
n7 -.-> n1
n5 -.-> n1
n8 -.-> n1
n9 -.-> n1
n6 -.-> n1
n0 --> n1
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0 trigger
class n1 ai
class n8 aiModel
class n9 ai
class n7 database
The Problem: Inbox Actions Take Too Many Clicks
Most inbox “management” isn’t strategy. It’s micro-actions. Find the thread, open it, search for the right person, copy an address, remember your label naming, then do it all again for the next message. Multiply that by a handful of leads, a few client emails, and the random “can we hop on a call?” requests. You spend an hour doing tiny tasks and still feel behind. Worse, mistakes creep in: the wrong label, the wrong thread, or a follow-up that never gets sent because it wasn’t easy to do in the moment.
The friction compounds.
- You delay replies because “I’ll do it when I’m back at my desk” turns into tomorrow.
- Important emails don’t get labeled consistently, so you can’t triage fast when things get busy.
- You waste time hunting for email addresses when you only have a first name or a vague memory.
- Deleting spam or cleaning up clutter becomes a separate task you keep avoiding.
The Solution: Telegram Commands That Run Gmail Actions
This n8n workflow turns Telegram into a lightweight control panel for Gmail. You send a message like “Reply to John with a follow-up about the project” or “Label Sarah’s email as potential-client,” and an AI agent interprets what you want. If you only provide a name, it checks Google Sheets to find the matching email address. Then it executes the right Gmail action: send, reply, apply a label, delete, or fetch emails. A conversation memory keeps context, which means you can give short follow-ups like “Use a friendlier tone” without re-explaining everything.
The workflow starts with a Telegram chat trigger. From there, Gemini (via the chat model) helps the agent understand your intent and choose the right Gmail tool. Finally, Gmail updates happen immediately, and you stay in Telegram instead of bouncing between tabs.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you handle about 20 customer or lead emails a week, and you do three quick actions per email (reply, label, sometimes delete or fetch context). Manually, that’s roughly 2 minutes per action once you include finding the thread and switching tools, so about 2 hours weekly. With this workflow, you can trigger most actions from Telegram in under 30 seconds, then wait for the agent to process. That usually turns into about 30 minutes of total “hands-on” time, which means you keep roughly 90 minutes to 2 hours.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Telegram for sending commands from your phone.
- Gmail to run send, reply, label, delete, fetch.
- Google Sheets to store names and email addresses.
- Gemini API key (get it from Google AI Studio).
Skill level: Intermediate. You’ll connect accounts (OAuth) and edit labels and prompts carefully.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A Telegram message triggers the workflow. You type a natural command (“Reply to the latest email from Sarah…”) and send it to your Telegram bot/chat.
The AI agent interprets intent and context. Gemini reads your message, checks recent conversation memory, and decides which Gmail action fits (reply vs. label vs. fetch, etc.).
Contacts resolve through Google Sheets when needed. If you say “Reply to John” but don’t include an address, the workflow looks up John in your Sheet. If he isn’t there, it can prompt you to add him so the next command is instant.
Gmail actions run and the result is returned. The workflow uses the right Gmail tool to send, reply, apply labels like sales-inquiry, remove a message, or retrieve a batch of emails for review.
You can easily modify Gmail labels to match your pipeline, or change the contact source from Google Sheets to a CRM later. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Chat Trigger
Set up the workflow entry point so incoming chat messages can initiate Gmail actions.
- Add the Inbound Chat Trigger node as your trigger.
- Keep the default Options (no custom settings required unless you want to refine the trigger behavior).
- Connect Inbound Chat Trigger to Email Operations Agent.
Step 2: Connect Gmail and Google Sheets
These AI tools perform Gmail actions and Google Sheets lookups on behalf of the agent. Add credentials on the parent node connection.
- For all Gmail tool nodes (Dispatch Email, Respond to Email, Apply Mail Labels, Remove Message, Retrieve Messages), attach Gmail credentials on Email Operations Agent (not on the tool nodes themselves).
- For Lookup Sheet Records, attach Google Sheets credentials on Email Operations Agent (not on the tool node).
- In Lookup Sheet Records, set Document to
[YOUR_ID]and Sheet toSheet1.
Step 3: Set Up the AI Agent and Memory
Configure the agent’s instructions, connect the language model, and enable conversation memory to maintain context.
- Open Email Operations Agent and set System Message to:
=You are a smart Gmail assistant.
Instructions:
For any Gmail-related task, use the appropriate Gmail tool (Send, Reply, Label, Delete, Retrieve).
If only a name is given (no email), fetch the email from Google Sheets.
Auto-complete any missing details needed for emails or replies.
Apply relevant labels when appropriate.
Stay efficient, accurate, and helpful at all times. - Connect Gemini Chat Model to Email Operations Agent as the language model.
- Connect Conversation Buffer to Email Operations Agent for memory.
Step 4: Configure Gmail Action Tools
These tools are invoked by the agent and require the correct AI-driven expressions.
- In Dispatch Email, set Send To to
={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}, Subject to={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}, Message to={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}, and Email Type totext. - In Respond to Email, set Operation to
reply, Message ID to={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}, and Message to={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}. - In Apply Mail Labels, set Operation to
addLabels, Label IDs to={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Label_Names_or_IDs', ``, 'string') }}, and Message ID to={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}. - In Remove Message, set Operation to
deleteand Message ID to={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message_ID', ``, 'string') }}. - In Retrieve Messages, set Operation to
getAll, Simplify to={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Simplify', ``, 'boolean') }}, and Return All to={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}.
Step 5: Test and Activate Your Workflow
Verify the chat-to-Gmail pipeline works as expected and then enable the workflow.
- Click Execute Workflow and send a test chat message through Inbound Chat Trigger (e.g., “Email John about the meeting at 3 PM”).
- Confirm Email Operations Agent selects the correct Gmail tool and that the Gmail action completes.
- If you request a lookup by name, verify Lookup Sheet Records returns the expected email from the Google Sheet.
- When results are correct, toggle the workflow to Active so it can run in production.
Common Gotchas
- Gmail OAuth credentials can expire or lose permissions. If replies or labeling suddenly fail, check the Gmail credential connection in n8n first and re-authenticate.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Gemini outputs can be a little “corporate” by default. Update the agent instructions early with your tone and preferred sign-offs, or you’ll be rewriting drafts every day.
Frequently Asked Questions
About 30 minutes if your Gmail, Telegram, and Sheets accounts are ready.
No. You’ll mostly connect accounts and adjust a few prompts and labels. The “logic” is already built into the workflow.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Gemini API costs (billed per token, so it depends on message length).
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you probably should. Add or rename Gmail labels (like “Invoices” or “Support Tickets”) and update the agent instructions so it uses the same wording. You can also extend the agent to support batch requests such as “Archive all emails older than 30 days,” which usually means adding another Gmail tool action and a simple condition to confirm you really want bulk changes. If your contacts live somewhere other than Google Sheets, swap the lookup step to Airtable, Notion, or your CRM.
Usually it’s expired OAuth access or missing Gmail permissions after a security change. Reconnect the Gmail credential in n8n, then re-test a simple “fetch latest email” command. If it fails only during busy periods, you may be hitting rate limits or pulling too many messages at once.
Plenty for a small team.
It depends on how “chatty” and context-based you want the experience to be. Zapier and Make are great for simple triggers like “new email → add row,” but this workflow relies on an AI agent, memory, and multiple Gmail actions that can branch based on what you type. n8n handles that style of logic cleanly, and self-hosting avoids per-task pricing when usage grows. If you only need one action (like labeling everything that matches a rule), a simpler tool can be enough. If you want to run your inbox from Telegram and keep context across messages, this is the better fit. Talk to an automation expert if you want a quick recommendation for your exact setup.
Once this is running, inbox work stops being a place you get stuck. You send the command, Gmail gets handled, and you move on.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.