Hatchat WebSocket Protocol


JSON Schema for all WebSocket messages in the Hatchat chat application

Type: object
No Additional Properties

Type: string

Avatar URL (may be empty)

Type: string

Display name (shown instead of username if set)

Type: string

Unique user identifier (usr_ prefix)

Must match regular expression: ^usr_[a-f0-9]{16}$

Type: string

RFC3339 timestamp of when user was last online (empty if never seen or currently online)

Type: boolean

Whether the user is currently online

Type: string

Custom status message

Type: string

Login username

Type: object
No Additional Properties

Type: string

Unique room identifier (roo_ prefix)

Must match regular expression: ^roo_[a-f0-9]{12}$

Type: boolean

Whether the room is private

Type: array

Room members (only populated for DMs)

No Additional Items

Each item of this array must be:

Type: object
No Additional Properties

Type: string

Avatar URL (may be empty)

Type: string

Display name (may be empty)

Type: string

User ID

Type: string

Username

Type: string

Room display name (empty for DMs)

Type: enum (of string)

Type of room: 'channel' or 'dm'

Must be one of:

  • "channel"
  • "dm"
Type: object
No Additional Properties

Type: string

Message content

Type: string

RFC3339Nano timestamp of creation

Type: string

RFC3339Nano timestamp of deletion (empty if not deleted)

Type: string

Unique message identifier (msg_ prefix)

Must match regular expression: ^msg_[a-f0-9]{12}$

Type: string

RFC3339Nano timestamp of last modification

Type: array

Aggregated emoji reactions on this message

No Additional Items

Each item of this array must be:

Type: object
No Additional Properties

Type: integer

Number of users who reacted with this emoji

Type: string

The emoji character(s)

Type: array of string

IDs of users who reacted (for highlighting own reactions)

No Additional Items

Each item of this array must be:

Type: string

Room this message belongs to

Type: string

User who sent the message

Type: string

Username of sender (denormalized for convenience)

Type: object
Type: object
No Additional Properties

Type: string

Message content

Must be at least 1 characters long

Type: string

Target room ID

Must be at least 1 characters long

Type: object
No Additional Properties

Type: string

Pagination cursor (created_at of oldest message seen)

Type: integer

Maximum messages to return (default 50; max 100)

Value must be greater or equal to 1 and lesser or equal to 100

Type: string

Room to fetch history for

Type: object
No Additional Properties

Type: string

Room ID to switch to

Type: object
No Additional Properties

Type: boolean

Whether the room is private (invite-only)

Type: string

Room display name

Must be at least 1 characters long

Must be at most 80 characters long

Type: object
No Additional Properties

Type: array of string

User IDs to start DM with (not including self)

Must contain a minimum of 1 items

No Additional Items

Each item of this array must be:

Type: string
Type: object
No Additional Properties

Type: string

Optional search query to filter rooms by name

Type: object
No Additional Properties

Type: string

Search query for username (partial match)

Type: object
No Additional Properties

Type: string

Room ID to leave

Type: object
No Additional Properties

Type: string

Room ID to get info for

Type: object
No Additional Properties

Type: string

User ID to get profile for

Type: object
No Additional Properties

Type: string

New display name (omit to keep current)

Type: string

New status message (omit to keep current)

Type: object
No Additional Properties

Type: string

Room ID to display initially

Type: array

DM rooms the user is a member of (sorted by most recent activity)

No Additional Items

Each item of this array must be:

Type: array of string

IDs of users who are currently online

No Additional Items

Each item of this array must be:

Type: object

Map of room ID to lastreadat RFC3339Nano timestamp (empty string if never read)

Each additional property must conform to the following schema

Type: string

Type: array

Channel rooms the user is a member of

No Additional Items

Each item of this array must be:

Type: object

Map of room ID to unread message count

Each additional property must conform to the following schema

Type: integer

Type: object

The authenticated user

Same definition as anyOf_i0
Type: object
No Additional Properties

Type: boolean

Whether older messages exist

Type: array

Messages in chronological order (newest first)

No Additional Items

Each item of this array must be:

Type: string

Pass as cursor to fetch older messages

