Gem: Telegram How To

Add AI to chats: guest bots, streaming and chat automation

What it is

Since May 2026, anyone can call a Guest Mode bot into any private or group chat by tagging its @username, even if it isn't a member. Streaming shows the answer as it's generated; chat automation lets people connect your bot to their profile to reply for them.

How to do it

  1. In @BotFather's Mini App, open your bot's settings and enable Guest Mode; `getMe` then shows `supports_guest_queries`.
  2. A tag, or a reply to the bot, brings a `guest_message` update with `guest_query_id` and any replied-to message.
  3. Reply once with `answerGuestQuery`, passing the `guest_query_id` and a `result`… Reply once with `answerGuestQuery`, passing the `guest_query_id` and a `result` shaped like an inline result; it returns a `SentGuestMessage`.
  4. Streaming, in private chats: repeat `sendMessageDraft` with one `draft_id` as… Streaming, in private chats: repeat `sendMessageDraft` with one `draft_id` as text grows (empty text shows "Thinking…"), then send the final `sendMessage`. With `can_stop`, a Stop tap brings `stopped_message_generation`.
  5. Chat automation: enable Secretary Mode in @BotFather; people connect the bot in… Chat automation: enable Secretary Mode in @BotFather; people connect the bot in Settings › Chat Automation and choose its chats.

Watch out

With Gem

Gem doesn't offer guest mode, streaming or chat automation for your bot. Nearby: @gembot answers in your project's groups, and Gem apps get the `gem` library (`gem.ask`, `gem.kb`, `gem.event`; docs at apps.gem.bot/docs).

Sources

Open in Telegram ↗