CLEMA protocol

Message Types Summary

Client → Server (Requests)

Type Auth Required Description
connection.hello No Capability negotiation (must be first message)
connection.ping No Connection check
connection.close No Disconnect gracefully
auth.token No Login with access token
auth.refresh No Refresh access token
auth.logout Yes Invalidate tokens and logout
auth.code No Send a sign-in code to a phone number
auth.phone No Sign in, or create the account, with the code sent to a phone
auth.qr No Get a QR code for a signed-in phone to let this client in
qr.get Yes See which client is waiting behind a scanned QR code
qr.accept Yes Let the client behind a scanned QR code in
session.list Yes List the caller's persistent authentication sessions
session.revoke Yes Revoke one session or all sessions except the current one
phone.get Yes Get the account's phone number
phone.code Yes Send a code to a phone number the account is to use
phone.set Yes Change the account's phone number with that code
push.register Yes Register this session's device for push notifications
push.unregister Yes Stop push notifications to this session's device
activity.set Yes Make this connection active or passive
transport.list Yes List transport adapters and the caller's accounts on them
transport.setup Yes Create the account on one transport and choose its password
transport.password Yes Replace a transport account password
transport.enable Yes Let a transport accept the account again
transport.disable Yes Refuse new logins and close live ones on a transport
transport.reset Yes Discard the stored secret, keeping the account ID
message.send Yes Send message (text or file)
message.forward Yes Forward a text or file message as an independent copy
message.edit Yes Edit own text message using its revision
message.delete Yes Delete a message for self or all participants
message.react Yes Add or remove own reaction
message.play Yes Report somebody else's voice message played
delivery.set Yes Report a direct conversation's messages delivered through one
message.list Yes Get message history
message.search Yes Search visible messages globally or inside one conversation
message.clear Yes Clear history
read.set Yes Advance the conversation read cursor
pin.set Yes Pin a visible message
pin.remove Yes Remove a message pin
pin.list Yes List visible pinned messages
notification.set Yes Set personal conversation notification mode or mute
draft.update Yes Save or clear a private synchronized draft
reactions.see Yes Report the reactions to an own message seen
block.add Yes Block a user
block.remove Yes Remove a user block
block.list Yes List blocked users
privacy.get Yes Get account privacy settings
privacy.update Yes Update account privacy settings
ban.add Yes Ban and remove a group/channel member
ban.remove Yes Remove an active ban
ban.list Yes List active conversation bans
restriction.set Yes Set or clear a member posting restriction
sync.state Yes Where the account stream and every conversation stream stand
sync.pull Yes Pull a stream's events after a cursor
conversation.create Yes Create a group or channel
conversation.list Yes List conversations for the caller
conversation.search Yes Search the caller's direct, group and channel conversations
conversation.get Yes Get one conversation and computed capabilities
conversation.update Yes Update conversation metadata or slow mode
conversation.delete Yes Delete an owned conversation and its history
member.list Yes List conversation members
member.add Yes Add a member with a role
member.update Yes Change a role or transfer ownership
member.remove Yes Remove a member or leave
invite.create Yes Create an addressed or shareable invitation
invite.list Yes List invitations for a conversation
invite.get No See the conversation an invitation leads to
invite.accept Yes Join using an invitation token
invite.revoke Yes Revoke an invitation
invite.update Yes Choose or unchoose the primary link
contact.list Yes Get contact list
contact.add Yes Add contact
contact.rename Yes Rename contact
contact.delete Yes Delete contact
phonebook.update Yes Upload changes of this device's address book
phonebook.get Yes Get the digest and size of this device's address book
phonebook.clear Yes Delete this device's address book
presence.get Yes Get presence status
presence.set Yes Say whether you are available, away, busy or invisible, and set a custom status
typing.set Yes Send typing start/stop signal
profile.get Yes Get user profile info
profile.update Yes Update own profile info
user.search Yes Search for users
file.create Yes Create or resume a stored multipart upload
file.get Yes Read stored upload state and uploaded parts
file.complete Yes Complete and verify a stored upload
file.abort Yes Abort an unattached stored upload
transfer.create Yes Offer an online-only direct file transfer
transfer.accept Yes Accept a direct transfer
transfer.decline Yes Decline a direct transfer
transfer.cancel Yes Cancel a direct transfer
button.press Yes Press a button under a bot's message
button.answer Yes A bot answers a press of its button
pack.list Yes List the catalog of smiley packs and the installed ones
pack.get Yes Get a smiley pack with its smileys
pack.install Yes Install a smiley pack in the panel
pack.remove Yes Remove a smiley pack from the panel
pack.order Yes Put the installed smiley packs in a new order

Server → Client (Responses)

All responses include:

Server → Client (Push Events)

Type Description
connection.pong Ping response
connection.closing Server-initiated disconnect
session.revoked Persistent session was revoked, expired, or replaced; this connection is unauthenticated
transport.updated A transport account of this user changed; carries the whole record
phone.updated The account's phone number changed; carries the whole record
qr.accepted A phone let this waiting client in; carries its tokens and session
message.created Message created or forwarded
message.edited Message content changed
message.deleted Message hidden for self or tombstoned for all
message.reacted Reaction aggregate changed
delivery.updated A participant's devices have a direct conversation's messages further
message.cleared Conversation hidden for this user
message.played A voice message became played as the user sees it
file.updated Stored media metadata or preview state changed
read.updated Conversation read cursor advanced
pin.added Message was pinned
pin.removed Message pin was removed
notification.updated Personal conversation notification settings changed
draft.updated Personal conversation draft changed or was cleared
reactions.updated Reactions waiting for the user to see changed
block.added A private user block was added
block.removed A private user block was removed
privacy.updated Private account privacy settings changed
ban.added A member was banned and removed
ban.removed A conversation ban was removed
restriction.updated A member posting restriction changed
conversation.created Conversation became available to the user
conversation.updated Conversation metadata changed
conversation.deleted Conversation is no longer the user's: deleted, left, removed or banned
member.added Member joined or was added
member.updated Member role changed, or the member's nick or picture
member.removed Member left or was removed
invite.created Invitation was created
invite.accepted Invitation was used
invite.revoked Invitation was revoked
invite.updated Invitation became or stopped being the primary link
presence.online Contact came online
presence.offline Contact went offline
presence.updated Contact changed state or custom status
presence.self Another of your devices, or time, changed your own state or custom status
contact.added Somebody became a contact: added on a device of yours, found in an address book, or answering a chat you started
contact.requested Somebody not among your contacts wrote to you and asks to be taken in
contact.renamed A contact was renamed
contact.deleted A contact or a request was taken out of your list
profile.updated Your profile, or the profile of somebody you list or have a direct conversation with, changed
typing.changed Contact started or stopped composing a message
transfer.created Direct transfer offered
transfer.accepted Direct transfer accepted
transfer.declined Direct transfer declined
transfer.cancelled Direct transfer cancelled or expired
button.pressed Somebody pressed a button of a bot's; told to the bot alone
pack.installed A smiley pack was installed in the panel
pack.removed A smiley pack was removed from the panel
pack.ordered The installed smiley packs were put in a new order

Push events have no id and no ok field. Durable events also carry their place in a stream: seq, with conversation_id for a conversation stream.