Build a Telegram AI Support Bot for Your Store with n8n
Build a Telegram AI Support Bot for Your Store with n8n
Your store's inbox doesn't sleep, but you do. Most customer questions — "Where's my order?", "Do you ship to X?", "What's your return policy?" — repeat a hundred times a month. Answering each one manually is a drain you don't need to accept.
This guide walks you through wiring a Telegram bot to an AI node inside your own n8n instance so it can answer those questions automatically, around the clock, escalating to you only when it genuinely doesn't know the answer.
What You're Building
A workflow that:
- Receives a Telegram message from a customer
- Runs it through an LLM with context from your FAQ, product catalog, or order lookup
- Replies directly in Telegram
- Escalates (notifies you or opens a ticket) when the AI flags low confidence
The whole thing runs on your own n8n instance — your editor, your data, your workflows. You own it.
Prerequisites
- A Telegram bot token (create one via @BotFather — takes 60 seconds)
- Your FAQ or support content in a text file, Google Sheet, or Airtable base
- An n8n instance (more on where to run it below)
Step 1 — Telegram Trigger
Add a Telegram Trigger node as the first node in your workflow.
- Authentication: paste your bot token
- Updates: check
message(optionallycallback_queryfor button taps)
Every time a customer messages your bot, this node fires. The output includes message.text, message.chat.id, and message.from — you'll reference these downstream.
Test it: Save the workflow, click "Test workflow", send a message to your bot. You should see the raw Telegram payload appear in the node output panel.
Step 2 — Load Your Context (HTTP Request or Code node)
The AI node needs context to give accurate answers. There are two common patterns:
Option A — Static FAQ via a Code node
If your FAQ is small and stable, paste it directly into a Code node that returns a string:
return [{
json: {
faq: `
Q: What is your return policy?
A: We accept returns within 30 days of delivery.
Q: Do you ship internationally?
A: We ship to EU and US. Shipping takes 5-10 business days.
Q: How do I track my order?
A: Reply with your order number and we will look it up.
`.trim()
}
}];
Option B — Live data via HTTP Request
If you have a help-center API or a Google Sheet published as CSV, use an HTTP Request node:
- Method: GET
- URL: your sheet's CSV export URL or help-center endpoint
- Response Format: Text (for CSV) or JSON
Pipe the result into a Set node to extract the fields you need and pass them cleanly to the AI node.
Step 3 — AI / LLM Node
Add the AI Agent node (or the Basic LLM Chain node if you want a simpler setup without tools).
- Prompt: build a system message like this:
You are a helpful customer support assistant for [Your Store Name].
Answer questions ONLY using the information below.
If you cannot find a clear answer, say: "I'll forward this to our team."
---
{{ $json.faq }}
---
Customer message: {{ $('Telegram Trigger').item.json.message.text }}
- Model: pick any of the available models; GPT-4o-mini is a strong default for support bots (fast, low credit usage, very accurate at FAQ retrieval)
- Max tokens: 300 is usually enough for support replies
The node outputs the AI's reply in {{ $json.output }} (or text, depending on node version — check the output panel).
On AgentRoost, you don't enter an API key here. The AI node's credentials are pre-wired to the included credits. Just pick a model and go.
Step 4 — Branch on Confidence (IF Node)
Add an IF node after the AI node to detect escalation phrases:
- Condition:
{{ $json.output }}containsI'll forward this to our team
True branch — escalate:
- Add a Telegram node (Send Message) back to the customer: "Our team will be in touch shortly."
- Add a second Telegram node (or Email / Slack node) to notify you with the customer's message and
chat.id
False branch — reply normally:
- Add a Telegram node: send
{{ $json.output }}to{{ $('Telegram Trigger').item.json.message.chat.id }}
Step 5 — Reply to the Customer
In any Telegram Send Message node on the reply path:
- Chat ID:
{{ $('Telegram Trigger').item.json.message.chat.id }} - Text:
{{ $json.output }}(or your escalation message) - Parse Mode:
Markdown— lets you bold product names, create line breaks, etc.
Step 6 — Activate and Test
Click Activate (top-right toggle in n8n). The Telegram Trigger switches from polling during tests to a live webhook, so messages are processed instantly.
Send a few test questions via Telegram:
- Something your FAQ covers → should get a clean AI reply
- Something ambiguous → should trigger escalation
- An order number (if you wired up live order lookup) → should return status
Tips and Common Pitfalls
Context window budget — LLMs have token limits. If your FAQ is large (50+ entries), don't dump the whole thing. Pre-filter: use a Set node with a substring search or add a Vector Store tool to the AI Agent node for proper semantic retrieval.
Rate limiting — Telegram allows one message per second per chat. For burst traffic, the n8n queue mode handles this automatically if you enable it in settings.
Message threading — if your bot is in a group chat rather than a private chat, filter for message.chat.type === 'private' in an IF node before processing, or scope your trigger to direct messages only.
Keeping context across turns — the basic setup is stateless. For multi-turn conversations (e.g., order lookup that needs a follow-up), store state in n8n's Static Data or route through a Redis node. That's a natural next step once the single-turn bot is live.
Run It on AgentRoost
Building this locally means managing Docker, SSL for the webhook endpoint, uptime, and your own API keys for every AI model you use. That's 2-4 hours of setup before you write a single workflow node.
On AgentRoost you get your own n8n instance — your login, your workflows, your data — on a public HTTPS subdomain (https://<your-id>.agentroost.app). The Telegram webhook URL works out of the box. The AI node already has credits wired in; no OpenAI API key to create, no billing account to set up, no rate-limit surprises at 2 AM.
How to get there:
- Sign up at agentroost.app (email/password, Google, Microsoft, or Discord)
- Pick the n8n framework, give your instance a name
- Your n8n editor opens — build the workflow above
- Paste your Telegram bot token, activate
That's it. The bot is live, the AI node is funded, the HTTPS webhook is already set. From checkout to a working bot: about 15 minutes, most of which is pasting your FAQ content.
Starts at $19.99/month all-in — that's roughly the cost of a small VPS plus AI credits, bundled together with nothing to configure. 14-day money-back guarantee, cancel anytime.
What to Build Next
Once your Telegram support bot is live:
- Order lookup — add an HTTP Request node that calls your Shopify / WooCommerce API with the order number extracted from the message
- Proactive shipping updates — a Schedule Trigger node that polls for shipped orders and pushes Telegram messages to customers
- Multi-language replies — detect the customer's language via the AI node and reply in kind; no extra infrastructure
- Handoff to Crisp / Freshdesk — on escalation, open a ticket automatically via HTTP Request rather than just notifying you by email
Frequently asked questions
Do I need to bring my own OpenAI API key to use the AI node in n8n?
Not on AgentRoost. AI/LLM credits are included in your subscription, so the AI node is pre-wired and ready to use. You just pick a model and build your workflow — no API account, no billing setup on a third-party platform.
Will the bot keep running if I close my laptop?
Yes. Your n8n instance runs on AgentRoost's servers 24/7. Closing your browser or turning off your computer has no effect — the Telegram webhook keeps receiving messages and the workflow keeps processing them.
Can I export my workflows later if I want to move?
Absolutely. In n8n, go to the workflow menu → Download to export any workflow as a JSON file. You can import that file into any other n8n instance (self-hosted or otherwise) at any time. You own your data and your workflows.
How much does it cost, and can I cancel?
Plans start at $19.99/month, billed monthly via Polar. There's no annual lock-in and you can cancel anytime from your account dashboard. New accounts include a 14-day money-back guarantee.
What if a customer asks something my FAQ doesn't cover?
The workflow handles this with an IF node. When the AI can't find a confident answer, it outputs an escalation phrase (you define it in the prompt). The IF node routes those messages to a separate branch that notifies you — via Telegram, email, or a ticketing tool — so a human can follow up.