Docs

Objects

How profiles, chats and messages look in the Bot API.

Every ID in Comon is an opaque string: do not parse it or turn it into a number. Times are Unix seconds.

User

A person's or a bot's profile.

FieldType
idstringThe profile ID.
is_botbooleanWhether it is a bot.
first_namestringFirst name.
last_namestringLast name, if any.
usernamestringThe @username without @, if any.
{ "id": "…", "is_bot": false, "first_name": "Anna", "last_name": "Kim", "username": "anna" }

Chat

FieldType
idstringThe chat ID.
typestringprivate (direct), group, channel, community, room (a community room).
userUserFor private: the bot's peer.
titlestringFor the others: the title.
usernamestringThe public chat's @username, if any.
community_idstringFor room: the community the room belongs to.
{ "id": "…", "type": "room", "title": "releases", "community_id": "…" }

Message

FieldType
message_idstringThe message's ID in the chat.
chatChatThe chat.
fromUserThe author, if there is one.
dateintegerWhen it was sent.
editedtruePresent when the message was edited.
orderintegerIts position in the chat; needed for readPersonalMessages.
textstringAll the message's text: paragraphs, headings, code, captions and table cells, one line per block.
entitiesarrayFormatting and mentions in text.
reply_to_message_idstringThe message this one replies to.
documentobjectThe message's full document with every block and attachment.
commandobjectOnly in the message update: {"name", "options"} of an ordinary command run from the app (commands).

text is enough for simple bots. document matters when structure does: media, lists, tables, quotes. Its shape is in protocol/comon/federation/document.proto; in JSON the fields are camelCase.

Entity

A range of text with formatting. offset and length count UTF-16 units, as in JavaScript and Telegram: an emoji outside the basic plane takes two units.

typeExtraMeaning
bold, italic, underline, strikethrough, code, spoilerFormatting.
text_linkurlA link under the text.
mentionuser_idA mention of a person. Incoming messages only.
mention_allA mention of every member. Incoming messages only.
{ "type": "text_link", "offset": 0, "length": 7, "url": "https://comon.chat" }

BotCommand

FieldType
commandstringThe name without /: lowercase Latin letters, digits and _.
descriptionstringUp to 256 characters.
ephemeralbooleanAn ephemeral command.
optionsarrayOptions (commands).

On this page