Skip to main content

Connect a Telegram bot

Attach an employee as a Telegram bot and you can message the employee in Telegram and tap approval buttons. One bot serves one employee. Do not attach the same bot to two employees.

Either way, the bot is created inside Telegram. What differs is who creates it.

WayWhere you startWhen
1. Connect a bot made with BotFather (default)Create the bot with @BotFather in Telegram, then enter its token in DAIOpsAlways
2. Create a new bot from DAIOps (fast way)Click New bot on the DAIOps detail screen, and the DAIOps manager bot creates the bot for you in TelegramOnly when the DAIOps manager bot is on for this server and the detail screen shows New bot

Before you start

  • You must be signed in to the Telegram app on your phone or PC, or to Telegram Web
  • Create the bot with a Telegram account dedicated to the employee rather than a personal one. If the person who made it leaves or loses the account, the bot is lost with it
  • You must be a manager of that employee

1. Connect a bot made with BotFather

Create the bot in BotFather

  1. In Telegram, open @BotFather. The official account has a blue verification mark next to its name
  2. Send /newbot
  3. Send the bot name (the name people see). Example: Jeomsun
  4. Send the username. Use 5 to 32 characters: letters, digits and underscores only, and it must end in bot. Example: gemmy_jeomsun_bot. You cannot change it later
  5. BotFather sends a message that starts with Done! Congratulations on your new bot. The line under Use this token to access the HTTP API: is the bot token. It looks like 123456789:AA…: digits, a colon, then a run of letters and digits

Anyone with the token can control this bot. Do not paste it in chats or documents. If it leaks, send /token to BotFather to get a new one and connect again.

Enter it in DAIOps

  1. In the left sidebar under Employees, pick the employee, then open the Settings tab at the top → the Integrations chip (the Settings item in the sidebar is your account settings, not this). Under "Channels", click Connect on the Telegram row. Its detail screen opens, with "Integrations › (name)" at the top
  2. Paste the whole token into the Bot token field and click Connect. If the detail screen shows New bot, the field is under "Connect your own bot"

You are done when: "Telegram bot connected" appears, and the detail screen shows "Connected as the (bot name) bot" and @username.

2. Create a new bot from DAIOps (fast way)

  1. On the same screen as way 1, "Enter it in DAIOps" step 1 (employee → Settings tab → Integrations chip), click Connect on the Telegram row. Its detail screen opens, with "Integrations › (name)" at the top
  2. Click New bot. The detail screen shows "When Telegram opens, tap Create bot" and Telegram opens
  3. In Telegram, a chat with the DAIOps manager bot opens with the message "Let's create the Telegram bot for (employee name). Tap the button below and confirm the bot name" and a Create bot button
  4. Tap Create bot and Telegram's bot creation window appears. Check the filled-in bot name and username and create it. You can change the name in this window
  5. The manager bot sends "@username is now connected to the employee. Message this bot to start"

The link works for 30 minutes. After that, click New bot again.

You are done when: the DAIOps detail screen shows "Connected as the (bot name) bot" and @username.

3. Set what the employee does on this connection

Under What the employee does on this connection at the bottom of the detail screen, choose the scope. Anyone can message a Telegram bot, so start with Chat and lookups only. Widen it to Send and write too when you need email or messenger sending. Approval is required before anything is sent.

4. Message the bot to check

  1. In Telegram, find @username and open the chat
  2. Send any message

If the employee replies, the connection is done. In a group, the bot replies only when you mention it as @username or reply to one of its messages. Do not change /setprivacy in BotFather.

Customize the bot (optional)

Send /mybots to BotFather, pick the bot, and change things under Edit Bot.

  • Edit Botpic: profile picture
  • Edit Description: the intro text shown when someone first opens the chat
  • Edit About: the short intro on the profile
  • To stop the bot from being added to groups, use /setjoingroups and choose Disable

Common problems

Message on screenWhat to do
The token format isn't right. Enter the full token from BotFatherCheck that the token isn't cut off at either end, and paste the whole thing again
The token isn't valid. Check the token in BotFatherCheck the token in BotFather again. If you got a new one with /token, enter the new one
The bot was verified, but the address for receiving messages couldn't be registered. Please try again shortlyClick Connect again shortly
The bot token changed, so the connection stopped. Connect again with the new tokenYou got a new token in BotFather. Enter it on the detail screen and click Connect. For a bot made the second way, DAIOps reattaches it on its own
No "New bot" on the detail screenThe DAIOps manager bot isn't turned on for this server. Use way 1
No Telegram bot row under IntegrationsIt exists only on the cloud edition. The office install doesn't support Telegram yet

References

This connection gives the employee its own bot. It is different from Telegram Business business bots, which answer chats sent to your own Telegram account, and that mode isn't supported.

Other messengers

Connecting a LINE Official Account · Connecting a WhatsApp number · Connecting a KakaoTalk channel chatbot · Connecting a WeChat Work AI bot