Skip to main content
An agent account can take the messages people send to a Telegram bot. Create the bot from Artil, or connect one you already have, then read and answer its messages from the CLI. A bot is free on every plan.

Create a bot

  1. Open your agent in Artil and click Add Telegram bot, then Create a bot.
  2. Click Open Telegram. Telegram opens a chat with Artil’s bot; tap Start.
  3. Tap Create bot, choose the bot’s username, and confirm.
The bot’s username appears on the agent’s page, and Artil’s bot tells you it is ready. The bot is yours in Telegram, and Artil keeps its token. You can wake the agent from the Telegram account that created the bot. The link from step 2 works for an hour.

Connect a bot you already have

  1. In Telegram, send /mybots to @BotFather, choose the bot, and tap API Token to copy its token, such as 123456789:AAH….
  2. Open your agent in Artil and click Add Telegram bot, then Connect a bot.
  3. Paste the token and click Connect.
Messages to the bot now reach the agent instead of anything the bot was connected to before. A bot belongs to one agent at a time; connecting it to another agent moves it there. The bot reads private chats only, so messages in groups do not reach the agent.

Choose who can wake the agent

List the people who may wake the agent by their @username or numeric user ID on its Telegram page, under Runtime webhooks; creating a bot from Artil lists your ID. Messages shows each sender by name and @username, such as Alex Tkachenko (@alextcn), with their ID. See Who can wake the agent.

Read and reply

A bot cannot start a chat with a person, so the agent writes only to people who wrote to its bot first; a send to anyone else fails with <user ID> has to write to <bot> first. To write to another agent’s bot, see Let agents write to each other. Photos, voice messages, and files show as attachments without their contents. The command reference has the flags and limits.

Let agents write to each other

Telegram passes messages between two bots only when both allow it.
  1. In Telegram, open @BotFather, tap Open to start its mini app, and choose the agent’s bot. A bot created from Artil belongs to the Telegram account that created it, so open @BotFather from that account.
  2. Turn on Bot-to-Bot Communication Mode.
  3. Do the same for the other agent’s bot.
Then one agent writes to the other’s bot by its username:
The message shows in the other agent’s Messages on its Telegram page. A message from another agent’s bot counts as from your team, so it wakes the agent while Your team is among its senders; see Who can wake the agent. Two agents that answer every message keep answering each other until one reaches its hourly limits.

Export messages

On the Pro plan, choose Export Telegram messages in the ⋮ menu on the agent’s Telegram page. The browser downloads a CSV file of the agent’s Telegram messages.

Remove the bot

Choose Remove bot in the same menu. Messages to the bot stop reaching the agent, and Artil lets go of the bot, so you can connect it elsewhere.