A-chat for developers

Bot API reference

This page lists every method the A-chat Bot API has today, its parameters and what it returns, and every object it sends. What is particular to A-chat is collected in Notes at the end.

For a first bot, start with Bots: getting started.

Making requests

https://api.a-chat.app/bot<token>/<method>

Methods that are not on this page answer 404.

Identifiers

Answers

A successful call:

{ "ok": true, "result": <the method's result> }

A failed call:

{ "ok": false, "error_code": 400, "description": "Bad Request: message text is empty" }

A 429 also has parameters, and the HTTP answer has a Retry-After header:

{ "ok": false, "error_code": 429, "description": "Too Many Requests: retry after 2", "parameters": { "retry_after": 2 } }

The HTTP status equals error_code.

Common errors

Code Description Meaning
400 Bad Request: <what> A parameter is missing or wrong. The text says which.
400 Bad Request: chat not found No such person or chat for this bot.
400 Bad Request: can't parse entities: <what> A wrong HTML tag, or wrong entities. See Formatting.
400 Bad Request: method is available for supergroup and channel chats only A group method was called for a private chat.
400 Bad Request: unsupported content type The body is not JSON, a form or multipart.
401 Unauthorized The token is wrong, was revoked or was replaced.
403 Forbidden: bot can't initiate conversation with a user The person has not written to the bot.
403 Forbidden: bot was blocked by the user The person blocked the bot.
403 Forbidden: the bot is frozen by the team The A-chat team froze the bot. Every call answers this.
403 Forbidden: bot is not a member of the chat A group or channel the bot is not in.
403 Forbidden: bot was kicked from the chat The bot was removed and banned from that group.
403 Forbidden: not enough rights to send messages to the chat The bot may not post there.
403 Forbidden: not enough rights to send voice notes to the chat The person does not take voice messages.
404 Not Found: method not found No such method. A malformed address answers 404 Not Found too.
409 Conflict: can't use getUpdates method while webhook is active; use deleteWebhook to delete the webhook first Long polling while a webhook is set.
413 Request Entity Too Large The body or the file is too big.
429 Too Many Requests: retry after N Too many calls. Wait retry_after seconds.
500 Internal Server Error Something failed on our side. Try again later.
503 Service Unavailable: ... The bot platform is switched off, or a part of it cannot be reached. Try again later.

Limits

What Limit
Calls of one bot By the bot’s level: 30, 100 or 300 a second, counted over 2 seconds (429, retry_after 1)
Service calls of one bot 300 a second, counted apart from the rest (429, retry_after 1)
Calls from one IP address 60,000 a minute (429, retry_after 5)
Calls from one IP address with a wrong token 3,000 a minute (429, retry_after 5)
Messages into one private chat 30 in 10 seconds (429, retry_after 2)
Messages into one group or channel 60 a minute (429, retry_after 10)
Groups and channels the bot is added to By the bot’s level: 10, 50 or 200 a day
Files sent at once When the server is busy with uploads, a file method answers 429, retry_after 2

Each message of sendMediaGroup, forwardMessages and copyMessages counts as one message.

Service calls send nobody anything: getUpdates, getMe, getFile, getChat, getChatMember, getWebhookInfo, answerCallbackQuery, answerInlineQuery, answerWebAppQuery and sendChatAction. A button pressed is answered even while your bot is writing to many people.

Text lengths are counted in UTF-16 code units. Leading and trailing spaces of a text are removed.

Bot levels

A new bot starts with lower limits. They grow with the bot’s age and the number of people who started it.

Level When API calls Added to groups and channels
new Under 3 days old and under 100 people 30 a second 10 a day
growing Otherwise, under 30 days old and under 1,000 people 100 a second 50 a day
full Everything else 300 a second 200 a day

The level is checked again about every 10 minutes. The A-chat team can give a bot the full level at once, or a higher number of calls. The owner sees the level in the bot’s statistics (My bots, or /stats in @achatbot).

Getting updates

getUpdates

Long polling. Returns the waiting updates, oldest first. Waits up to timeout seconds when there are none.

Parameter Type Required Description
offset Integer No The first update to return. Updates with a smaller update_id are confirmed and removed. Pass the last update_id + 1. A negative value returns only the last -offset updates.
limit Integer No 1 to 100. Default 100.
timeout Integer No Seconds to wait, 0 to 50. Default 0.
allowed_updates Array of String No The update kinds to receive. Kept for later calls and for the webhook. An empty array means the default kinds. Not given: the last setting stays.

Returns an array of Update.

Answers 409 while a webhook is set. A wait also ends early, with an empty array, when the token is replaced or revoked, or a webhook is set.

Names accepted in allowed_updates: message, edited_message, channel_post, edited_channel_post, callback_query, inline_query, chosen_inline_result, my_chat_member, chat_member, poll, poll_answer, message_reaction, message_reaction_count, chat_join_request. chat_member, message_reaction and message_reaction_count are sent only when you name them.

setWebhook

Sets an address that receives every update as a POST with a JSON Update body.

Parameter Type Required Description
url String Yes https address, up to 2,048 characters, on port 443, 80, 88 or 8443, on the public internet. An empty string removes the webhook.
secret_token String No 1 to 256 of A-Z a-z 0-9 _ -. Sent in the X-Bot-Api-Secret-Token header.
max_connections Integer No 1 to 100. Default 40. Kept and shown by getWebhookInfo; updates are posted one at a time.
allowed_updates Array of String No As in getUpdates.
drop_pending_updates Boolean No Remove the waiting updates.

Returns true.

How updates are posted:

certificate and ip_address are not supported. Use a certificate from a public authority.

deleteWebhook

Removes the webhook. Long polling works again.

Parameter Type Required Description
drop_pending_updates Boolean No Remove the waiting updates.

Returns true.

getWebhookInfo

No parameters. Returns a WebhookInfo.

The bot

getMe

No parameters. Returns a User with these extra fields:

Field Type Description
can_join_groups Boolean The bot may be added to groups.
can_read_all_group_messages Boolean Privacy mode is off: the bot gets every message of a group.
supports_inline_queries Boolean Inline mode is on.
has_main_web_app Boolean A live mini app with a key is linked to the bot.

Messages

The bot can write only to a person who wrote to it and has not blocked it, and to the groups and channels it is in.

sendMessage

Parameter Type Required Description
chat_id Integer or String Yes The person’s number, a group’s or channel’s negative id, or the @username of a public group or channel the bot is in.
text String Yes 1 to 4,096 characters after parse_mode is applied.
parse_mode String No HTML, MarkdownV2 or Markdown. See Formatting.
entities Array of MessageEntity No The marks of text, instead of parse_mode.
reply_markup Object No InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove or ForceReply.
reply_parameters ReplyParameters No The message to answer.
reply_to_message_id Integer No The older way to name the message to answer.
disable_notification Boolean No Deliver without a notification.
protect_content Boolean No Ignored. A group’s or channel’s own protected content still applies.
message_thread_id Integer No A topic of a group.

Returns the sent Message.

editMessageText

Changes the text of a message the bot sent, or of a message sent via the bot.

Parameter Type Required Description
chat_id Integer or String Without inline_message_id As in sendMessage.
message_id Integer Without inline_message_id The message.
inline_message_id String Without chat_id and message_id A message sent via the bot. See Inline messages.
text String Yes The new text, 1 to 4,096 characters.
parse_mode String No As in sendMessage.
entities Array of MessageEntity No As in sendMessage.
reply_markup InlineKeyboardMarkup No The new buttons. Without it, the buttons are removed.

Returns the edited Message, or true for an inline_message_id.

editMessageCaption

Changes the words of a message with a file: a message the bot sent, or one sent via the bot.

Parameter Type Required Description
chat_id, message_id, inline_message_id As in editMessageText.
caption String Yes The new words, 1 to 1,024 characters. A caption cannot be removed yet: an empty one answers 400.
parse_mode String No For the caption. See Formatting.
caption_entities Array of MessageEntity No The marks of the caption, instead of parse_mode.
reply_markup InlineKeyboardMarkup No The new buttons. Without it, the buttons are removed.

Returns the edited Message, or true for an inline_message_id.

editMessageReplyMarkup

Changes only the buttons of a message the bot sent, or of a message sent via the bot.

Parameter Type Required Description
chat_id, message_id, inline_message_id As in editMessageText.
reply_markup InlineKeyboardMarkup No The new buttons. Without it, or with no buttons, the buttons are removed.

Returns the edited Message, or true for an inline_message_id.

To change the file of a message, see editMessageMedia.

deleteMessage

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
message_id Integer Yes The message.

In a private chat, only the bot’s own messages. In a group, what a member with the bot’s role and rights may delete. A message sent via the bot (inline_message_id) cannot be deleted by the bot.

Returns true.

sendChatAction

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
action String Yes Any action name (typing, upload_photo…).
message_thread_id Integer No A topic of a group.

Every action is shown as “typing”. In a private chat the person sees it; in a group, every member does (in the topic, when given). A channel shows nothing.

Returns true.

getChat

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.

Returns a Chat. For a group or channel it may also have description and invite_link.

getChatMember

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
user_id Integer Yes The person’s number, or the bot’s own.

Returns a ChatMember. In a private chat, only the person and the bot are known: both are member.

getChatMemberCount

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.

Returns an Integer. A private chat answers 2. A group counts its people, not its bots.

Formatting

A text or a caption can carry marks: bold, italic, underline, strikethrough, spoiler, code, a code block, a link on words, a quote, a sticker in place of words (custom_emoji) and a mention of an account by its number (text_mention). Give them in one of two ways:

This works in sendMessage, editMessageText, editMessageCaption, the captions of the file methods and of sendMediaGroup, the caption of copyMessage, the words and captions of inline results, and so in answerWebAppQuery. Any other parse_mode answers 400 Bad Request: unsupported parse_mode.

The message keeps the plain words and the marks. The apps draw the marks. Mentions by @name, #hashtags and plain links are found in the words by the apps; they are never marks you give.

HTML

Tags Mark
<b>, <strong> bold
<i>, <em> italic
<u>, <ins> underline
<s>, <strike>, <del> strikethrough
<spoiler>, <span class="spoiler"> spoiler
<code> code
<pre>, <pre><code class="language-python"> code block, with its language
<a href="https://..."> link on words (http or https only)
<a href="a-chat://user?id=7000000042"> mention of that account (text_mention)
<emoji id="..."> a sticker in place of the words (custom_emoji); the id as in MessageEntity
<blockquote> quote
<b>Order 42</b> is <i>ready</i>.
<spoiler>Code: 7731</spoiler>
<pre><code class="language-python">print("hello")</code></pre>
<a href="https://example.com/orders/42">Open the order</a>
Ask <a href="a-chat://user?id=7000000042">Anna</a>.

MarkdownV2

Write Mark
*bold* bold
_italic_ italic
__underline__ underline
~strikethrough~ strikethrough
||spoiler|| spoiler
`code` code
```python … ``` code block; the word after the opening ``` is the language
[words](https://example.com) link on words
[name](a-chat://user?id=7000000042) mention of that account
[😀](emoji:<id>) a sticker in place of the words
> at the start of a line quote, for every line that starts with >

A backslash shows the next character as it is: \*, \_, \.. A mark that is never closed is removed from the text without an error. Escape it when you mean the character.

Markdown

The older, smaller form: *bold*, _italic_, `code`, ``` code blocks and [words](https://example.com) (mentions and stickers as in MarkdownV2). A backslash escapes only *, _, ` and [.

entities

Give the marks yourself, with offsets in the text as it is sent:

{
  "chat_id": 7000000042,
  "text": "Hello, world! Open the site. Ask Anna.",
  "entities": [
    { "type": "bold", "offset": 0, "length": 5 },
    { "type": "text_link", "offset": 14, "length": 13, "url": "https://example.com" },
    { "type": "text_mention", "offset": 33, "length": 4, "user": { "id": 7000000042 } }
  ]
}

Spaces at the start and the end of a text are removed, and the marks move with the words.

Forwards and copies

forwardMessage

Sends a message again, showing who wrote it first.

Parameter Type Required Description
chat_id Integer or String Yes Where to send it. As in sendMessage.
from_chat_id Integer or String Yes The chat the message is in: a person who started the bot, or a group or channel the bot is in.
message_id Integer Yes The message in from_chat_id.
message_thread_id Integer No A topic of the target group.
disable_notification Boolean No As in sendMessage.

Returns the sent Message, with forward_origin. A forward of a forward names the first author.

copyMessage

Sends a message again as the bot’s own, without a link to the original.

Parameter Type Required Description
chat_id, from_chat_id, message_id, message_thread_id, disable_notification As in forwardMessage.
caption String No Up to 1,024 characters. Replaces the words of the copy.
parse_mode String No For the caption. See Formatting.
caption_entities Array of MessageEntity No For the caption.
reply_markup InlineKeyboardMarkup No Buttons under the copy.
reply_parameters, reply_to_message_id No As in sendMessage.

Returns a MessageId.

forwardMessages

Forwards several messages of one chat at once, as forwardMessage does.

Parameter Type Required Description
chat_id, from_chat_id, message_thread_id, disable_notification As in forwardMessage.
message_ids Array of Integer Yes 1 to 100 messages of from_chat_id.

Returns an array of MessageId, in the order of the numbers. A message that is not there, or cannot be forwarded, is passed over.

copyMessages

Copies several messages of one chat at once, as copyMessage does. Each copy keeps its own words.

Parameter Type Required Description
chat_id, from_chat_id, message_thread_id, disable_notification As in forwardMessage.
message_ids Array of Integer Yes 1 to 100 messages of from_chat_id.

Returns an array of MessageId, as forwardMessages.

For all four:

Polls

sendPoll

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
question String Yes 1 to 300 characters.
options Array of String or InputPollOption Yes 2 to 12 answers, each 1 to 100 characters.
is_anonymous Boolean No Default true. A poll in a channel must be anonymous.
type String No regular (default) or quiz.
allows_multiple_answers Boolean No People may pick several answers. Not for a quiz.
correct_option_id Integer For a quiz The right answer, from 0.
explanation String No A quiz only: up to 200 characters of plain words, shown after the vote.
reply_markup InlineKeyboardMarkup No Buttons under the poll.
reply_parameters, reply_to_message_id No As in sendMessage.
disable_notification, message_thread_id No As in sendMessage.

Returns the sent Message, with poll in place of text.

After every vote the bot gets a poll update with the new counts. For a poll that is not anonymous it also gets poll_answer: who voted and for what. An empty option_ids means the person took the vote back. In a quiz a vote is final: it cannot be changed or taken back.

stopPoll

Closes a poll the bot sent. Nobody can vote after that.

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
message_id Integer Yes The message with the poll.

Returns the closed Poll.

Reactions

setMessageReaction

Puts the bot’s reaction on a message, or takes it away.

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
message_id Integer Yes The message.
reaction Array of ReactionTypeEmoji No One emoji. Only the first is used. Empty or absent: the bot’s reaction is removed.

Returns true. A reaction that is not an emoji answers 400 Bad Request: REACTION_INVALID. In a group, the group’s reaction rules apply.

When a person changes their reactions, the bot gets message_reaction, but only when it names message_reaction in allowed_updates. In a group, only admin bots get it. Admin bots of a group or channel can also get message_reaction_count, the totals of every emoji, when they name it. A channel’s reactions are anonymous: there it sends only message_reaction_count.

Locations and contacts

sendLocation

Sends a place on the map, as the apps’ own location message.

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
latitude Float Yes -90 to 90.
longitude Float Yes -180 to 180.
horizontal_accuracy Float No Meters, up to 1,500.
reply_markup Object No As in sendMessage.
reply_parameters, reply_to_message_id No As in sendMessage.
disable_notification, message_thread_id No As in sendMessage.

Returns the sent Message, with location. A bot sends no live location: live_period answers 400.

sendVenue

A place with a name and an address.

Parameter Type Required Description
chat_id, latitude, longitude Yes As in sendLocation.
title String Yes The place’s name.
address String No Its address.
reply_markup, reply_parameters, reply_to_message_id, disable_notification, message_thread_id No As in sendMessage.

Returns the sent Message, with location and venue. The apps show the title as the place’s name, with the address under it.

sendContact

Shares an A-chat account, as the apps’ own contact message. A-chat never shares phone numbers.

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
user_id Integer Yes The account’s number for bots. The account must have an @name.
first_name String No The name to show on the card. Default: the account’s display name.
reply_markup, reply_parameters, reply_to_message_id, disable_notification, message_thread_id No As in sendMessage.

Returns the sent Message, with contact. phone_number is not read; without user_id the call answers 400.

A place or a contact a person sends comes to the bot as location (with venue when the place has an address) or contact. That is also how the answers to the request_location and request_contact keys of a reply keyboard come.

Files

Sending a file

sendPhoto, sendVideo, sendDocument, sendVoice, sendAudio, sendAnimation, sendSticker.

The file goes in the parameter named after the method (photo, video, document, voice, audio, animation, sticker). It can be:

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
photo / video / document / voice / audio / animation / sticker InputFile or String Yes The file.
caption String No Up to 1,024 characters. Not for stickers.
parse_mode String No For the caption, as in sendMessage.
caption_entities Array of MessageEntity No The marks of the caption, instead of parse_mode.
thumbnail InputFile No sendVideo, sendAnimation, sendDocument, sendAudio: a small picture for a new file (an upload or attach://<part name>, not a link or a file_id). JPEG or PNG, up to 200 KB and 320×320.
width, height Integer No The picture’s or video’s size. Kept as given.
duration Integer No Seconds, for video, voice and audio. Kept as given.
emoji String No sendSticker with a picture: the sticker’s emoji.
reply_markup Object No As in sendMessage.
reply_parameters, reply_to_message_id No As in sendMessage.
disable_notification, protect_content, message_thread_id No As in sendMessage.

Returns the sent Message, with the file object in it.

What each method takes. The type is taken from the part’s Content-Type, then from the file name, then from the file’s first bytes.

Method Types Sent as
sendPhoto JPEG, PNG, GIF, WebP A picture. For WebP give width and height.
sendVideo MP4, MOV, WebM A video.
sendVoice OGG/Opus, MP3, M4A, AAC, WebM, WAV A voice message.
sendAudio Any audio/* A document of that type; it comes back as audio.
sendAnimation GIF or MP4 Comes back as animation. A GIF is kept as a picture, an MP4 as a video.
sendDocument Anything A document.
sendSticker The file_id of a sticker the bot received, one of its sets’ stickers or a file of uploadStickerFile; or a PNG, WebP or GIF (an upload, or a link up to 8 MB) The same sticker; a picture becomes the bot’s own sticker of no set.

A file is up to 50 MB (413 when bigger). The size and length of a video or voice message are what you give. The server does not read them from the file.

A voice message to a person who does not take voice messages answers 403.

sendMediaGroup

Sends 2 to 10 files at once. Photos and videos together become an album: the apps show them as one group. Documents, or audio, go as messages one after another; they cannot be mixed with other kinds.

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
media Array of InputMedia Yes 2 to 10 items of type photo, video, document or audio. Each has its own caption.
reply_parameters, reply_to_message_id No The first item answers that message.
disable_notification, message_thread_id No As in sendMessage.

Returns an array of the sent Message, one for each item. The items of an album have the same media_group_id. Buttons cannot be sent with a group.

editMessageMedia

Puts another file into a message of the bot that has a file.

Parameter Type Required Description
chat_id Integer or String Yes As in sendMessage.
message_id Integer Yes The message.
media InputMedia Yes The new file: photo, video, document, audio or animation. Its caption, when given, replaces the words.
reply_markup InlineKeyboardMarkup No The new buttons. Without it the buttons stay.

Returns the edited Message. A message without a file answers 400 Bad Request: message to edit not found or has no file. A message sent via the bot (inline_message_id) answers 400.

getFile

Parameter Type Required Description
file_id String Yes A file the bot received or sent, or a small copy of one.

Returns a File with file_path. Files over 20 MB answer 400 Bad Request: file is too big. Stickers cannot be downloaded. A small copy (a photo’s smaller size, a thumbnail) has a file_path of thumbnails/<file_id>.jpg.

Downloading a file

GET https://api.a-chat.app/file/bot<token>/<file_path>

The answer is a 302 redirect to a signed link that works for 5 minutes. Follow redirects (curl -L). The link is gone, with 404, when the messages that held the file are deleted.

Stickers

A bot can make sticker sets of its own. They are sets like the ones people make in the apps: people can add and send them. A bot acts only on its own sets; any other set answers 400 Bad Request: STICKERSET_INVALID.

A sticker’s picture is a PNG, a WebP or a GIF. It can be an upload, attach://<part name>, an https link (up to 8 MB), or the file_id from uploadStickerFile.

uploadStickerFile

Uploads a picture to use in the set methods.

Parameter Type Required Description
sticker InputFile or String Yes The picture.

user_id and sticker_format are not read. Returns a File with file_id and file_unique_id. Use the file_id as sticker of an InputSticker.

createNewStickerSet

Parameter Type Required Description
name String Yes 5 to 32 of a-z, 0-9 and _, starting with a letter. The set’s name for the other methods.
title String Yes 1 to 64 characters.
stickers Array of InputSticker Yes 1 to 50 stickers.

user_id is not read: the set belongs to the bot. Returns true.

addStickerToSet

Parameter Type Required Description
name String Yes The set.
sticker InputSticker Yes The new sticker.

Returns true.

getStickerSet

Parameter Type Required Description
name String Yes One of the bot’s sets.

Returns a StickerSet. Its stickers’ file_id work in the methods below and in sendSticker.

setStickerPositionInSet

Parameter Type Required Description
sticker String Yes The sticker’s file_id.
position Integer Yes Its new place, from 0.

Returns true.

deleteStickerFromSet

Parameter Type Required Description
sticker String Yes The sticker’s file_id.

Returns true.

setStickerEmojiList

Parameter Type Required Description
sticker String Yes The sticker’s file_id.
emoji_list Array of String Yes Only the first emoji is kept.

Returns true.

setStickerSetTitle

Parameter Type Required Description
name String Yes The set.
title String Yes 1 to 64 characters.

Returns true.

deleteStickerSet

Parameter Type Required Description
name String Yes The set.

Returns true.

Keyboards and callbacks

reply_markup

reply_markup of sendMessage, the file methods, sendLocation, sendVenue and sendContact is one of:

The edit methods, copyMessage and sendPoll take only an inline keyboard.

The apps draw inline keyboards, and the reply keyboard of the bot’s newest message that has one, in private chats and in groups (request_contact sends the person’s profile card after their yes; request_location sends their place after their yes, in the phone app). remove_keyboard and force_reply take the keyboard away. In a group, a keyboard with selective is shown only to the people the message mentions and to the author of the message it answers; without it, to every member.

The phone app shows at most 12 rows and 48 buttons of an inline keyboard.

answerCallbackQuery

Answers a press of a callback_data button.

Parameter Type Required Description
callback_query_id String Yes id of the CallbackQuery.
text String No Up to 200 characters, shown as a toast.
show_alert Boolean No Show text as an alert instead.
url String No An https link to open.
cache_time Integer No Ignored.

Returns true.

Inline mode

Turn it on for the bot in My bots or with /setinline in @achatbot. See Inline mode.

answerInlineQuery

Parameter Type Required Description
inline_query_id String Yes id of the InlineQuery.
results Array of InlineQueryResult Yes Up to 50. Ids unique.
cache_time Integer No Seconds to keep this answer for the same query and offset. Default 300, at most 86,400. 0: not kept.
is_personal Boolean No Keep the answer for this person only.
next_offset String No Up to 64 bytes. Sent back as offset when the person scrolls to the end.
button InlineQueryResultsButton No A button above the results.

Returns true.

Inline messages

Every message a person sends via the bot has an inline_message_id of the bot. The bot learns it from a press of a callback_data button under that message: the CallbackQuery has inline_message_id and no message. Answer the press with answerCallbackQuery as usual.

The bot can then change the message wherever it is, with editMessageText, editMessageCaption and editMessageReplyMarkup and the inline_message_id in place of chat_id and message_id. They return true. editMessageMedia and deleteMessage do not take an inline_message_id.

Mini apps

A bot can be linked to a mini app. See Link a bot.

answerWebAppQuery

The bot answers a launch of its linked mini app with one result.

Parameter Type Required Description
web_app_query_id String Yes query_id of the launch’s initData. It works for 15 minutes, once.
result InlineQueryResult Yes One result, of any kind answerInlineQuery takes.

Returns a SentWebAppMessage.

Games

A bot can send HTML5 games: a card in the chat with the game’s cover, title and description, a Play button, and a table of records kept for that message. Games are free: nothing is bought inside a game. Register a game first: see Games.

sendGame

Parameter Type Required Description
chat_id Integer or String Yes A private chat or a group. Not a channel.
game_short_name String Yes The game’s short name from /newgame.
reply_markup InlineKeyboardMarkup No More buttons under the card. A callback_game button is accepted and dropped: Play is the card’s own button.
message_thread_id, disable_notification, reply_parameters No As in sendMessage.

Returns the sent Message, with game. A game waiting for review can be sent only into its owner’s own chat with the bot, to try it. 400 Bad Request: GAME_SHORT_NAME_INVALID, GAME_NOT_APPROVED or GAME_FROZEN otherwise.

Play

A press of Play reaches the bot as a CallbackQuery with game_short_name (and message or inline_message_id). The bot has 7 seconds to answer with answerCallbackQuery and a url: an https address on the game’s hosts, for example with a level or a room in it (another address answers 400 Bad Request: URL_INVALID). Without an answer the registered address opens.

The game opens in the mini-app window. The page gets initData, signed with your bot’s token:

Field Description
user JSON: the player, as in a mini app’s initData.
auth_date Unix time of the launch.
bot Your bot’s @name.
platform When known. As in a mini app’s initData.
game JSON: short_name, chat_instance, and chat_id with message_id, or inline_message_id: what setGameScore takes. Opened from Hub, a game has no message and no table.
hash The signature.

Check it on your server as a mini app’s initData is checked (How to check it), with the bot’s token in place of the app’s key, or call checkGameInitData.

setGameScore

Parameter Type Required Description
user_id Integer Yes The player. They must be in the chat (else 400 Bad Request: USER_NOT_PARTICIPANT).
score Integer Yes 0 or more.
force Boolean No Set the score even when it is not higher than the player’s (to correct it). Without it a lower or equal score answers 400 Bad Request: BOT_SCORE_NOT_MODIFIED.
disable_edit_message Boolean No Return true instead of the message.
chat_id, message_id Yes, or inline_message_id The game message.
inline_message_id String Yes, or chat_id and message_id A game sent via the bot.

Returns the Message, or true for an inline message or with disable_edit_message. The message itself is not edited: the apps draw the table under the card and keep it live. A score that beats the table’s best adds a line about the new record to the chat (in a chat of two, a new personal best).

getGameHighScores

Parameter Type Required Description
user_id Integer Yes The player to show with the places around them.
chat_id, message_id Yes, or inline_message_id The game message.
inline_message_id String Yes, or chat_id and message_id A game sent via the bot.

Returns an Array of GameHighScore: the first three, and the player with the two places around them.

checkGameInitData

Parameter Type Required Description
init_data String Yes The page’s initData as it came.

Returns {valid, user, game, auth_date}: valid is false for data not signed for this bot, or older than a day; the other fields come with valid data.

In inline mode

answerInlineQuery takes a result {type: "game", id, game_short_name, reply_markup} for a live game. The person sends it “via @yourbot”; each copy sent is a game of its own, with its own table and inline_message_id.

Commands and profile

setMyCommands

Parameter Type Required Description
commands Array of BotCommand Yes Up to 100. An empty array deletes the list.
scope BotCommandScope No Default: default.
language_code String No Two or three lowercase letters. Empty: for every language.

Returns true.

getMyCommands

Parameter Type Required Description
scope BotCommandScope No Default: default.
language_code String No As in setMyCommands.

Returns an array of BotCommand, exactly as set for that scope and language (empty when none).

deleteMyCommands

Same parameters as getMyCommands. Returns true.

setMyName

Parameter Type Required Description
name String Yes without language_code Up to 64 characters. With a language_code, an empty name removes that language’s name.
language_code String No Two or three lowercase letters. Empty: the default name.

Returns true.

getMyName

Parameter Type Required Description
language_code String No The language. Falls back to the default.

Returns { "name": "..." }.

setMyDescription

“What can this bot do?” on the start screen.

Parameter Type Required Description
description String No Up to 512 characters. Empty removes it.
language_code String No As in setMyName.

Returns true.

getMyDescription

language_code as in getMyName. Returns { "description": "..." }.

setMyShortDescription

The about line of the bot’s profile.

Parameter Type Required Description
short_description String No Up to 120 characters, one line. Empty removes it.
language_code String No As in setMyName.

Returns true.

getMyShortDescription

language_code as in getMyName. Returns { "short_description": "..." }.

The picture and the links (website, privacy policy, terms of use) are set in My bots and with @achatbot, not through the API.

setChatMenuButton

The button left of the message field in the bot’s chat.

Parameter Type Required Description
chat_id Integer No A person’s number: their own button. Without it: the button for everybody. Groups and channels answer 400.
menu_button MenuButton No The button. Absent, or default: back to the default, the list of commands.

A web_app button opens the bot’s own linked mini app: its url must be on that app’s hosts, else 400. Returns true.

getChatMenuButton

Parameter Type Required Description
chat_id Integer No A person’s number.

Returns the MenuButton that person sees (theirs, else the bot’s), or the bot’s when there is no chat_id. { "type": "commands" } when none was set.

setMyAttachments

Whether people see the paperclip (send a photo, a video, a file) in your bot’s chat. A new bot has none: turn it on when your bot reads files.

Parameter Type Required Description
enabled Boolean Yes true: the apps show the paperclip in the bot’s chat. false: they do not.

Returns true. Files that reach the bot anyway (a forwarded message) still come as before.

getMyAttachments

Returns { "enabled": true | false }.

setMyDefaultAdministratorRights

The admin rights the apps propose when a person adds the bot to a group or a channel as an admin.

Parameter Type Required Description
rights ChatAdministratorRights No The rights. Absent: none.
for_channels Boolean No Set the rights for channels. Default: for groups.

Returns true.

getMyDefaultAdministratorRights

Parameter Type Required Description
for_channels Boolean No As in setMyDefaultAdministratorRights.

Returns a ChatAdministratorRights with every field, false when not set.

Groups and channels

A bot can be a member or an admin of a group, and an admin of a channel. A group is a chat of type supergroup, a channel of type channel; both have a negative id, and a public one also an @username. A topic of a group is a message_thread_id.

The bot acts with the rights of its role there, as a person would: the group’s rights, slow mode, filters and closed topics apply to it too. A bot never becomes the owner of a group. A group left with only bots in it is deleted.

Adding a bot

The bot gets my_chat_member. After a startgroup link it also gets a message with /start@yourbot <parameter> from the person, with message_id 0.

A bot can be added only while its owner allows it: /setjoingroups in @achatbot, or the Groups button of the bot’s edit menu there. It is allowed by default. Each bot can be added to a limited number of groups and channels a day, by its level. Over the limit, the person sees that the bot cannot join today.

What the bot gets

Privacy mode is on by default. With it on, a bot in a group gets only:

A bot that is an admin, or has privacy mode off, gets every message. In a channel, a bot gets every post as channel_post. An edit of a message the bot would get comes as edited_message (edited_channel_post in a channel). Privacy mode is set with /setprivacy in @achatbot, or the Groups button of the bot’s edit menu there. getMe shows it as can_read_all_group_messages.

Other updates of groups and channels:

Update When Who gets it
my_chat_member The bot was added, made an admin, its rights changed, it was removed (left) or banned (kicked). In a private chat: the person blocked (member → kicked) or unblocked (kicked → member) the bot. The bot itself. Always sent.
chat_member Another member joined, left, was banned, restricted or promoted. Admin bots of the group, only when they name chat_member in allowed_updates.
chat_join_request A person asked to join a group or channel that approves new members. Admin bots of that chat.
message_reaction A person changed their reactions. Admin bots of the group, only when they name it.
message_reaction_count The reactions of a message changed. Admin bots of the group or channel, only when they name it.

Methods

These methods work only in groups and channels (in a private chat they answer 400 Bad Request: method is available for supergroup and channel chats only). The bot needs the right a person would need for the same act.

Method Parameters Returns Notes
getChatAdministrators chat_id Array of ChatMember Up to 200.
leaveChat chat_id true
banChatMember chat_id, user_id true Removes and bans the person until unbanChatMember. until_date is not read.
unbanChatMember chat_id, user_id true
restrictChatMember chat_id, user_id, permissions true See restrictChatMember.
setChatPermissions chat_id, permissions true See setChatPermissions.
promoteChatMember chat_id, user_id Always 400: only the owner of a chat makes admins.
pinChatMessage chat_id, message_id true
unpinChatMessage chat_id, message_id true message_id is required.
createForumTopic chat_id, name (1 to 128), icon_color ForumTopic icon_color is one of six: 7322096, 16766590, 13338331, 9367192, 16749490, 16478047.
closeForumTopic chat_id, message_thread_id true
reopenForumTopic chat_id, message_thread_id true

The invite links, join requests and the chat’s title, description and picture have their own sections below.

getChat, getChatMember, getChatMemberCount, sendMessage, the file methods, sendMediaGroup, sendLocation, sendVenue, sendContact, sendPoll, stopPoll, the edit methods, deleteMessage, the forward and copy methods, setMessageReaction and sendChatAction work in groups and channels too. message_thread_id in a send method writes into a topic.

restrictChatMember

Sets a member’s exceptions to the chat’s rights, as an admin does in the apps.

Parameter Type Required Description
chat_id Integer or String Yes The group.
user_id Integer Yes The member.
permissions ChatPermissions Yes The rights to change. A right not named stays as it is.

Returns true. getChatMember then shows the member as restricted, with each right as it stands.

setChatPermissions

Sets the chat’s own rights for every member.

Parameter Type Required Description
chat_id Integer or String Yes The group.
permissions ChatPermissions Yes Read: can_send_messages, can_send_polls, can_send_voice_notes, can_invite_users, can_pin_messages, can_change_info, can_manage_topics. A right not named stays as it is.

Returns true.

The bot needs the right to invite people.

Parameter Type Required Description
chat_id Integer or String Yes The group or channel.

Returns the chat’s main invite link, a String. It is not replaced.

Makes an additional link of the chat.

Parameter Type Required Description
chat_id Integer or String Yes The group or channel.
name String No Up to 32 characters.
expire_date Integer No Unix time when the link stops working, at least a minute ahead.
member_limit Integer No 1 to 99,999 people may join by it.
creates_join_request Boolean No People who use it ask to join, and an admin approves them. Not with member_limit.

Returns a ChatInviteLink.

Parameter Type Required Description
chat_id Integer or String Yes The group or channel.
invite_link String Yes The link, https://a-chat.app/join/<code>.

Returns the revoked ChatInviteLink.

Links are not changed after they are made: the method always answers 400. Make a new link and revoke the old one.

approveChatJoinRequest and declineChatJoinRequest

Answer a ChatJoinRequest, as an admin does in the apps.

Parameter Type Required Description
chat_id Integer or String Yes The group or channel.
user_id Integer Yes The person who asked.

Returns true.

Chat settings

The bot needs the right to change the chat’s info (can_change_info). The chat’s members see the change at once.

Method Parameters Returns Notes
setChatTitle chat_id, title true 1 to 128 characters.
setChatDescription chat_id, description true Up to 255 characters. Empty removes it.
setChatPhoto chat_id, photo true photo is an upload: JPEG, PNG or WebP, up to 5 MB.
deleteChatPhoto chat_id true

In groups and channels

Types

Fields marked optional are present only when they have a value.

Update

Field Type Description
update_id Integer Grows by one for each update of the bot.
message Message Optional. A new message in a private chat or a group, or data sent by a mini app (web_app_data).
edited_message Message Optional. An edit of a message the bot got, with edit_date.
channel_post Message Optional. A new post in a channel.
edited_channel_post Message Optional. An edit of a post in a channel.
callback_query CallbackQuery Optional. A button press.
inline_query InlineQuery Optional. An inline query.
chosen_inline_result ChosenInlineResult Optional. A result a person sent. Only with inline feedback on.
my_chat_member ChatMemberUpdated Optional. The bot’s own status changed: a person blocked or unblocked it, or it was added to or removed from a group.
chat_member ChatMemberUpdated Optional. Someone’s status changed in a group where the bot is an admin. Only when named in allowed_updates.
chat_join_request ChatJoinRequest Optional. A person asked to join a chat where the bot is an admin.
poll Poll Optional. New counts of a poll the bot sent.
poll_answer PollAnswer Optional. A vote in a poll of the bot that is not anonymous.
message_reaction MessageReactionUpdated Optional. A person changed their reactions on a message. Only when named in allowed_updates; in a group, only to admin bots.
message_reaction_count MessageReactionCountUpdated Optional. The reactions of a message in a group or channel changed. Only when named in allowed_updates; only to admin bots.

With no allowed_updates set, every kind above is sent except chat_member, message_reaction and message_reaction_count.

User

Field Type Description
id Integer The person’s or bot’s number.
is_bot Boolean true for a bot.
first_name String The display name. "User" when empty.
username String Optional. Without @.
language_code String Optional. The language of the person’s app.
is_plus Boolean Optional. Present only when true: the person has A-chat Plus.

There is no last_name. See What a bot knows about a person.

Chat

Field Type Description
id Integer A person’s number for a private chat; negative for a group or channel.
type String private, supergroup or channel.
first_name String Private. The person’s display name.
username String Optional. The person’s or the public chat’s username.
title String Group or channel. The title.
is_forum Boolean Optional. The group has topics.
description String Optional. getChat of a group or channel.
invite_link String Optional. getChat of a group or channel, when the bot may invite.

Message

What the bot receives:

Field Type Description
message_id Integer The message’s number in the chat. 0 for web_app_data and for a /start made by a group link.
from User Optional. The sender. Not in channel posts.
sender_chat Chat Optional. The channel, for a channel post; the group, for a message of an anonymous admin. There is no from then.
author_signature String Optional. A post of a channel that signs its posts: the author’s name.
chat Chat The chat.
date Integer Unix time.
edit_date Integer Optional. Unix time of the edit, in edited_message and edited_channel_post.
message_thread_id Integer Optional. The topic.
is_topic_message Boolean Optional. true in a topic.
reply_to_message Object Optional. The message answered. Has only message_id, chat and, in groups, from.
via_bot User Optional. In groups: the message was sent through a bot’s inline mode.
text String Optional. The text.
game Game Optional. A game card, in place of text.
entities Array of MessageEntity Optional. The marks of the text: bot_command at the start, mention, hashtag, url; in the bot’s own messages also the marks it sent.
caption String Optional. The words that came with a file.
caption_entities Array of MessageEntity Optional. The marks of the caption.
poll Poll Optional. The message is a poll.
photo Array of PhotoSize Optional. One or two sizes: a small copy first, when there is one, then the original.
video Video Optional.
video_note VideoNote Optional. A round video.
voice Voice Optional.
audio Audio Optional.
document Document Optional. Also set, with the same object, for an animation.
animation Animation Optional. A GIF.
sticker Sticker Optional.
location Location Optional. A place on the map.
venue Venue Optional. Set with location when the place has an address.
contact Contact Optional. A shared account.
has_media String Optional. A-chat only. The person sent a file the bot may not have (to be seen once, or with a timer). The value is its kind.
web_app_data WebAppData Optional. Data the person’s mini app sent with sendData.
reply_markup InlineKeyboardMarkup Optional. In groups: the buttons of the message.
new_chat_members Array of User Optional. Service message: people added or joined.
left_chat_member User Optional. Service message: someone left or was removed.
new_chat_title String Optional. Service message: the title changed.
supergroup_chat_created, channel_chat_created Boolean Optional. Service message: the chat was made.

What the send and edit methods return: message_id, from (the bot; sender_chat in a channel), chat, date, text or caption with their entities, the file object, poll, location, venue or contact, reply_markup, edit_date after an edit, and message_thread_id with is_topic_message in a topic. forwardMessage adds forward_origin (MessageOrigin). The items of an album sent by sendMediaGroup have media_group_id.

MessageEntity

Field Type Description
type String See below.
offset Integer Where the mark starts, in UTF-16 code units.
length Integer Its length, in UTF-16 code units.
url String Optional. For text_link: the link.
language String Optional. For pre: the language of the code.
custom_emoji_id String Optional. For custom_emoji: the A-chat sticker drawn in place of the words, <set id>/<sticker id>, or a sticker’s own id for a sticker of no set. The words are shown when the sticker is gone.
user User Optional. For text_mention: the account named. When you send it, only user.id is read. A tap on the words opens the profile.
type Sent by a bot Received by a bot
bold, italic, underline, strikethrough, spoiler, code, pre, text_link, blockquote, custom_emoji, text_mention Yes In the bot’s own messages
bot_command Skipped At the start of a text, with @yourbot when present
mention, hashtag, url Skipped Found in the words

MessageId

Field Type Description
message_id Integer The new message’s number in the chat.

MessageOrigin

Field Type Description
type String user.
sender_user User Who wrote the message first.
date Integer Unix time of the original message.

PhotoSize

Field Type Description
file_id String The bot’s own id of the file.
file_unique_id String The same for every bot. Cannot be used to send or download.
width, height Integer Pixels. A small copy is at most 320 on its longest side.
file_size Integer Optional. Bytes.

Video

file_id, file_unique_id, width, height, duration (seconds), and optional mime_type, file_name, file_size, thumbnail (PhotoSize).

VideoNote

file_id, file_unique_id, length (the shorter side), duration, optional file_size, thumbnail.

Voice

file_id, file_unique_id, duration, optional mime_type, file_size.

Audio

file_id, file_unique_id, duration, optional mime_type, file_name, file_size, thumbnail. A document of an audio type.

Document

file_id, file_unique_id, optional mime_type, file_name, file_size, thumbnail.

Animation

file_id, file_unique_id, width, height, duration, optional mime_type, file_name, file_size, thumbnail.

A thumbnail is a PhotoSize with its own file_id: pass it to getFile to download the small copy.

Sticker

Field Type Description
file_id String Send it back with sendSticker.
file_unique_id String
type String regular.
width, height Integer 512.
is_animated Boolean true for an animated sticker of a set from getStickerSet; otherwise false.
is_video Boolean false.
emoji String Optional. In getStickerSet: the sticker’s emoji.
set_name String Optional. In getStickerSet: the set’s name.
custom_emoji_id String Optional. The sticker’s id for a custom_emoji mark, <set id>/<sticker id>.

StickerSet

Field Type Description
name String The set’s name.
title String Its title.
sticker_type String regular.
stickers Array of Sticker In their order.

InputSticker

Field Type Description
sticker InputFile or String The picture: an upload, attach://<part name>, an https link, or a file_id from uploadStickerFile.
format String animated marks the sticker as animated. Other values are kept as a still sticker.
emoji_list Array of String The first emoji is kept. Default 🙂.

File

Field Type Description
file_id String
file_unique_id String
file_size Integer Optional.
file_path String Optional. For example photos/AF....jpg. Use it in the download address. Given by getFile.

Location

Field Type Description
latitude Float
longitude Float
horizontal_accuracy Float Optional. Meters.
live_period Integer Optional. A live location a person shares: seconds it was set to last.

Venue

Field Type Description
location Location The place.
title String The place’s address as the apps keep it.
address String The same words.

Contact

Field Type Description
phone_number String Always "": A-chat never shares phone numbers.
first_name String The name on the card.
username String The account’s @name, without @.
user_id Integer Optional. The account’s number for bots.

InputMedia

An item of sendMediaGroup, or the new file of editMessageMedia.

Field Type Description
type String photo, video, document or audio; animation only in editMessageMedia.
media String The file: attach://<part name>, an https link, or a file_id the bot has.
caption String Optional. Up to 1,024 characters.
parse_mode String Optional. For the caption.
caption_entities Array of MessageEntity Optional.

InlineKeyboardMarkup

Field Type Description
inline_keyboard Array of Array of InlineKeyboardButton Rows. Up to 100 buttons, up to 8 in a row.

InlineKeyboardButton

Field Type Description
text String The label, 1 to 64 characters.
callback_data String One of these. 1 to 64 bytes, sent back in a CallbackQuery.
url String One of these. An https link.
web_app WebAppInfo One of these. Opens the bot’s linked mini app.
copy_text CopyTextButton One of these. Copies a text.
switch_inline_query String One of these. Up to 256 characters. The person picks a chat, and its field gets @yourbot <query>.
switch_inline_query_current_chat String One of these. Up to 256 characters. The field of this chat gets @yourbot <query>.
switch_inline_query_chosen_chat SwitchInlineQueryChosenChat One of these. As switch_inline_query.

| callback_game | CallbackGame | One of these. Accepted in sendGame and dropped: Play is the game card’s own button. |

login_url and pay answer 400 ... is not supported yet.

SwitchInlineQueryChosenChat

Field Type Description
query String Optional. Up to 256 characters. The other fields are not read: the person may pick any chat.

WebAppInfo

Field Type Description
url String An https address. It opens in the mini-app window when it is on the hosts of the mini app linked to the bot. Otherwise the phone asks the person to open it as a link, and the web version says it cannot open there.

CopyTextButton

Field Type Description
text String 1 to 256 characters.

ReplyKeyboardMarkup

Field Type Description
keyboard Array of Array of KeyboardButton or String Rows of up to 12. 1 to 100 buttons.
resize_keyboard Boolean Optional.
one_time_keyboard Boolean Optional.
is_persistent Boolean Optional.
input_field_placeholder String Optional. Up to 64 characters.
selective Boolean Optional. In a group: only for the people the message mentions and the author of the message it answers.

KeyboardButton

Field Type Description
text String 1 to 64 characters.
request_contact Boolean Optional. Ask the person to share their contact. After their yes the bot gets a message with contact.
request_location Boolean Optional. Ask the person to share their location. After their yes the bot gets a message with location.

request_users, request_chat, request_poll and web_app answer 400.

ReplyKeyboardRemove

Field Type Description
remove_keyboard Boolean true.
selective Boolean Optional. As in ReplyKeyboardMarkup.

ForceReply

Field Type Description
force_reply Boolean true.
input_field_placeholder String Optional. Up to 64 characters.
selective Boolean Optional. As in ReplyKeyboardMarkup.

ReplyParameters

Field Type Description
message_id Integer The message to answer, in the same chat.

CallbackQuery

Field Type Description
id String Pass it to answerCallbackQuery.
from User Who pressed.
message Message Optional. The message with the button: message_id, from (the bot), chat, date, text, reply_markup. Not for a message sent via the bot.
inline_message_id String Optional. The button is under a message sent via the bot. See Inline messages.
chat_instance String The same for this bot and chat (or inline message), different for other bots.
data String Optional. The button’s callback_data.
game_short_name String Optional. A press of a game’s Play: answer with url. See Play.

InlineQuery

Field Type Description
id String Pass it to answerInlineQuery.
from User Who typed.
query String Up to 256 characters.
offset String Your next_offset, or empty for the first page.
chat_type String Optional. sender, private, group, supergroup or channel.
location Location Optional. The person’s place: latitude and longitude. Only when the bot’s owner turned it on and the person agreed.

InlineQueryResult

One result of answerInlineQuery or answerWebAppQuery. Every kind has:

Field Type Description
type String The kind, from the table below.
id String 1 to 64 printable ASCII characters, unique in the answer.
title String Optional except where the table says. Up to 128 characters are kept.
description String Optional. Up to 256 characters are kept.
thumbnail_url String Optional. https.
input_message_content InputMessageContent Optional except for article. When given, it is what is sent.
reply_markup InlineKeyboardMarkup Optional. Every button goes with the sent message.

A file kind also takes caption (up to 1,024 characters), parse_mode and caption_entities. It is given by a link or by a file_id the bot has.

type Its own fields
article title and input_message_content (required), url (https).
photo photo_url or photo_file_id; photo_width, photo_height.
gif gif_url or gif_file_id; gif_width, gif_height, gif_duration.
mpeg4_gif mpeg4_url or mpeg4_file_id; mpeg4_width, mpeg4_height, mpeg4_duration.
video video_url or video_file_id; mime_type, video_width, video_height, video_duration. A video_url of a type other than video/mp4 needs input_message_content.
audio audio_url or audio_file_id; audio_duration. title is the file’s name.
voice voice_url or voice_file_id; voice_duration.
document document_url or document_file_id; mime_type. title is the file’s name.
sticker sticker_file_id: a sticker the bot received or one of its sets’.
location latitude, longitude, title (required).
venue latitude, longitude, title (required), address.
contact user_id (required): an A-chat account’s number. first_name is the title when there is none. No phone number.
game game_short_name (required): a live game of the bot. Only in answerInlineQuery. See Games.

InputMessageContent

What a result sends, instead of its own file or place. One of:

Kind Fields
Text message_text (1 to 4,096 characters), optional parse_mode or entities.
Location latitude, longitude.
Venue latitude, longitude, title, optional address.
Contact user_id: an A-chat account’s number.

InlineQueryResultsButton

Field Type Description
text String 1 to 64 characters.
start_parameter String One of these. 1 to 64 of A-Za-z0-9_-. Opens the bot’s chat with /start <start_parameter>.
web_app WebAppInfo One of these. An https address.

ChosenInlineResult

Field Type Description
result_id String The result’s id.
from User Who sent it.
query String The query.
inline_message_id String The message it became, to edit it and to know its button presses.

WebAppData

Field Type Description
data String What the page passed to sendData, 1 to 4,096 bytes.
button_text String Empty today.

Game

Field Type Description
title String The game’s title.
description String Its description.
photo Array of PhotoSize Optional. The cover, a picture.
animation Animation Optional. The cover, an animation (GIF or animated WebP).

GameHighScore

Field Type Description
position Integer The place in the table.
user User The player.
score Integer The score.

CallbackGame

An empty object: {}.

SentWebAppMessage

Field Type Description
inline_message_id String Optional. The message sent via the bot, when the mini app was opened from a chat.

Poll

Field Type Description
id String The poll’s id. The same as poll_id in PollAnswer.
question String 1 to 300 characters.
options Array of PollOption The answers.
total_voter_count Integer People who voted.
is_closed Boolean Closed by stopPoll.
is_anonymous Boolean
type String regular or quiz.
allows_multiple_answers Boolean
correct_option_id Integer Optional. A quiz: the right answer, from 0.
explanation String Optional. A quiz: the words shown after the vote.

PollOption

Field Type Description
text String The answer.
voter_count Integer Votes for it.

InputPollOption

Field Type Description
text String 1 to 100 characters.

PollAnswer

Field Type Description
poll_id String The poll’s id.
user User Who voted.
option_ids Array of Integer The chosen answers, from 0. Empty: the vote was taken back.

ReactionTypeEmoji

Field Type Description
type String emoji.
emoji String The emoji.

ReactionCount

Field Type Description
type ReactionTypeEmoji The reaction.
total_count Integer How many people put it.

MessageReactionUpdated

Field Type Description
chat Chat The chat.
message_id Integer The message.
user User Who changed their reactions.
date Integer Unix time.
old_reaction Array of ReactionTypeEmoji Before.
new_reaction Array of ReactionTypeEmoji After.

MessageReactionCountUpdated

Field Type Description
chat Chat The group or channel.
message_id Integer The message.
date Integer Unix time.
reactions Array of ReactionCount Every reaction on the message now.

ChatMemberUpdated

Field Type Description
chat Chat The chat.
from User Optional. Who made the change.
date Integer Unix time.
old_chat_member ChatMember Before.
new_chat_member ChatMember After.

In a private chat: a block is member → kicked, an unblock is kicked → member.

ChatMember

Field Type Description
user User The member.
status String creator, administrator, member, restricted, left or kicked.
is_anonymous Boolean Creator or administrator. true for an admin who writes as the group (see Anonymous admins).
can_be_edited, can_manage_chat, can_promote_members, can_manage_video_chats Boolean Administrator. false, true, false, false.
can_change_info, can_post_messages, can_edit_messages, can_delete_messages, can_restrict_members, can_invite_users, can_pin_messages, can_manage_topics Boolean Administrator. The rights.
is_member Boolean Restricted. true.
can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, can_send_voice_notes, can_send_polls, can_send_other_messages, can_add_web_page_previews, can_manage_topics Boolean Restricted. All the same value: whether the member may send.
can_invite_users, can_pin_messages, can_change_info Boolean Restricted. Each as it stands for the member.

ChatPermissions

The rights of members, for restrictChatMember and setChatPermissions. Which fields each method reads is in its section.

Field Type Description
can_send_messages Boolean Optional. Send messages.
can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, can_send_other_messages Boolean Optional. restrictChatMember only: the same as can_send_messages.
can_send_polls Boolean Optional. Send polls.
can_send_voice_notes Boolean Optional. Send voice messages.
can_invite_users Boolean Optional. Invite people.
can_pin_messages Boolean Optional. Pin messages.
can_change_info Boolean Optional. Change the title, the description and the picture.
can_manage_topics Boolean Optional. setChatPermissions only: make topics.

ChatAdministratorRights

Field Type Description
can_change_info, can_post_messages, can_edit_messages, can_delete_messages, can_restrict_members, can_invite_users, can_pin_messages, can_manage_topics Boolean The rights an admin of A-chat has.
can_manage_chat, is_anonymous Boolean Kept and returned, but a chat has no such right: they are not given when the bot is added.

Only fields set to true are kept; the others are false.

Field Type Description
invite_link String https://a-chat.app/join/<code>.
creator User Optional. The bot, for a link it made or revoked.
creates_join_request Boolean People who use it ask to join.
is_primary Boolean false: the chat’s main link is given by exportChatInviteLink.
is_revoked Boolean The link no longer works.
name String Optional.
expire_date Integer Optional. Unix time.
member_limit Integer Optional.

ChatJoinRequest

Field Type Description
chat Chat The group or channel.
from User Who asked.
user_chat_id Integer The person’s number.
date Integer Unix time.
invite_link ChatInviteLink Optional. The link they used.

Answer it with approveChatJoinRequest or declineChatJoinRequest.

ForumTopic

Field Type Description
message_thread_id Integer The topic.
name String
icon_color Integer

One of:

type Other fields What the button does
commands Shows the bot’s commands. The default.
web_app text (1 to 64 characters), web_app (WebAppInfo) Opens the bot’s linked mini app at that address.
default Only when setting: goes back to the default.

BotCommand

Field Type Description
command String 1 to 32 of a-z, 0-9 and _, without /.
description String 1 to 256 characters.

BotCommandScope

type Other fields
default
all_private_chats
all_group_chats
all_chat_administrators
chat chat_id
chat_administrators chat_id
chat_member chat_id, user_id

WebhookInfo

Field Type Description
url String Empty when there is no webhook.
has_custom_certificate Boolean Always false.
pending_update_count Integer Updates waiting.
max_connections Integer Optional. As set.
last_error_date Integer Optional. Unix time of the last failure.
last_error_message String Optional. For example Read timeout expired or Wrong response from the webhook: 500 Internal Server Error.
allowed_updates Array of String Optional. As set.

Notes

Topic A-chat
Formatting HTML (spoiler as <spoiler> or <span class="spoiler">, a sticker as <emoji id="...">, a mention as <a href="a-chat://user?id=...">), MarkdownV2, Markdown, or entities. Offsets in UTF-16 code units. Mentions by @name, hashtags and links are found by the apps. See Formatting.
custom_emoji custom_emoji_id names an A-chat sticker, <set id>/<sticker id>: take it from a Sticker’s custom_emoji_id.
A-chat Plus is_plus, present only when true.
User No last_name. first_name is the whole display name.
file_id AF followed by 32 characters. Each bot has its own file_id for a file; another bot’s file_id does not work. file_unique_id is the same for every bot.
File sizes Send up to 50 MB, download up to 20 MB. Photos come in at most two sizes: a small copy (up to 320 on its longest side) and the original.
File download /file/bot<token>/<file_path> answers with a redirect to a short-lived link.
chat_id A number, or the @username of a public group or channel the bot is in.
Stickers sendSticker takes a sticker the bot received or one of its own sets’, or a picture, which becomes the bot’s sticker of no set. A bot keeps only its own sticker sets; user_id of the set methods is not read.
Contacts An A-chat account by user_id. phone_number is never sent and always "" when received.
Locations No live locations from bots. A venue keeps its title and its address.
Webhook Updates are posted one at a time, in order. max_connections is kept but not used. Methods in the webhook answer are ignored. Only the X-Bot-Api-Secret-Token header. No certificate or ip_address.
Updates kept 24 hours.
Opt-in updates chat_member, message_reaction and message_reaction_count only when named in allowed_updates.
Callback answers Shown to the person when given within 7 seconds.
edit* Return the edited Message, or true with inline_message_id. editMessageMedia does not take inline_message_id. A caption cannot be removed.
protect_content Ignored. A group’s or channel’s own protected content applies.
disable_notification Works in private chats, groups and channels.
Reply keyboards Shown in private chats and groups; selective in a group shows them to the people the message mentions and the author of the message it answers.
sendChatAction Every action is shown as “typing”, in private chats and groups. A channel shows nothing.
promoteChatMember Always refused: only the owner of a chat makes admins.
restrictChatMember Sending is one right for every kind of message. Also can_invite_users, can_pin_messages, can_change_info. No until_date.
Invite links editChatInviteLink is refused: make a new link instead.
has_media An A-chat field: a file the bot may not have.
sendAnimation An MP4 is kept as a video and answered as animation.
Polls Regular polls and quizzes. A quiz’s explanation is plain words; a vote in a quiz is final.
Inline mode Every result kind but game. Results sent by a person are their own messages “via @yourbot”, with an inline_message_id.
answerWebAppQuery Into the chat the mini app was opened from, as the person’s message via the bot; otherwise into the bot’s chat, as the bot’s message. Any kind of result.
Menu button web_app opens only the bot’s own linked mini app.
Rate limits By the bot’s level: new 30, growing 100, full 300 calls a second; service calls apart. 30 messages in 10 seconds per private chat, 60 a minute per group or channel.

Anonymous admins

The owner of a group can let an admin, or themselves, write as the group itself. Such a message reaches the bot with sender_chat set to the group and no from, as a channel post does. A reply to it has reply_to_message.sender_chat. getChatMember and getChatAdministrators show such an admin with is_anonymous: true. A message of the group that the bot forwards or copies goes on as the group’s.

Not available yet

These are not built. A method that is not on this page answers 404; a field below answers 400 or is not read.