Telegram bots are the simplest way to get push notifications on your phone from automated workflows. No app approval, no OAuth -- just a bot token and a chat ID. Setup takes under 5 minutes.
Create the Bot
- Open Telegram and search for @BotFather (or tap t.me/botfather)
- Send
/newbot - BotFather asks for a display name -- enter something like "Homelab Alerts"
- BotFather asks for a username -- must end in
bot. Example:homelab_alerts_bot - BotFather replies with your bot token. It looks like this:
7123456789:AAH1bGciOiJIUzI1NiIsInR5cCI6Ikp
Copy it. This token is your bot's full authentication credential.
Get Your Chat ID
The bot token lets you send messages. The chat ID tells Telegram where to send them.
Personal Chat ID
- Open a conversation with your new bot in Telegram and send any message (just say "hello")
- In your browser or terminal, call the bot's update endpoint:
curl -s https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates | jq .result[0].message.chat.id
The number returned is your chat ID. It's a positive integer for personal chats.
Group Chat ID
To send notifications to a group:
- Add your bot to the group
- Send a message in the group (any message, from any member)
- Call
getUpdatesagain:
curl -s https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates | jq .result[-1].message.chat.id
Group chat IDs are negative numbers (e.g., -1001234567890).
If getUpdates returns an empty array, the bot hasn't received any messages yet. Send another message in the chat and try again.
Test the Connection
Send a test message to verify everything works:
curl -s -X POST https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessage \
-H "Content-Type: application/json" \
-d '{"chat_id": YOUR_CHAT_ID, "text": "Bot is working", "parse_mode": "Markdown"}'
You should receive the message in Telegram within a second.
Add to n8n
In n8n, create a Telegram API credential:
- Go to Credentials > Add Credential > search Telegram
- Paste your bot token into the Access Token field
- Save the credential
In your Telegram node configuration, set the Chat ID to the number from the previous step. n8n's Telegram node supports Markdown formatting, photos, and documents.
For workflows using HTTP Request nodes instead of the native Telegram node, POST to:
https://api.telegram.org/bot<TOKEN>/sendMessage
With body:
{
"chat_id": 123456789,
"text": "Your notification text",
"parse_mode": "Markdown"
}
Configuration Notes
- Telegram bot messages support Markdown (
*bold*,_italic_, backtick code blocks) and HTML (<b>,<i>,<code>). Setparse_modeaccordingly. - Bots cannot initiate conversations. The user (or group admin) must message the bot first before it can send messages back.
- Rate limit: 30 messages per second to different chats, 20 messages per minute to the same group. Automated notifications rarely hit these limits.
- Bot tokens don't expire unless you revoke them via BotFather (
/revoke). Unlike GitHub tokens, there's no rotation to worry about. - If
getUpdatesreturns stale messages after you've already processed them, add?offset=-1to only get the most recent update.