Send Telegram Alerts From Any Webhook With n8n and AI

AgentRoost · May 26, 2026 · 7 min read · View as Markdown
AgentRoost — Telegram Bots

Most monitoring services, e-commerce platforms, and SaaS tools can fire a webhook when something happens. The problem is what arrives on the other end: a dense JSON blob with 40 fields you never asked for, at 2 AM, in a Slack channel nobody reads anymore.

This post shows you how to wire any webhook into Telegram with a single AI step in between that reads the raw payload, picks out what matters, and writes a clean sentence you can actually act on. The whole thing runs 24/7 on your own n8n instance — and the AI node already has credits, so you never touch an API key.


Why route webhooks through n8n instead of directly to Telegram?

Telegram's Bot API can receive messages, but it cannot receive arbitrary webhooks and transform them. You need a layer in between that can:

  1. Accept the incoming POST from any sender (Stripe, GitHub, WooCommerce, PagerDuty, your own app, etc.)
  2. Parse and reshape the JSON
  3. Optionally summarize or classify the payload with an LLM
  4. Send one readable message to the right chat

n8n is built for exactly this. Its Webhook node gives you a public HTTPS URL instantly. The AI Agent / LLM node lets you pass the payload as context and ask a plain-English question about it. The Telegram node sends the result to any bot, group, or channel.


The workflow at a glance

[Webhook Trigger]
       │  raw JSON payload
       ▼
[Set node]          ← extract only the fields you care about
       │
       ▼
[AI / LLM node]     ← "Summarize this in one sentence for an ops team"
       │
       ▼
[IF node]           ← optional: only alert on severity ≥ warning
       │
       ▼
[Telegram node]     ← send to your bot / group

Let's build each step.


Step 1 — Create a Webhook node

Drop a Webhook node onto your canvas. Set:

  • HTTP Method: POST
  • Path: something memorable, e.g. stripe-events
  • Authentication: Header Auth with a secret you'll pass from the sender as X-Webhook-Secret

n8n gives you a production URL like https://yourworkspace.agentroost.app/webhook/stripe-events. Copy it — you'll paste it into your sending service.

Tip: Leave the node in "Test" mode while building. Hit "Listen for test event" and trigger a real event from your service. You'll see the exact JSON shape and can reference field names precisely in later nodes.


Step 2 — Extract the fields you need (Set node)

Raw webhook payloads are verbose. A Stripe payment_intent.succeeded event runs to roughly 80 lines. You do not want to feed all of it to the LLM — it wastes tokens and muddies the output.

Add a Set node immediately after the Webhook. Map only the fields you will use:

{
  "event": "{{ $json.type }}",
  "amount": "{{ $json.data.object.amount_received }}",
  "currency": "{{ $json.data.object.currency }}",
  "customer": "{{ $json.data.object.receipt_email }}",
  "status": "{{ $json.data.object.status }}"
}

This gives the next node a clean, small object instead of the raw blob.


Step 3 — AI summarization (LLM node)

This is where the workflow gets genuinely useful. Add an AI Agent node (or a basic LLM Chain node for a simpler setup). Wire the Set node's output into it.

System prompt:

You are a concise ops alert formatter.
Given a payment event, write a single Telegram-safe message (no markdown, ≤120 characters).
Include: event type, amount, currency, and customer email.
If the status is not "succeeded", start with "⚠️".

User message (expression):

{{ JSON.stringify($json) }}

The node queries the LLM and returns a string like:

Payment succeeded: $149.00 USD — [email protected]

or, for a failed charge:

⚠️ Payment failed: $149.00 USD — [email protected]

On AgentRoost, this step works out of the box. The AI node connects to included LLM credits automatically — no OpenAI key, no Anthropic key, nothing to configure. You pick your preferred model from the node's dropdown (350+ available) and the cost comes out of your subscription.


Step 4 — Conditional routing (IF node)

Not every webhook needs a Telegram ping. An IF node lets you filter before sending.

