Telegram + SparkPost: self-serve demo emails sent fast
Your “book a demo” flow looks fine on paper. In real life, it’s a mess of half-filled forms, vague requests, and follow-up emails you swear you’ll send “later.” Later turns into never.
This Telegram SparkPost emails automation hits agency owners first, because every inbound lead steals attention from delivery. But marketing leads and solo consultants feel the same drag when interest comes in bursts and you can’t respond fast enough.
This workflow turns a Telegram chat into a personalized “demo email” sent via SparkPost, with logging and guardrails built in. You’ll see how it works, what you need, and what to tweak so it matches your offer.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Telegram + SparkPost: self-serve demo emails sent fast
flowchart LR
subgraph sg0["Telegram 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/>Telegram Trigger"]
n1@{ icon: "mdi:swap-vertical", form: "rounded", label: "Edit Fields", pos: "b", h: 48 }
n2["<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/httprequest.dark.svg' width='40' height='40' /></div><br/>HTTP Request"]
n3["<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/markdown.dark.svg' width='40' height='40' /></div><br/>Markdown"]
n4@{ icon: "mdi:robot", form: "rounded", label: "getting link", pos: "b", h: 48 }
n5@{ icon: "mdi:swap-vertical", form: "rounded", label: "Split Out", pos: "b", h: 48 }
n6["<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/httprequest.dark.svg' width='40' height='40' /></div><br/>HTTP Request1"]
n7["<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/markdown.dark.svg' width='40' height='40' /></div><br/>Markdown1"]
n8@{ icon: "mdi:robot", form: "rounded", label: "Page Sumarize", pos: "b", h: 48 }
n9@{ icon: "mdi:cog", form: "rounded", label: "Aggregate", pos: "b", h: 48 }
n10@{ icon: "mdi:message-outline", form: "rounded", label: "Send email", pos: "b", h: 48 }
n11@{ icon: "mdi:robot", form: "rounded", label: "Email Craft", pos: "b", h: 48 }
n15@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If1", pos: "b", h: 48 }
n16@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model", pos: "b", h: 48 }
n17@{ icon: "mdi:memory", form: "rounded", label: "Postgres Chat Memory", pos: "b", h: 48 }
n18@{ icon: "mdi:robot", form: "rounded", label: "RAG AI Agent", pos: "b", h: 48 }
n19@{ icon: "mdi:database", form: "rounded", label: "List Documents", pos: "b", h: 48 }
n20@{ icon: "mdi:database", form: "rounded", label: "Get File Contents", pos: "b", h: 48 }
n21@{ icon: "mdi:database", form: "rounded", label: "Query Document Rows", pos: "b", h: 48 }
n22@{ icon: "mdi:vector-polygon", form: "rounded", label: "Embeddings OpenAI2", pos: "b", h: 48 }
n23@{ icon: "mdi:cube-outline", form: "rounded", label: "Postgres PGVector Store", pos: "b", h: 48 }
n24@{ icon: "mdi:swap-vertical", form: "rounded", label: "Edit Fields5", pos: "b", h: 48 }
n25@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If2", pos: "b", h: 48 }
n26@{ icon: "mdi:cog", form: "rounded", label: "XML", pos: "b", h: 48 }
n27["<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/httprequest.dark.svg' width='40' height='40' /></div><br/>sitemap.xml request"]
n28["<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/httprequest.dark.svg' width='40' height='40' /></div><br/>sitemap_index.xml request"]
n29["<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/httprequest.dark.svg' width='40' height='40' /></div><br/>crawl4ai"]
n30@{ icon: "mdi:cog", form: "rounded", label: "Check how many email created..", pos: "b", h: 48 }
n31["<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/>answer query"]
n32@{ icon: "mdi:swap-horizontal", form: "rounded", label: "set maximum email per id", pos: "b", h: 48 }
n33["<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/>apologize message"]
n34["<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/code.svg' width='40' height='40' /></div><br/>Code in JavaScript"]
n35["<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/>notif email creating"]
n36["<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/>missing input notif"]
n37["<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/code.svg' width='40' height='40' /></div><br/>make link array to string"]
n38["<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/code.svg' width='40' height='40' /></div><br/>extract link"]
n39@{ icon: "mdi:robot", form: "rounded", label: "Links ranking", pos: "b", h: 48 }
n40["<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/httprequest.dark.svg' width='40' height='40' /></div><br/>crawl4ai1"]
n41["<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/merge.svg' width='40' height='40' /></div><br/>Merge"]
n42@{ icon: "mdi:swap-vertical", form: "rounded", label: "Edit Fields3", pos: "b", h: 48 }
n43["<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/>broken links notif"]
n44@{ icon: "mdi:swap-vertical", form: "rounded", label: "flattext", pos: "b", h: 48 }
n45["<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/code.svg' width='40' height='40' /></div><br/>trim markdown to less token"]
n46@{ icon: "mdi:swap-vertical", form: "rounded", label: "sender + signature", pos: "b", h: 48 }
n47@{ icon: "mdi:cog", form: "rounded", label: "calculate how many session", pos: "b", h: 48 }
n48["<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/>Finish notif"]
n49@{ icon: "mdi:cog", form: "rounded", label: "insert log", pos: "b", h: 48 }
n15 --> n30
n15 --> n24
n25 --> n35
n25 --> n36
n26 --> n37
n41 --> n45
n3 --> n4
n29 --> n38
n44 --> n8
n9 --> n11
n7 --> n41
n5 --> n6
n40 --> n42
n40 --> n43
n10 --> n48
n1 --> n27
n11 --> n46
n42 --> n41
n24 --> n18
n48 --> n49
n2 --> n3
n2 --> n29
n18 --> n31
n38 --> n39
n4 --> n39
n6 --> n7
n6 --> n40
n39 --> n5
n8 --> n9
n19 -.-> n18
n0 --> n15
n20 -.-> n18
n16 -.-> n18
n34 --> n25
n22 -.-> n23
n46 --> n10
n21 -.-> n18
n27 --> n26
n27 --> n28
n17 -.-> n18
n35 --> n1
n23 -.-> n18
n32 --> n33
n32 --> n34
n37 --> n39
n28 --> n26
n28 --> n2
n47 --> n32
n45 --> n44
n30 --> n47
end
subgraph sg1["Schedule Flow"]
direction LR
n12@{ icon: "mdi:cog", form: "rounded", label: "Delete row(s)", pos: "b", h: 48 }
n13@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger", pos: "b", h: 48 }
n14@{ icon: "mdi:cog", form: "rounded", label: "Get row(s)1", pos: "b", h: 48 }
n14 --> n12
n13 --> n14
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,n13 trigger
class n4,n8,n11,n18,n39 ai
class n16 aiModel
class n17 ai
class n23 ai
class n22 ai
class n15,n25,n32 decision
class n19,n20,n21 database
class n2,n6,n27,n28,n29,n40 api
class n34,n37,n38,n45 code
classDef customIcon fill:none,stroke:none
class n0,n2,n3,n6,n7,n27,n28,n29,n31,n33,n34,n35,n36,n37,n38,n40,n41,n43,n45,n48 customIcon
The Problem: Demo Requests Create Invisible Busywork
“Can you show me how it works?” sounds like a simple question until you’re the one answering it all day. You ask for a website. You ask what they do. You paste their copy into an email draft. You hunt for a couple relevant pages, then you try to write something that feels personalized but doesn’t take 30 minutes. And if you’re not careful, you’ll send a “demo email” that’s either too generic to convert, or too custom to scale. That middle zone is where leads quietly die.
The friction compounds. Here’s where it breaks down in most teams.
- You end up rewriting the same explanation of your workflow offer, just with different company names and slightly different pain points.
- Website “research” turns into tab overload, and it’s easy to miss the one page that would have made your email feel like magic.
- When inquiries spike, response time slips from minutes to days, and the hottest prospects move on.
- Without a log, you can’t tell who requested what, who hit limits, or which demos actually lead to real conversations.
The Solution: Telegram Chat In, SparkPost Demo Email Out
This workflow gives prospects a self-serve way to “try the demo” from a Telegram bot, while you keep control of what gets generated and sent. It starts when someone messages your bot, then the workflow collects the basics (like their website and a few inputs), validates the form-style message, and checks usage limits so one person can’t hammer your system. Next, it pulls content from the prospect’s site using lightweight requests first, and escalates to Crawl4AI if the simple approach fails. After that, OpenAI summarizes and ranks the most useful pages, drafts a personalized email based on what it learned, and sends the email through SparkPost. Every session is logged with the user’s name and Telegram ID so you can track interest and keep the demo safe.
The workflow kicks off inside Telegram, not a form. Then it crawls and condenses the prospect’s site into clean input for the AI. Finally, SparkPost delivers the personalized demo email and Telegram confirms completion, so the user isn’t left guessing.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you get 10 “can I see a demo?” requests in a week. Manually, you might spend about 20 minutes per lead: 10 minutes skimming their site, 10 minutes drafting something that sounds personal. That’s roughly 3 hours gone. With this workflow, a prospect triggers the demo in Telegram (about 2 minutes of their time), the crawl + summary + draft runs in the background (often under 5 minutes), and SparkPost sends the email automatically. You review the log, not your sent folder.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Telegram to run the prospect-facing bot.
- SparkPost to send the demo email reliably.
- OpenAI API key (get it from your OpenAI dashboard).
Skill level: Intermediate. You’ll connect accounts, add API keys, and be comfortable adjusting prompts and a couple validation fields.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
Telegram message triggers the session. A prospect starts in your Telegram bot, and the workflow checks the command prefix so it knows whether they’re asking for guidance or launching the demo.
Inputs get cleaned up and validated. The workflow maps the message into structured fields, then validates what’s missing. If something important isn’t there, Telegram replies immediately with a “missing fields” prompt instead of letting the flow limp along.
Website content gets gathered with fallbacks. It tries sitemap.xml and sitemap indexes first, pulls a shortlist of pages, then fetches and converts pages to markdown. If the low-CPU approach fails, it escalates to Crawl4AI and merges the content streams back together.
OpenAI drafts the email and SparkPost sends it. Summaries are combined into a single brief, the email draft is generated, a sender signature is applied, and SparkPost sends the finished demo email. Telegram posts a completion notice and the interaction is logged by user ID.
You can easily modify the email style to match your brand voice 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 inbound Telegram trigger that starts the workflow when users send messages.
- Add and configure Telegram Intake Trigger to listen for Updates set to
message. - Credential Required: Connect your telegramApi credentials to Telegram Intake Trigger.
- Ensure Check Command Prefix is connected from Telegram Intake Trigger to filter messages starting with
!.
Step 2: Configure Session Limits and Form Validation
Control demo usage and parse user form input before launching the email workflow.
- In Count Emails By User, set the filter Telegram_id to
{{$json.message.from.id}}. - Confirm Aggregate Session Count aggregates Telegram_id and connects to Enforce Email Limit.
- In Enforce Email Limit, verify the rules: length greater than
2routes to Send Limit Notice and length less than or equal to2routes to Parse Form Script. - Credential Required: Connect your telegramApi credentials to Send Limit Notice and Notify Missing Fields.
- In Validate Form Input, ensure name, email, and website are checked for
notEmpty. - Connect the valid path to Notify Email Creation and the invalid path to Notify Missing Fields.
!FORM and three lines for name, email, and website.Step 3: Map Input Fields and Request Website Data
Normalize user input, request the target site, and gather sitemap and crawl data.
- In Map Input Fields, set Name to
{{$('Parse Form Script').item.json.name}}, Website to=https://{{$('Parse Form Script').item.json.website}}, and Receive_Email to{{$('Parse Form Script').item.json.email}}. - Configure Request Sitemap XML with URL set to
{{$json.Website}}/sitemap.xml. - Configure Request Sitemap Index with URL set to
{{$json.Website}}/sitemap_index.xml. - Set Primary Web Request URL to
{{$json.Website}}and keep Continue On Fail enabled if present. - Configure Crawler API Call with URL set to
http://00.00.00.000:11235/crawland JSON Body set to{ "urls": ["{{ $('Map Input Fields').item.json.Website }}"], "priority": 10 }.
Step 4: Extract, Rank, and Split Website Links
Extract URLs from markdown, rank the best targets, and split them for detailed crawling.
- In Convert to Markdown, set HTML to
{{$json.data}}. - Credential Required: Connect your openAiApi credentials to Extract Link List and confirm it references
{{$('Map Input Fields').item.json.Website}}and{{$json.data}}in the prompt. - From the crawler output, use Extract Raw Links to build a newline-separated string of URLs from
$json.results[0].markdown.raw_markdown. - Credential Required: Connect your openAiApi credentials to Rank Best Links and ensure it combines
{{$json.loc_links}},{{$json.message.content}}, and{{$json.links}}. - In Split Link Items, set Field to Split Out to
message.content.BestLinks. - Configure Secondary Web Request with URL set to
{{$json['message.content.BestLinks']}}.
Step 5: Summarize Content and Compose the Email Draft
Convert page content into structured summaries, aggregate insights, and draft the email using AI.
- In Page Markdown Convert, set HTML to
{{$json.data}}. - Use Merge Content Streams to combine content from Page Markdown Convert and Select Crawl Data.
- Run Condense Markdown to normalize and structure the combined markdown, then map flattext in Set Flat Text to
{{$json.flatText}}. - Credential Required: Connect your openAiApi credentials to Summarize Page Content and keep JSON Output enabled.
- In Combine Summaries, aggregate message.content.abstract so that Compose Email Draft receives an array of abstracts.
- Credential Required: Connect your openAiApi credentials to Compose Email Draft and confirm it uses
{{$('Map Input Fields').item.json.Name}}and{{$json.abstract.join("/n")}}.
Step 6: Configure Email Delivery and Completion Notifications
Finalize sender details, send the email, and notify the user on Telegram.
- In Set Sender Signature, replace Send_Email with your actual sender address and set Signature to your email signature.
- Map receive_email to
{{$('Map Input Fields').item.json.Receive_Email}}, subject_line to{{$json.message.content.Subject}}, and Body to{{$json.message.content.Body}}. - In Dispatch Email Notification, set From Email to
{{'Sender <' + $json.Send_Email + '>'}}, To Email to{{$json.receive_email}}, Subject to{{$json.subject_line}}, and HTML to{{$json.Body}}{{$json.Signature}}. - Credential Required: Connect your smtp credentials to Dispatch Email Notification.
- Credential Required: Connect your telegramApi credentials to Completion Notice so the user gets confirmation.
Step 7: Configure RAG Assistant for Telegram Help Responses
Enable the RAG-based assistant to guide users and respond to non-form messages.
- In Prepare Chat Input, set chatInput to
{{$json.message.text}}and sessionId to{{$json.message.chat.id}}. - Open RAG Assistant Agent and confirm Text is set to
{{$json.chatInput}}and Prompt Type isdefine. - Credential Required: Connect your openAiApi credentials to OpenAI Chat Engine (language model for RAG Assistant Agent).
- Credential Required: Connect your postgres credentials to Postgres Conversation Memory, PGVector Knowledge Store, List Knowledge Docs, Fetch File Text, and Query Doc Rows. These are tools used by RAG Assistant Agent.
- Credential Required: Connect your openAiApi credentials to OpenAI Embeddings (used by PGVector Knowledge Store).
- Credential Required: Connect your telegramApi credentials to Reply to Telegram.
Step 8: Set Up Scheduled Log Cleanup
Keep the demo log clean by periodically deleting rows from the data table.
- In Scheduled Run Trigger, choose your interval to run maintenance.
- Ensure Retrieve Log Rows targets the demo log data table.
- In Purge Log Rows, confirm Operation is
deleteRowswith Match Type set toallConditions.
Step 9: Test and Activate Your Workflow
Validate the workflow end-to-end and activate it for production use.
- Click Execute Workflow and send a Telegram message with the required
!FORMtemplate. - Confirm the user receives Notify Email Creation and later Completion Notice.
- Verify that Dispatch Email Notification sends a message with the composed subject and HTML body.
- Check that Insert Log Entry writes the user details to the demo log table.
- Toggle the workflow to Active for production use once testing is successful.
Common Gotchas
- Telegram bot credentials can expire or be pasted incorrectly. If messages stop triggering, check the bot token in your n8n Telegram credentials and verify the bot is still active in BotFather.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
Plan for about 45 minutes if you already have the accounts.
No. You’ll mostly connect credentials and edit prompts. The only “code” you might touch is minor text parsing if you change the input format.
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 OpenAI API usage (usually a few cents per demo, depending on crawl size).
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 honestly the best way to make this yours. You can keep the Telegram intake, crawling, and summarization the same, then swap the “Compose Email Draft” part for a different generator (for example, a proposal snippet, an audit summary, or a short Loom script). Common customizations include changing the questions the bot asks, adjusting the page-ranking prompt so it focuses on pricing or case studies, and routing the final output to Slack or Google Sheets instead of sending an email.
Most of the time it’s an API key or sending-domain issue. Regenerate the SparkPost API key, confirm it has permission to send, and make sure your “from” address is verified. Also check your SparkPost suppression list and sending limits, because a “success” in n8n can still result in non-delivery if SparkPost blocks it.
On a typical n8n setup, dozens per day is fine.
For this workflow, n8n has a few advantages: more complex logic with unlimited branching at no extra cost, a self-hosting option for unlimited executions, and native AI agent + memory building blocks that are awkward (or expensive) in simpler tools. Zapier or Make can still work if you only need “Telegram message → send template email” and you don’t care about crawling, page ranking, or per-user limits. The moment you want fallbacks (sitemap first, crawler second) and guardrails, n8n is the more practical choice. If you’re unsure, Talk to an automation expert and describe your volume and your offer.
You set this up once, and your demo follow-up stops living in your head. The workflow handles the repetitive parts so you can spend your time on the conversations that actually close.
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.