A channel object represents a chat channel in OriginChats. Channels can be text or voice channels.
{
"type": "text",
"name": "general",
"display_name": "General Chat",
"icon": "https://example.com/icon.png",
"description": "General chat channel for everyone",
"permissions": {
"view": ["user"],
"send": ["user"],
"delete": ["admin", "moderator"],
"delete_own": ["user"],
"edit_own": ["user"],
"pin": ["admin"],
"react": ["user"]
}
}type: Channel type. Can be"text"or"voice".name: Channel name (string), used as unique identifier.display_name: Display name for the channel. If present, this should be displayed instead ofnamein the UI.icon: HTTP/HTTPS URL for the image displayed on a channel.description: Description of the channel.permissions: Object with arrays of roles for each action.view: Roles that can view/access the channel.send: Roles that can send messages (text channels only).delete: Roles that can delete any message.delete_own: (optional) Roles allowed to delete their own messages. If not present, all roles can delete their own messages by default.edit_own: (optional) Roles allowed to edit their own messages. If not present, all roles can edit their own messages by default.pin: (optional) Roles allowed to pin messages in the channel. If not present, only the owner can pin messages by default.react: (optional) Roles allowed to add/remove reactions.
Text channels support real-time messaging with:
- Send/receive messages
- Edit and delete messages
- Replies and threading
- Reactions
- Pinning messages
- Message search
Voice channels support audio communication via WebRTC:
{
"type": "voice",
"name": "lounge",
"display_name": "Chat Lounge",
"icon": "...",
"description": "Voice hangout",
"permissions": {
"view": ["user"]
},
"voice_state": [
{
"username": "alice",
"muted": false
},
{
"username": "bob",
"muted": true
}
]
}voice_state: (optional) Array of participants currently in the voice channel.- Only sent for channels the requesting user is in.
- Each participant contains:
username: Participant's display name.muted: Whether their microphone is muted.
Note: The peer_id field is NOT included in voice_state for security and data efficiency. Use the voice_join/voice_state commands to get peer IDs when joining a channel.
- Join/Leave: Users can join and leave voice channels freely
- Participants List: Users with
viewpermission can see who's in the channel - Audio Streaming: Uses WebRTC peer-to-peer connections
- Mute: Users can mute/unmute their microphone
- View-Only Mode: Users can view voice channel participants without joining
See permissions documentation for details on how permissions work.
- Text Channels: message_new, messages_get
- Voice Channels: voice_join, voice_state
- Channel List: channels_get