Type: object
No Additional Properties

Type: boolean

True if user was added as a new member (vs already being a member)

Type: object

The room that was joined

Same definition as anyOf_i1
Type: object
No Additional Properties

Type: object

The newly created room

Same definition as anyOf_i1
Type: object
No Additional Properties

Type: boolean

True if a new DM was created (false if existing DM was found)

Type: object

The DM room (existing or newly created)

Same definition as anyOf_i1
Type: object
No Additional Properties

Type: array of boolean

Whether the user is a member of each room (parallel array)

No Additional Items

Each item of this array must be:

Type: array

List of public rooms

No Additional Items

Each item of this array must be:

Type: object
No Additional Properties

Type: array

List of matching users

No Additional Items

Each item of this array must be:

Type: object
No Additional Properties

Type: string

Room ID that was left

Type: object
No Additional Properties

Type: string

RFC3339 timestamp of when the room was created

Type: integer

Number of members in the room

Type: array

List of room members

No Additional Items

Each item of this array must be:

Type: object

Room details

Same definition as anyOf_i1
Type: object
No Additional Properties

Type: object

User profile data

Same definition as anyOf_i0
Type: object
No Additional Properties

Type: object

Updated user profile

Same definition as anyOf_i0
Type: object
No Additional Properties

Type: string

Human-readable error message

Type: object
No Additional Properties

Type: string

New message body

Must be at least 1 characters long

Type: string

ID of the message to edit

Type: object
No Additional Properties

Type: string

ID of the message to delete

Type: object
No Additional Properties

Type: string

Emoji character(s) to react with

Type: string

ID of the message to react to

Type: object
No Additional Properties

Type: string

Emoji character(s) to remove

Type: string

ID of the message to remove reaction from

Type: object
No Additional Properties

Type: string

New message body

Type: string

ID of the edited message

Type: string

RFC3339Nano timestamp of the edit

Type: string

Room the message belongs to

Type: object
No Additional Properties

Type: string

ID of the deleted message

Type: string

Room the message belongs to

Type: object
No Additional Properties

Type: enum (of string)

Whether the reaction was added or removed

Must be one of:

  • "add"
  • "remove"

Type: string

The emoji character(s)

Type: string

ID of the message

Type: string

Room the message belongs to

Type: string

User who added/removed the reaction

Type: object
No Additional Properties

Type: string

Pagination cursor for next page

Type: integer

Max results to return (default 20)

Value must be greater or equal to 1 and lesser or equal to 100

Type: string

Search query text

Must be at least 1 characters long

Type: string

Filter to specific room

Type: string

Filter to messages from specific user

Type: object
No Additional Properties

Type: string

Pagination cursor for next page

Type: array

Matching messages with snippets

No Additional Items

Each item of this array must be:

Type: object
No Additional Properties

Type: string

RFC3339Nano timestamp of the message

Type: string

ID of the matching message

Type: string

Room the message belongs to

Type: string

Name of the room (for display)

Type: string

Message excerpt with highlighted matches

Type: string

Author of the message

Type: string

Username of the author

Type: integer

Approximate total matches

Type: object
No Additional Properties

Type: string

ID of the message to get context for

Type: object
No Additional Properties

Type: object

The requested message

Same definition as anyOf_i2

Type: string

Room the message belongs to

Type: object
No Additional Properties

Type: string

Timestamp to mark as read up to (typically the latest message timestamp)

Type: string

Room to mark as read

Type: object
No Additional Properties

Type: string

Timestamp that was recorded

Type: string

Room that was marked as read

Type: integer

New unread count (always 0 after marking current)

Type: object
Type: object
No Additional Properties

Type: string

Timestamp that was recorded for all rooms

Type: object
No Additional Properties

Type: object

Map of room ID to unread message count

Each additional property must conform to the following schema

Type: integer
Type: object
No Additional Properties

Type: string

RFC3339 timestamp of when user went offline (only set when online=false)

Type: boolean

Whether the user is now online

Type: string

ID of the user whose presence changed

Type: object
No Additional Properties

Type: object

Type-specific payload

Type: string

Message type identifier