---
title: "Send Telegram Alerts From Any Webhook With n8n and AI"
description: "Learn how to route any webhook into Telegram with an AI summarization step in n8n. AI credits included on AgentRoost — no BYOK, no DevOps."
canonical: https://agentroost.app/en/blog/telegram-alerts-webhook-n8n-ai
date: 2026-05-26T20:00:00Z
---

[Canonical URL](https://agentroost.app/en/blog/telegram-alerts-webhook-n8n-ai)

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:

```json
{
  "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 — jane@example.com`

or, for a failed charge:

> `⚠️ Payment failed: $149.00 USD — jane@example.com`

**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](/en/agents/n8n) 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 →](/en/pricing)

---

## 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.
