Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Establishing a connection

To get started, you should have:

  • A WebSocket URL, which is found from the API root.
  • A valid session or bot token.

You may authenticate in one of two ways:

You should listen out for Error events to find out if your credentials are incorrect or if something goes wrong here.

After authenticating, the server will respond with Authenticated then it will send a Ready event containing useful data.

The server will now start sending relevant events as they come in.

You should Ping the server every 10 to 30 seconds to prevent your connection being dropped.

Bots receive all events, normal users do not receive UserUpdate events fanned out through servers by default, read more here.

Query Parameters

The Bonfire service supports additional query parameters:

ParameterDescriptionValuesRequired
versionDescribes the protocol version in use.1No †
formatIn what format to send packets, default is JSON.json, msgpackNo
tokentoken for authenticating the connecting user.Session or bot tokenNo
readyFields to include in the Ready event payload, by default all are sentSee BelowNo

version may become compulsary in the future, please set it to 1 if you can.

Ready Fields

The ready query parameter can be passed multiple times to specify multiple fields, supported fields are:

ValueDescription
usersIncludes all users you have a relation with.
serversIncludes all servers you are in.
channelsIncludes all channels you have access to.
membersIncludes all members you have a relation with.
emojisIncludes all emojis you have access to.
user_settingsSpecify which settings to pre-fetch, specify a setting by setting the value to user_settings[<setting_name>].
channel_unreadsIncludes all channel unreads you have.
policy_changesIncludes all new policy changes you should be aware of, this is not sent to bots.

For example:

?ready=users&ready=servers&ready=user_settings[ordering]

You may specify these in the connection URL: wss://ws.revolt.chat?version=1&format=json.