Skip to content
CalabDocs

Gateway events

Every opcode, close code and DispatchEvent event of the gateway protocol, marked with which ones bots receive.

The reference for gateway protocol version v=1. How to connect and handle events is in the Gateway chapter.

Opcodes

The op field of a GatewayFrame. In JSON it is the full name, e.g. "GATEWAY_OPCODE_DISPATCH".

OpcodeNumberDirectionFrame field
GATEWAY_OPCODE_HEARTBEAT1bot → serverheartbeat { lastSeq }
GATEWAY_OPCODE_IDENTIFY2bot → serveridentify { token, device, capabilities }
GATEWAY_OPCODE_RESUME3bot → serverresume { token, sessionId, seq }
GATEWAY_OPCODE_PRESENCE_UPDATE4bot → serversetPresence { status, until }
GATEWAY_OPCODE_TYPING5bot → servertyping { roomId }
GATEWAY_OPCODE_SUBSCRIBE6bot → serversubscribe { roomIds }
GATEWAY_OPCODE_RECONNECT7server → botreconnect {}
GATEWAY_OPCODE_DISPATCH8server → botdispatch { <event> }
GATEWAY_OPCODE_INVALID_SESSION9server → botinvalidSession { resumable }
GATEWAY_OPCODE_HELLO10server → bothello { heartbeatIntervalMs }
GATEWAY_OPCODE_HEARTBEAT_ACK11server → botheartbeatAck {}

Close codes

CodeNameWhat a bot should do
4000UNKNOWN_ERRORreconnect, RESUME; with the reason replaced by a new session — don't reconnect
4001UNKNOWN_OPCODEreconnect, RESUME
4002DECODE_ERRORreconnect, RESUME
4003NOT_AUTHENTICATEDreconnect, new IDENTIFY
4004AUTHENTICATION_FAILEDdon't reconnect: the token is wrong
4007INVALID_SEQreconnect, new IDENTIFY
4008RATE_LIMITEDback off, RESUME
4009SESSION_TIMED_OUTreconnect, new IDENTIFY
4010SESSION_REVOKEDdon't reconnect: the token was revoked or the bot deleted
4011SESSION_EVICTEDconcerns browser tabs; bots never see it

Events

An event is one of the DispatchEvent fields, lowerCamelCase in JSON. The “Bots” column: yes — delivered to a bot by its permissions; conditional — only under the condition described; no — never sent to bots.

Session

EventBotsDescription
readyyesthe answer to IDENTIFY: sessionId, me, workspaces[], dms[], readStates
resumedyesthe answer to a successful RESUME: replayed — how many events were replayed
readStateUpdateyesthe bot's own read marker changed (from another device or via PUT /api/rooms/{id}/read)

Workspaces, members, roles

EventBotsDescription
workspaceCreate · workspaceUpdate · workspaceDeleteyesthe bot joined a workspace · settings changed · the workspace was deleted or the bot removed
workspaceMemberAdd · workspaceMemberUpdate · workspaceMemberRemoveyesmembers: joined, roles or nickname changed, left
workspaceBanAdd · workspaceBanRemoveconditionalbans — only with MANAGE_MEMBERS
roleCreate · roleUpdate · roleDeleteyesthe workspace's roles
badgeCreate · badgeUpdate · badgeDeleteyesthe badge library
workspaceAchievementsUpdateyesthe workspace's achievement catalog changed
userUpdate · presenceUpdateyesa member's profile and presence
botCreate · botUpdate · botDeleteconditionalthe workspace's bots — only with MANAGE_BOTS (or to the bot's owner)
workspaceAppUpsert · workspaceAppDeletenoworkspace web apps — people only
workspaceIdentityAccessUpdate—an internal SSO event for people’s sessions; ignore it if it arrives
billingUpdatenobilling — the workspace owner only

Rooms and messages

EventBotsDescription
roomCreate · roomUpdate · roomDelete · roomPermissionsUpdateyesrooms the bot can see (or stopped seeing)
categoryCreate · categoryUpdate · categoryDeleteyesroom categories
messageCreate · messageUpdate · messageDeleteyesmessages of visible rooms and the bot's DMs; a command for the bot carries message.command
messageReactionAdd · messageReactionRemoveyesreactions
typingStartconditional“is typing” — only in rooms from SUBSCRIBE
botCallbackconditionala button press — only to the message's author bot
dmCreateyesa new DM with the bot
stickerPackCreate · stickerPackUpdate · stickerPackDeleteyesthe workspace's sticker packs
readReceiptnopeople's “read” marks — never sent to bots
roomNotificationUpdate · workspaceNotificationUpdate · dmStateUpdatenonotification settings and DM archive — bots have none

Voice and calls

EventBotsDescription
voiceStateUpdateyeswho is in which voice room; empty roomId — left
voiceStreamStart · voiceStreamStop · voiceCameraStop · voiceMovedyesstreams, camera, a member moved
voiceDisconnectedyesthe bot was disconnected from voice
roomRecordingyesa meeting recording in the room started or stopped
soundCreate · soundUpdate · soundDeleteyesthe workspace's sounds
soundPlayconditionalonly while the bot is in the room's call
sipCallUpdateyesa phone call from the room was placed or changed status
roomAdmissionRequest · roomAdmissionDecidedconditionala guest waits for admission · a decision was made — to those who decide (INVITE_GUESTS in the room)
callRing · callStatenoone-to-one calls — not for bots
backgroundCreate · backgroundUpdate · backgroundDeleteno*camera backgrounds; bots have no camera — ignore them

* The event is broadcast to the whole workspace and may arrive, but a bot has no use for it.

Calendar

EventBotsDescription
eventCreate · eventUpdate · eventDelete · eventRsvpyesmeetings the bot organizes and those of visible rooms; outside addresses only if the bot may change the meeting
roomEventActive · roomEventEndedyesa meeting in a room started · ended
eventRemindernoa reminder to an attendee — a bot never attends meetings

Boards and tasks

EventBotsDescription
boardCreate · boardUpdate · boardDeleteyesboards — by VIEW_BOARD
boardCategoryCreate · boardCategoryUpdate · boardCategoryDeleteyesboard categories
taskCreate · taskUpdate · taskDelete · taskActivityyestasks and their journal entries
taskChecklistUpdate · taskChecklistDeleteyestask checklists
boardRuleUpdate · boardRuleDeleteyesthe board's automation rules
taskGitLinksUpdateyesa task's Git links
taskNoticeconditionala person's task notification — only to the bot they chose

Other

EventBotsDescription
notesCreate · notesUpdate · notesDeletenonotes shelves — people only
diskItemUpsert · diskItemRemovenoDisk — bots have no access yet