Telegram + Gmail: find the right email from chat
Your inbox is full, but the real problem is the hunting. You remember “that email from Amazon about invoices” and then you waste time flipping into Gmail, guessing search operators, and opening five almost-right threads.
This Telegram Gmail search automation hits founders and marketers first because they live in chat all day, but ops folks feel it too. Instead of context switching, you ask for an email like you’d ask a teammate, and the right message comes back ready to skim.
Below you’ll see how the workflow turns a Telegram message into a Gmail query, retrieves matches, and sends clean summaries back to Telegram in seconds.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Telegram + Gmail: find the right email from chat
flowchart LR
subgraph sg0["Incoming Telegram Request Flow"]
direction LR
n0["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Incoming Telegram Request"]
n1@{ icon: "mdi:robot", form: "rounded", label: "Request Analysis Agent", pos: "b", h: 48 }
n2@{ icon: "mdi:brain", form: "rounded", label: "Gemini Chat Engine A", pos: "b", h: 48 }
n3@{ icon: "mdi:robot", form: "rounded", label: "Parse Request Schema", pos: "b", h: 48 }
n4@{ icon: "mdi:swap-vertical", form: "rounded", label: "Map Search Parameters", pos: "b", h: 48 }
n5@{ icon: "mdi:robot", form: "rounded", label: "Compose Gmail Query", pos: "b", h: 48 }
n6@{ icon: "mdi:brain", form: "rounded", label: "Gemini Chat Engine B", pos: "b", h: 48 }
n7@{ icon: "mdi:robot", form: "rounded", label: "Parse Gmail Query", pos: "b", h: 48 }
n8@{ icon: "mdi:message-outline", form: "rounded", label: "Retrieve Gmail Messages", pos: "b", h: 48 }
n9@{ icon: "mdi:swap-vertical", form: "rounded", label: "Prepare Response Fields", pos: "b", h: 48 }
n10@{ icon: "mdi:robot", form: "rounded", label: "Format Telegram Summary", pos: "b", h: 48 }
n11@{ icon: "mdi:brain", form: "rounded", label: "Gemini Chat Engine C", pos: "b", h: 48 }
n12@{ icon: "mdi:robot", form: "rounded", label: "Parse Telegram Text", pos: "b", h: 48 }
n13["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Send Telegram Reply"]
n1 --> n4
n5 --> n8
n10 --> n13
n8 --> n9
n6 -.-> n5
n3 -.-> n1
n11 -.-> n10
n2 -.-> n1
n7 -.-> n5
n12 -.-> n10
n9 --> n10
n0 --> n1
n4 --> n5
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,n3,n5,n7,n10,n12 ai
class n2,n6,n11 aiModel
classDef customIcon fill:none,stroke:none
class n0,n13 customIcon
The Problem: Finding one email shouldn’t feel like detective work
Searching email sounds simple until you are doing it mid-call, on your phone, or between tasks. You jump into Gmail, type a fuzzy search, then you get 200 results because you didn’t remember the exact subject line. So you try again with from:, after:, quotes, filters, and a little trial-and-error. Meanwhile your focus is gone. Worse, you sometimes miss the right thread entirely, reply to the wrong one, or forward stale info because you grabbed an older email that “looked close.” Honestly, it’s not hard. It’s just constant.
The friction compounds. Here’s where it breaks down in real life:
- You spend about 10 minutes per search when you include opening Gmail, filtering, and scanning threads.
- Gmail search syntax is powerful, but most people don’t use it consistently, which means results are noisy.
- On mobile, even “quick checks” turn into a slow scroll-fest through long threads and previews.
- Important requests get delayed because you tell yourself you’ll “look it up later,” and later never comes.
The Solution: Ask Telegram, get the right Gmail email back
This workflow turns Telegram into a conversational front door for Gmail. You message a Telegram bot with a plain-English request like “show unread emails from Amazon about invoices after June 1” and the workflow figures out what you meant. An AI agent extracts the sender, keywords, and date filters, then a second AI step converts that into proper Gmail search syntax. Next, n8n retrieves matching emails from your Gmail account, prepares a neat set of fields (date, sender, subject, snippet), and formats each result into a skim-friendly Telegram message. Finally, the bot replies directly in the chat, one email per message, so you can scan fast and move on.
The workflow starts with a Telegram message. From there, AI translates your request into a clean Gmail query and pulls the matching messages. Then it formats the results and sends them right back into Telegram so you never leave the conversation.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you do about 10 “where is that email?” searches a week. Manually, if each one takes roughly 10 minutes between opening Gmail, trying filters, and scanning threads, that’s about 100 minutes gone. With this workflow, you send a Telegram message in maybe 20 seconds, wait a short moment for the AI to interpret it, and you get a set of skimmable results back in Telegram. Even if it takes a minute end-to-end, you’re getting more than an hour back most weeks.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Telegram bot to receive your chat requests
- Gmail account to search and retrieve messages
- Google Gemini or OpenAI API key (get it from your Gemini/OpenAI account settings)
Skill level: Beginner. You’ll connect accounts, paste an API key, and test a few sample searches.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A Telegram message triggers everything. You send a request to your bot like “unread emails from Amazon after June 1,” and n8n catches it instantly via the Telegram Trigger.
The request gets interpreted into search fields. An AI agent reads your message, then a structured parser pulls out the pieces (sender, keywords, dates) so the workflow isn’t guessing later.
The workflow composes a real Gmail query. Using those extracted fields, it generates Gmail-friendly syntax (for example, from:amazon AND after:2025/06/01) and validates it before searching.
Results are pulled and formatted for skimming. n8n retrieves the matching messages from Gmail, prepares a tidy set of fields, and an AI formatting step turns each one into a readable Telegram summary.
You can easily modify the output format to include more context (like labels or the full body) based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Telegram Trigger
Set up the Telegram trigger so the workflow can receive incoming messages and start the email retrieval process.
- Add or open Incoming Telegram Request and confirm it listens for Updates set to
message. - Credential Required: Connect your
telegramApicredentials in Incoming Telegram Request. - Copy the webhook URL from Incoming Telegram Request after credentials are connected to register it with your Telegram bot.
Step 2: Connect Gmail
Configure Gmail access to retrieve the most relevant unread messages based on the AI-generated query.
- Open Retrieve Gmail Messages and set Operation to
getAll. - Set Limit to
10. - Configure Filters → Q to
{{ $json.output.search }}. - Set Filters → Sender to
{{ $('Map Search Parameters').item.json.Sender }}. - Set Filters → Read Status to
unread. - Set Filters → Received After to
{{ $('Map Search Parameters').item.json.afterDate }}and Filters → Received Before to{{ $('Map Search Parameters').item.json.beforeDate }}. - Credential Required: Connect your
gmailOAuth2credentials in Retrieve Gmail Messages.
Step 3: Set Up the Request Parsing and Search Mapping
Configure the AI agent and mapping so user requests become structured search parameters.
- Open Request Analysis Agent and set Text to the provided prompt, ensuring it includes
{{ $json.message.text }}. - Confirm Parse Request Schema is connected as the output parser for Request Analysis Agent.
- Open Map Search Parameters and set assignments: Sender to
{{ $json.output.sender }}, Keywords/Prompt/Criteria to{{ $json.output.keywords }}, afterDate to{{ $json.output.afterDate }}, and beforeDate to{{ $json.output.beforeDate }}. - Ensure Gemini Chat Engine A is connected as the language model for Request Analysis Agent.
- Credential Required: Connect your
googlePalmApicredentials in Gemini Chat Engine A (credentials should be added to the language model node, not Parse Request Schema).
Step 4: Build the Gmail Query and Retrieve Messages
Use the second AI chain to transform the request into Gmail search syntax, then retrieve matching emails.
- Open Compose Gmail Query and keep Text as the provided prompt that includes
{{ $('Incoming Telegram Request').item.json.message.text }}. - Confirm Parse Gmail Query is connected as the output parser for Compose Gmail Query.
- Ensure Gemini Chat Engine B is connected as the language model for Compose Gmail Query.
- Credential Required: Connect your
googlePalmApicredentials in Gemini Chat Engine B (credentials should be added to the language model node, not Parse Gmail Query).
Step 5: Format the Telegram Summary and Send the Reply
Normalize Gmail fields, generate a formatted summary with the AI chain, and send the response back to Telegram.
- Open Prepare Response Fields and map fields: Date to
{{ new Date(Number($json.internalDate)).toISOString() }}, From to{{ $json.From }}, Subject to{{ $json.Subject }}, and snippet to{{ $json.snippet }}. - Open Format Telegram Summary and keep Text as the provided prompt containing
{{ $json.Date }},{{ $json.From }},{{ $json.Subject }}, and{{ $json.snippet }}. - Confirm Parse Telegram Text is connected as the output parser for Format Telegram Summary.
- Ensure Gemini Chat Engine C is connected as the language model for Format Telegram Summary.
- Credential Required: Connect your
googlePalmApicredentials in Gemini Chat Engine C (credentials should be added to the language model node, not Parse Telegram Text). - Open Send Telegram Reply and set Text to
{{ $json.output.text }}and Chat ID to{{ $('Incoming Telegram Request').item.json.message.chat.id }}. - Credential Required: Connect your
telegramApicredentials in Send Telegram Reply.
text and that Send Telegram Reply maps to {{ $json.output.text }}.Step 6: Test and Activate Your Workflow
Run a manual test to ensure the workflow parses user requests, queries Gmail, and returns a formatted summary.
- Click Execute Workflow and send a Telegram message like “Get emails from Amazon after 2024-06-10 about returns.”
- Confirm Request Analysis Agent outputs structured JSON and Compose Gmail Query generates a valid Gmail search.
- Check Retrieve Gmail Messages for up to
10unread results and verify Prepare Response Fields output containsDate,From,Subject, andsnippet. - Verify that Send Telegram Reply posts a formatted response message back to the Telegram chat.
- Enable the workflow by switching it to Active for production use.
Common Gotchas
- Gmail credentials can expire or need specific permissions. If things break, check your n8n Gmail credential status and re-authorize the Google account first.
- If you add Wait nodes (or your AI provider responds slowly), processing times vary. Bump up the wait duration if downstream formatting runs before the email list arrives.
- Default prompts in AI nodes are generic. Add your preferred summary style and what to include (date, sender, snippet length) early or you’ll be editing outputs forever.
Frequently Asked Questions
About 30 minutes if your Telegram bot and Google login are ready.
No. You’ll mostly connect accounts and paste in an API key. The workflow logic is already built.
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 or OpenAI API usage (usually small for short prompts).
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 it’s one of the best parts. You can adjust what gets shown in Telegram by editing the “Prepare Response Fields” step and the AI prompt used in “Format Telegram Summary.” Common tweaks include showing more of the body, adding Gmail labels, limiting to the latest 5 emails, or changing the tone to match your brand voice.
Usually it’s the bot token. Recheck the token from BotFather, then confirm it’s saved in the correct Telegram credential inside n8n. If Telegram messages still don’t arrive, confirm the workflow is active and that your trigger is pointing to the right bot.
A lot, but you should set limits so Telegram doesn’t get spammy.
Often, yes, because this needs more than a simple trigger and action. You’re using an AI agent, structured parsing, and multi-step formatting, and n8n handles that kind of branching cleanly without turning into a pile of paid “tasks.” Zapier or Make can still work if you want a very basic version, but you’ll usually hit limits when you try to refine the query logic. If you’re comparing options for your team’s volume and security needs, Talk to an automation expert and get a straight recommendation.
Once this is running, “find that email” stops being a mini-project. You stay in Telegram, get the answer, and keep moving.
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.