Delivery Channels

TelegramBot

Create a Telegram bot and get the chat ID needed to send automated notifications from n8n workflows, monitoring alerts, and other homelab automation.

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

  1. Open Telegram and search for @BotFather (or tap t.me/botfather)
  2. Send /newbot
  3. BotFather asks for a display name -- enter something like "Homelab Alerts"
  4. BotFather asks for a username -- must end in bot. Example: homelab_alerts_bot
  5. 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

  1. Open a conversation with your new bot in Telegram and send any message (just say "hello")
  2. 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:

  1. Add your bot to the group
  2. Send a message in the group (any message, from any member)
  3. Call getUpdates again:
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:

  1. Go to Credentials > Add Credential > search Telegram
  2. Paste your bot token into the Access Token field
  3. 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>). Set parse_mode accordingly.
  • 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 getUpdates returns stale messages after you've already processed them, add ?offset=-1 to only get the most recent update.