Telegram

This page is for version 1.0. Read the current version.

For arlanix/notification 1.0.1

Telegram

A Telegram subscription sends a topic's messages to one chat. The chat can be a private chat with a person, a group or a channel. A bot posts the messages. Most subscriptions use the store's bot, which you set up once. A subscription can also have a bot of its own.

Telegram needs the module arlanix/module-notification-telegram, which your developer installs.

1. Make a bot

  1. In Telegram, search for BotFather and open @BotFather, the one with the blue check mark. Other accounts only copy its name.

    Telegram's search: @BotFather with the blue check mark, above accounts that copy its name

  2. If this is your first time, click Start.

  3. Send /newbot.

  4. Give the bot a name, for example Store alerts.

  5. Give the bot a username that ends in bot, for example your_store_alerts_bot.

  6. BotFather replies with the bot's token, for example 7384215590:AAF3…. Keep the token secret, like a password. Anyone who has it can post as the bot.

    BotFather: /newbot, the name Store alerts, the username your_store_alerts_bot, and the bot's token

2. Add the bot to the store

  1. In the admin menu, click Stores, then Configuration under Settings.

    The Stores menu open, with Configuration highlighted

  2. In the list on the left, click Arlanix, then Notifications.

    The configuration list: Arlanix open, with Notifications

  3. Open the Telegram group.

  4. Paste the token into Bot token. The store keeps it encrypted.

  5. Leave Bot API server as it is. Change it only if your developer runs their own Bot API server.

  6. Click Save Config.

    The Telegram settings: Bot token and Bot API server

3. Let the bot into the chat

A bot can post only to chats that it has been let into. The steps depend on the kind of chat.

A private chat

The person opens the bot in Telegram by its username and taps Start.

The bot's chat, Store alerts, and Start

A group

  1. Add the bot to the group as a member:

    • For a new group, tap New Group, choose the bot by its username, name the group and create it.
    • For a group that already exists, add the bot by its username, as you add any member.

    New Group: the group name Store ops, and the bot Store alerts as its only member

  2. Mention the bot in the group, for example @your_store_alerts_bot. This makes sure that Find chats lists the group.

    Store ops: the bot mentioned in the group

A channel

  1. Open the channel's info and tap Edit, then Administrators.

  2. Add an admin and choose the bot.

  3. Leave Post Messages on. The bot needs no other rights, so you can turn the others off.

  4. Save.

    Promote to Admin: the bot Store alerts, with Post Messages as its only right

  5. Mention the bot in a post, as in a group.

    The Store alerts channel: the bot mentioned in a post

4. Subscribe the chat

  1. Add a subscription on the topic's page or in Subscriptions. See Subscriptions.

  2. Under Delivery, set Delivered by to Telegram.

  3. Leave Bot set to The store's bot.

  4. Click Find chats. It lists the chats that the bot received something from in the last day: people who tapped Start, and groups and channels that the bot was added to.

  5. Click the chat to send to. This fills in Chat and Chat name.

    The subscription form for Telegram: Bot, Chat, Find chats with the chats the bot received something from, and Chat name

  6. Save the subscription.

  7. Click Send test message. The test message arrives in the chat, from the bot.

    The test message in the group Store ops: Test notification from the store, from the bot Store alerts

You can also type Chat yourself. Enter the chat's number, for example -1001234567890 for a group or a channel. For a public channel, you can enter its @username instead.

Chat name is the name that the grid and the Message Log show instead of the number. You can change it.

A topic can have only one subscription to the same chat.

If Find chats does not list the chat

  • For a group or a channel that the bot was just added to, mention the bot there, for example @your_store_alerts_bot. Then click Find chats again.
  • For a private chat, ask the person to tap Start again.

Telegram keeps what the bot received for one day only. So a chat that the bot joined earlier may need the same step.

Post as another bot

A subscription can post as a different bot, for example a bot that a team already has in its group.

  1. On the subscription, set Bot to A bot of its own.
  2. Paste that bot's token into Bot token. The store keeps it encrypted and never shows it again.
  3. Save. Find chats now uses this bot.

The subscription with a bot of its own: Bot token, which says a token is stored

To keep the stored token, leave Bot token empty when you save. If you set Bot back to The store's bot and save, the store deletes the subscription's token.

A subscription with a bot of its own sends messages even when the store has no bot set up.

How messages look

Each message is sent as one Telegram message. A digest, several messages sent together, is also one Telegram message. It looks like this:

  • The subject is in bold, after a mark for the severity: šŸ”“ for an error, 🟠 for a warning, šŸ”µ for info.
  • The text and the details follow.
  • Links work, and Telegram shows no preview for them.

Telegram limits the length of a message. If a digest is too long, it shows the messages that fit and ends with the number of the others, for example … and 3 more: see the Message Log. A single message that is too long is cut and ends with …. The Message Log keeps every message in full.

When Telegram refuses

When Telegram refuses a message, its answer appears in Last delivery on the subscription, and on the message's page in the Message Log. The common answers and what to do:

Telegram says What to do
Unauthorized The token is wrong. Check Bot token in the settings, or on the subscription if it has a bot of its own.
Bad Request: chat not found The bot is not in the chat. Add the bot to the group or channel, or ask the person to tap Start.
Forbidden: bot was blocked by the user The person blocked the bot. Ask them to unblock it, or delete the subscription.
Forbidden: bot is not a member of the channel chat Add the bot to the channel as an administrator.
group chat was upgraded to a supergroup chat The group has a new number, which the answer gives. Enter the new number in Chat.
Conflict: … webhook is active Another program receives the bot's updates, so Find chats cannot list chats. Type Chat yourself, or use another bot.
Telegram asked to wait … second(s) Too many messages went to the chat at once. The store waits as long as Telegram asks, one hour at most, and then sends the rest. In the first 24 hours after a message is published, this wait does not use up any of its delivery attempts.

The store tries a failed delivery again by itself. See When a delivery fails. To send it again now, click Retry now on the message's page in the Message Log. It is sent within a minute or so.