Send Telegram Messages with n8n Webhook
Automate notifications to Telegram using n8n and a simple webhook. This guide walks you through a compact, production-ready workflow that accepts an HTTP request, forwards the content to a Telegram chat, and returns a friendly response. You’ll get a working example, testing tips, and best practices for secure automation.
Why use n8n + Telegram?
n8n is a powerful open-source workflow automation tool that connects APIs and services with visual nodes. Telegram provides a reliable chat API for bots and notifications. Combining them with a webhook makes it easy to send messages from any system (cron jobs, webhooks, CI pipelines, monitoring tools) to a Telegram chat without building custom code.
What this workflow does
- Receives an HTTP GET request at a webhook endpoint.
- Extracts a query parameter and sends it as a message to a configured Telegram chat.
- Sets a brief response that confirms who received the message and what was sent.
Prerequisites
- An n8n instance (cloud or self-hosted).
- A Telegram bot token (create one via @BotFather).
- The chat ID of the Telegram user or group you want to message.
- Basic n8n familiarity (adding nodes and credentials).
Workflow overview (nodes)
The workflow contains three nodes:
- Webhook — listens for incoming HTTP GET requests at the path /telegram and passes the query parameter to the next node.
- Telegram — uses the Telegram credential to send the message to the configured chatId.
- Set — creates a friendly response that includes the recipient’s name and the message text; this is returned to the webhook caller.
Template (n8n JSON)
You can import this snippet into n8n as a workflow template.
{
"id":"5","name":"bash-dash telegram","nodes":[{"name":"Webhook","type":"n8n-nodes-base.webhook","position":[450,450],"webhookId":"b43ae7e2-a058-4738-8d49-ac76db6e8166","parameters":{"path":"telegram","options":{"responsePropertyName":"response"},"responseMode":"lastNode"},"typeVersion":1},{"name":"Set","type":"n8n-nodes-base.set","position":[850,450],"parameters":{"values":{"string":[{"name":"response","value":"=Sent message to {{$node[\"Telegram\"].json[\"result\"][\"chat\"][\"first_name\"]}}: \"{{$node[\"Telegram\"].parameter[\"text\"]}}\""}]}},"options":{}},"typeVersion":1},{"name":"Telegram","type":"n8n-nodes-base.telegram","position":[650,450],"parameters":{"text":"={{$node[\"Webhook\"].json[\"query\"][\"parameter\"]}}","chatId":"123456789","additionalFields":{}},"credentials":{"telegramApi":"telegram_bot"},"typeVersion":1}],"active":true,"settings":{},"connections":{"Set":{"main":[[]]},"Webhook":{"main":[[{"node":"Telegram","type":"main","index":0}]]},"Telegram":{"main":[[{"node":"Set","type":"main","index":0}]]}}}
Note: Replace chatId, credentials and webhook path as needed. The example uses a query parameter named parameter
to pass the message text.
Step-by-step setup
1. Configure the Telegram credential
In n8n, add a credential for your Telegram bot token (named e.g. telegram_bot). Keep your token secure and avoid committing it to version control.
2. Add the Webhook node
– Method: GET (or choose POST if you prefer JSON payloads).
– Path: telegram (or a custom path).
– Response Mode: Last Node (so the Set node’s output is returned).
3. Add the Telegram node
– Text: Use an expression to grab the incoming query parameter, e.g. = {{$node["Webhook"].json["query"]["parameter"]}}
.
– ChatId: the numeric chat ID for your Telegram conversation.
– Credentials: select your Telegram bot credential.
4. Add the Set node
Create a string field named response
with value similar to this expression:
=Sent message to {{$node["Telegram"].json["result"]["chat"]["first_name"]}}: "{{$node["Telegram"].parameter["text"]}}"
This produces a readable confirmation returned to the webhook caller.
Triggering and testing
Once the workflow is active, trigger it by sending an HTTP request. Example using curl:
curl 'https://your-n8n-instance/webhook/telegram?parameter=Hello%20from%20n8n'
Expected behavior:
- The Telegram bot sends “Hello from n8n” to the configured chat.
- The webhook response contains a confirmation like: Sent message to John: “Hello from n8n” (first name taken from the Telegram response).
Troubleshooting
- If messages don’t arrive, confirm your bot token and chatId are correct. For private chats, chatId is the user’s numeric ID; for groups, use the group ID (or invite the bot to the group first).
- Inspect node execution logs in n8n to see the Telegram API response payload.
- Ensure your n8n instance is reachable from the system sending the webhook (public URL or tunnel like ngrok for testing).
Security best practices
- Protect the webhook endpoint with a secret parameter or token (e.g., "?token=abc123") and validate it in the workflow.
- Use HTTPS for your n8n instance to protect transit data.
- Limit bot permissions in Telegram to minimize risk.
- Rotate Telegram bot tokens periodically and revoke old tokens when compromised.
Advanced tips
- Use POST + JSON body to send richer payloads (images, markdown-enabled messages).
- Extend the Set node to build structured JSON responses for calling systems.
- Add error handling nodes (e.g., FunctionItem or IF nodes) to retry on failures or log errors to a database.
- Parameterize chatId to support multi-tenant flows (read chatId from a datastore based on a username or token).
Conclusion
With only three nodes, n8n makes it very simple to forward webhook events to Telegram. This pattern is ideal for alerting, lightweight chatbots, and cross-system notifications. Import the template, update your credentials and chatId, and you’ll be sending messages in minutes.
Call to action: Try this workflow now — import the template into n8n, swap in your Telegram credential, and trigger the webhook. If you found this helpful, subscribe for more automation tutorials and advanced n8n recipes.