Objects
Fields that are empty are usually left out of the JSON.
User
| Field | Type | |
|---|---|---|
id | string | Account id. |
name | string | Display name. |
bot | bool | The account is a bot. |
Chat
| Field | Type | |
|---|---|---|
id | string | For a private chat — the other person's id. |
type | string | direct or group. |
title | string | The person's name or the group's title. |
members | string[] | Group members' ids. |
owner | string | The group's owner. |
request | bool | Not accepted yet: a chat request or an invitation. |
bot | bool | A private chat with another bot. |
expire_sec | int | Disappearing-messages timer, seconds. |
Message
| Field | Type | |
|---|---|---|
id | string | |
chat_id | string | |
from | User | The sender; absent on the bot's own messages. |
ts | int | Sent at, ms. |
status | string | Own messages only: pending, sent, delivered, read, failed. |
text | string | |
mentions | Mention[] | |
reply_to | string | Id of the quoted message. |
attachment | Attachment | |
poll | Poll | |
reactions | {from, emoji}[] | from is empty for the bot's own reaction. |
edited_ts | int | Last edit, ms. |
expire_sec | int | The message disappears after this many seconds. |
buttons | Button[][] |
Mention
{user, offset, length}: the account id and where the mention is in text, in UTF-16 code units.
Attachment
| Field | Type | |
|---|---|---|
kind | string | photo, video, voice, file. |
mime | string | |
name | string | File name. |
size | int | Bytes. |
caption | string | |
width, height | int | Photo and video. |
duration_ms | int | Video and voice. |
The content is not in the update: download it with GET …/messages/{msg}/file.
Poll
| Field | Type | |
|---|---|---|
question | string | |
options | {text, voters}[] | voters — account ids. |
multiple | bool | Several options may be chosen. |
close_ts | int | Closes automatically at, ms. |
closed | bool |
Button
{text, data} or {text, url}. See buttons.
Update
| Field | Type | |
|---|---|---|
id | int | Grows by one; pass id + 1 as offset. |
type | string | message, edited, deleted, reaction, poll, chat, notice, expired, button. |
chat_id | string | |
message | Message | message, edited, poll. |
chat | Chat | chat. |
deleted | {message_id, from} | deleted. |
reaction | {message_id, from, emoji} | reaction; empty emoji — removed. |
notice | Notice | notice. |
expired | string[] | expired: ids of erased messages. |
button | {message_id, from, data, press_id} | button. |
from in deleted, reaction and button is a User.
Notice
{from, code}, where code is one of:
code | |
|---|---|
expire_timer:<sec> | The disappearing-messages timer changed (0 — off). |
message_pinned:<preview> | A message was pinned. |
group_renamed:<name> | |
group_photo_changed, group_photo_removed | |
safety_number_changed | The person's keys changed (a new device or a reinstall). |