Skip to main content

Telegram

The Telegram app works through a bot: a Telegram account that Blokkio controls with a token.

1. Create a bot​

  1. In Telegram, open a chat with @BotFather and send /newbot.
  2. Choose a display name and a username ending in bot, for example acme_alerts_bot.
  3. BotFather replies with a token like 123456789:AAH…. Copy it.

To post into a group, add the bot to the group. To post into a channel, add the bot as an administrator with permission to post messages.

2. Create the connection​

  1. In Blokkio, go to Apps and open Telegram.
  2. Click Connect, paste the token into Bot token and click Create.
  3. Test connection calls getMe and shows Connected — api.telegram.org answered 200.

Telegram puts the token in the request address (https://api.telegram.org/bot<token>/…). Blokkio builds that address when the request is sent and only sends it to api.telegram.org. Store the token as a secret with Use secret if several connections or environments share it.

Finding the chat id​

Send message needs a Chat ID:

  • Public channel: use its username, for example @acme_news.
  • Person or group: send the bot a message (in a group, mention it or send /start@your_bot), then run the Get updates action. The id is at message.chat.id (groups have negative ids such as -1001234567890).

Actions​

ActionWhat it doesMain inputs
Send messageSends textChat ID, Text (up to 4096 characters), Formatting (HTML, MarkdownV2), Send silently, Disable link preview, Reply to message ID, Topic ID, Keyboard / buttons (JSON)
Send photoSends a pictureChat ID, Photo, Caption, Caption formatting, Send silently, Topic ID
Send documentSends any fileChat ID, Document, Caption, Caption formatting, Send silently, Topic ID
Get updatesMessages sent to the bot in the last 24 hoursOffset (last update_id + 1), How many
Get bot infoThe bot's id and usernameNone

Photo and Document accept a file from another block (for example {{ $nodes.Download.output.file }}, uploaded up to 25 MB), a public https:// URL, or a Telegram file_id.

Get updates doesn't work while the bot has a webhook set elsewhere; Telegram then answers Conflict: can't use getUpdates method while webhook is active.

Troubleshooting​

MessageWhat to do
UnauthorizedThe token is wrong or was revoked with /revoke. Paste the current token.
Bad Request: chat not foundWrong chat id, or the person never started a chat with the bot.
Forbidden: bot was blocked by the userThe person blocked the bot; they need to unblock it.
Bad Request: can't parse entitiesThe text doesn't match the chosen Formatting; escape special characters or choose HTML.
the field 'bot_token' is emptyThe connection has no token. Edit it and paste one.