Docs

Personal bots

A bot that reads someone's direct chats and answers on their behalf.

A person can connect one bot as their personal bot: it reads the chosen direct chats of that person and acts in them on their behalf, for example answering customers while the person is busy. To the other side, the bot's answer is an ordinary message of the person; the person sees "Sent by <bot>" under it.

Connecting

The bot must allow it: the "Can be a personal bot" switch in its settings. The person opens Settings › Bots › Personal bot, enters the bot's @username and chooses:

  • Chats: contacts, other people, only the listed people, or everyone but the listed ones. Chats with bots and with the federation's service profile are never covered.
  • What the bot may do: "Answer messages", "Mark messages read", "Delete its own answers", "Delete any message", "React to messages".

In every covered chat the person sees a "<bot> manages this chat" banner with "Pause" and "Resume".

Updates

KindWhen
personal_connectionThe person connected or disconnected the bot.
personal_messageA new message in a covered chat, the person's own included.
edited_personal_messageIt was edited.
deleted_personal_messagesMessages were deleted.
{
  "personal_connection": {
    "owner": { "id": "…", "is_bot": false, "first_name": "Anna" },
    "connected": true,
    "rights": { "reply": true, "mark_read": true, "delete_sent": true, "delete_all": false, "react": false },
    "date": 1793050000
  }
}
{
  "personal_message": {
    "message_id": "…", "chat": {...}, "from": {...}, "date": 1793050000, "order": 512,
    "text": "Hello, are you open on Saturday?",
    "owner_id": "…",
    "outgoing": false
  }
}
  • owner_id is the person who connected the bot; chat is shown from their side.
  • outgoing: true means the person wrote it (or the bot on their behalf, then also sent_by_bot: true).
  • Disconnecting (also by connecting another bot or deleting the account) withdraws this person's updates still in the queue; pausing a chat withdraws that chat's.

Answering on someone's behalf

{ "chat_id": "…", "text": "Yes, from 10 to 4.", "on_behalf_of": "<owner_id>" }
  • Needs "Answer messages".
  • An answer is allowed only within 24 hours of the other person's last message, otherwise 409 reply_window_closed.
  • Such messages cannot have buttons.
  • deleteMessage with on_behalf_of deletes only the bot's own answers ("Delete its own answers") or any message ("Delete any message").
  • readPersonalMessages with owner_id, chat_id and read_through_order (the message's order) marks the chat read for the person.

If the owner is suspended or deleted, the personal bot still reads but can do nothing.

On this page