ChatRef
A polymorphic reference to any type of chat (user DM, channel, group, or self).Usage
ChatRef is used throughout the protocol as input to specify which chat an operation targets. It allows methods to work uniformly across different chat types (DMs, channels, groups).Protocol Definition
UserRef
Reference to a direct message conversation with a user.Example Usage
Use UserRef when sending a direct message to another user:Protocol Definition
ChannelRef
Reference to a channel within a community.Example Usage
Use ChannelRef when sending a message to a community channel:Protocol Definition
GroupRef
Reference to a group chat.Example Usage
Use GroupRef when sending a message to a group chat:Protocol Definition
RefSelf
Reference to the user’s own saved messages / notes to self. This is an empty message type used as a marker in the ChatRef oneof.Example Usage
Use RefSelf when sending a message to your own saved messages:Protocol Definition
StickerPackRef
Reference to a sticker pack.Usage
Used to reference sticker packs when retrieving, adding, or removing stickers.Protocol Definition
Notes
Snowflake IDs
All ID fields use thefixed64 type and are snowflake IDs. Snowflakes are 64-bit integers that encode:
- Timestamp (milliseconds since epoch)
- Worker ID
- Sequence number
Oneof Semantics
The ChatRef message uses Protocol Buffers’oneof feature, meaning exactly one of the four reference types must be set. Setting multiple fields or none will result in invalid messages.
Input vs Output
The comment inrefs.proto notes that ChatRef is “only meant to be used for input.” In practice:
- Input: Use ChatRef when specifying which chat to target in requests
- Output: Server responses typically include the full Message/Channel/Group object with embedded IDs rather than ChatRef