The AI assistant in Telegram: ask the site's bot from your phone
Describes AI Agent 0.3.0.
The AI assistant can answer in Telegram. A person who linked their Telegram chat to the site’s bot writes to the bot, and the assistant answers there with that person’s own rights, model, instructions and limits, as it would in the chat panel.
Where to find it
The switch is in the admin under Settings, then AI Agent (/admin/settings/agent), in the Assistant in Telegram card. You need the Manage the AI assistant permission to change it. It is off by default.
Three things must be in place before the assistant answers anyone:
- the site has a website bot for user notifications, set up in the Telegram integration;
- Answer in Telegram is on and saved;
- the person’s role holds both the AI Agent permission and Agent in Telegram (“Use the AI assistant from the Telegram chat linked to the site bot, with the user’s own rights: it reads data and proposes changes the user confirms”). No role gets Agent in Telegram by itself, Admin included: grant it in Roles.
Each person then links their own private chat with the bot under Profile → Telegram on the site.
Assistant in Telegram, switched off here.
The status line
Under the switch, Status says what the bot reader is doing, with the bot’s name when it is known:
- Off: the assistant does not answer in Telegram.
- Switched on. The reader starts within half a minute.
- Reading the bot’s messages.: all is working.
- No website bot is chosen for user notifications, so there is no chat to answer. Choose one in the Telegram integration.
- The bot has a webhook set, so its messages cannot be read. Remove the webhook.
- Conflict: the bot is read by someone else (another reader or a webhook). The reader waits and tries again.
- No default model is chosen, so only users with a model of their own are answered.
Writing to the bot
Write a question in plain text and the bot answers it. Messages in one chat are answered in order, one at a time, and up to three more can wait their turn. A message beyond that gets Wait a little: I am still answering your previous message.
/newstarts a new conversation and the bot says Started a new conversation./help(or/start) says what the bot reads.
A conversation from Telegram is also listed in the site’s chat panel with a Telegram badge, so you can read it and go on with it there.
The bot does not answer forwarded messages (I do not read forwarded messages. Put it in your own words.), group chats or edited messages. A chat that is not linked gets This chat is not linked to an account. Link it on the site: Profile → Telegram, and a person whose role may not use it gets You may not use the assistant in Telegram.
Pictures and voice messages
A photo, or a png, jpeg or webp image sent as a file, goes into the conversation like a picture attached in the panel, with the same limits and the same model or vision model. The caption is the question. Several photos sent together are one question with one answer. PDFs and sheets are not taken from Telegram. Which picture types the bot takes follows Types of file in chats in Settings > AI Agent.
When a speech recognition model is chosen in Settings > AI Agent, a voice message or an audio file is written down first. The bot shows 🎙 Recognised: with the words, then answers them like a typed message. A recording longer than two minutes or larger than 10 MB is refused, and so is one in which no speech is heard. The audio and the words are not kept.
Changes
The assistant never changes anything by itself. A change it wants to make arrives as a message headed Confirm this change:, with a preview and the buttons ✅ Confirm and ❌ Cancel. Nothing happens until you press ✅ Confirm. The message is then edited to what became of it, for example ✅ Done, ❌ Cancelled or ⌛ The time to confirm ran out. Ask again., also when the change was settled on the site. See the guide on confirming the assistant’s changes.
Before each answer, card and retry is sent, the bot checks again that the chat is still linked to the same person and that they may still use the assistant there.
Limits and spending
Telegram uses the person’s own limits from AI Agent > Users or Settings > AI Agent. Its turns and costs, picture descriptions and voice recognition included, count together with the chat panel’s on AI Agent > Spending.
What it doesn’t do
- It does not answer in groups or channels, only in a person’s private chat with the bot.
- It does not read PDFs, sheets or text files sent in Telegram.
- It does not work with a bot that has a webhook set.
- It does not link chats itself: each person links theirs under Profile → Telegram.
For developers
The host lets the module read the bot by adding config :phoenix_kit, :telegram_updates_reader, {PhoenixKitAgent.Telegram.Reader, :holds?, []}. The setting behind the switch is agent_telegram_enabled. One reader polls the bot for the whole cluster, and an update is answered at most once. See the module README.