Add an IF node after the LLM step:

  • Condition: {{ $json.event }} contains failed OR {{ $json.event }} equals dispute.created
  • True branch → Telegram node (send alert)
  • False branch → nothing (or a separate logging path)

For high-volume sources such as CI builds or health checks, you can add a second condition on the LLM's output — e.g., only send if the message starts with ⚠️.


Step 5 — Send to Telegram

Add a Telegram node. You will need:

  • Bot Token: create one via BotFather in Telegram (one-time setup, takes about 2 minutes)
  • Chat ID: your personal chat ID, a group ID, or a channel ID

Set Text to the LLM node's output:

{{ $json.output }}

Enable Parse Mode: None since the LLM was told to avoid markdown. Switch to MarkdownV2 if you want formatted output — just update the system prompt accordingly.


Tips and common pitfalls

Payload arrives but nothing sends? Check the IF node's branch. If you added filtering, the False branch silently swallows the event. Add a NoOp node on the False branch during testing so you can see what got filtered.

LLM output is too long for one Telegram message? Telegram's text message limit is 4 096 characters. For dense payloads like error stack traces, tell the LLM explicitly: "Keep the response under 200 characters."

Webhook sender retries on timeout? n8n's Webhook node responds as soon as it receives the request, before the workflow finishes. If your sender has a short timeout and the LLM call takes longer, the sender may log a timeout even though n8n completes the run successfully. Add a Respond to Webhook node early in the flow if you need to return a 200 OK immediately.


How to build this on AgentRoost

You need your own n8n instance with a public webhook URL and an AI node that works without extra setup. Here is the exact flow:

  1. Go to agentroost.app and sign up (email, Google, Microsoft, or Discord).
  2. Pick the n8n framework and name your instance.
  3. In about 2 minutes your private n8n editor opens at https://<your-id>.agentroost.app — you are the only user, your data stays yours.
  4. Build the workflow above. The Webhook node gives you a public HTTPS URL immediately — no Cloudflare tunnel, no ngrok, no port forwarding needed.
  5. Open the LLM node — it is already connected to included AI credits. Pick any available model, save, and test.

The subscription starts at $19.99/mo, covering the server, your n8n instance, and a pool of AI credits. There is a 14-day money-back guarantee and you can cancel anytime.

Compare plans and get started →


What you end up with

A workflow that:

  • Accepts webhooks from any service — Stripe, GitHub, WooCommerce, PagerDuty, a custom API, whatever you like
  • Runs the raw payload through an LLM that writes one readable sentence
  • Filters by severity so your Telegram does not become a firehose
  • Runs 24/7 without you maintaining a server, SSL certificate, or reverse proxy

The AI step is the part that usually gets skipped because it requires an API key and adds billing complexity. On your own n8n instance running on AgentRoost, that step costs nothing extra to wire up — the credits are already there.

Frequently asked questions

Do I need to provide my own OpenAI or Anthropic API key for the AI node?

No. On AgentRoost, AI/LLM credits are included in your subscription. The AI node in your n8n instance is pre-wired to those credits — you just pick a model from the dropdown and it works. You can bring your own key if you prefer a specific provider, but it is never required.

Will my webhook URL stay live even when I close the browser?

Yes. Your n8n instance runs 24/7 on AgentRoost's infrastructure, not on your laptop. The Webhook node stays active and listening around the clock regardless of whether you have the editor open.

Can I export my workflows and take them elsewhere?

Yes. n8n workflows are stored as JSON. You can export any workflow from the editor at any time and import it into a self-hosted n8n instance or another provider. Your data and workflows are yours.

How do I get my Telegram Chat ID?

Start a conversation with the @userinfobot Telegram bot — it replies with your personal chat ID instantly. For groups, add the bot to the group and it will show the group's chat ID (a negative number like -1001234567890).

What happens if the sending service retries because of a timeout?

n8n responds to the webhook immediately upon receipt, before the workflow finishes executing. Most senders will see a 200 OK and not retry. If your source requires an explicit response body, add a Respond to Webhook node early in the flow to send the acknowledgement before the LLM call runs.