Events & Permissions

Robots interact with your server through events and permissions. Events are notifications about things that happen. Permissions control what data the robot can access and what actions it can perform.

Event Types

There are 12 event types that robots can subscribe to:

Message Events

EventDescriptionPayload includes
room.messageA message was sent in a roomRoom ID, sender, content, timestamp
room.message.editedA message was editedRoom ID, message ID, new content, editor
room.message.deletedA message was deletedRoom ID, message ID, deleter

Voice Events

EventDescriptionPayload includes
voice.joinA user joined a voice roomRoom ID, user ID, username
voice.leaveA user left a voice roomRoom ID, user ID, username, duration

Member Events

EventDescriptionPayload includes
member.joinA new member joined the serverUser ID, username, join timestamp
member.leaveA member left the serverUser ID, username
member.role_changedA member’s role was updatedUser ID, old role, new role

Room Events

EventDescriptionPayload includes
room.createdA new room was createdRoom ID, name, creator
room.deletedA room was deletedRoom ID, name

Other Events

EventDescriptionPayload includes
presence.updateA member’s online status changedUser ID, status (online/offline/idle)
server.updatedServer settings were changedChanged fields, updater

Permissions

There are 6 permission levels that control what a robot can access:

PermissionDescription
read_messagesRead message content from rooms. Required to receive message events with full content.
send_messagesSend, edit, and delete the robot’s own messages in rooms.
read_membersAccess the server member list and receive member join/leave events.
read_voiceReceive voice room join and leave events.
read_roomsAccess the room list and receive room created/deleted events.
read_presenceReceive member presence (online/offline/idle) updates.

Event-to-Permission Mapping

Each event requires a specific permission. If a robot does not have the required permission, the event will not be delivered even if the robot has subscribed to it.

EventRequired Permission
room.messageread_messages
room.message.editedread_messages
room.message.deletedread_messages
voice.joinread_voice
voice.leaveread_voice
member.joinread_members
member.leaveread_members
member.role_changedread_members
room.createdread_rooms
room.deletedread_rooms
presence.updateread_presence
server.updatedread_rooms

How Event Subscriptions Work

When you create or update a robot, you select which events the robot should receive. This is a two-layer system:

  1. Permissions determine what the robot is allowed to access
  2. Subscriptions determine which events are actually delivered

Both must be in place for an event to reach your robot. For example, if a robot has the read_messages permission but is not subscribed to room.message, it will not receive message events. Conversely, if it is subscribed to room.message but lacks the read_messages permission, the event will be filtered out.

This design lets you grant broad permissions while receiving only the specific events you care about, reducing noise in your event stream.

Event Payload Format

All events follow a consistent JSON structure:

{
  "id": "evt_01H1234567890",
  "type": "room.message",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "serverId": "srv_abc123",
  "data": {
    "roomId": "room_xyz",
    "senderId": "usr_456",
    "senderName": "Alice",
    "content": "Hello from the room!",
    "messageId": "msg_789"
  }
}

The id field is globally unique and can be used for deduplication. The timestamp is in ISO 8601 format. The data field contains event-specific information that varies by event type.

Best Practices

  • Subscribe only to events you need. Unnecessary subscriptions increase noise and consume your rate limit quota on webhook deliveries.
  • Grant minimal permissions. A notification bot that only sends messages needs send_messages and nothing else.
  • Use event IDs for deduplication. In rare cases (webhook retries, SSE reconnection), you may receive the same event twice. Use the id field to detect and skip duplicates.
  • Handle unknown event types gracefully. New event types may be added in the future. Your handler should ignore events it does not recognize rather than crashing.