channels_get
channels_get returns every channel you can view, in sidebar order. Call it after logging in to build the channel list.
Request
Section titled “Request”{ "cmd": "channels_get" }No fields besides cmd.
Response
Section titled “Response”{ "cmd": "channels_get", "val": [ { "name": "info", "type": "separator", "size": 10, "permissions": { "view": ["user"], "send": ["user"] } }, { "name": "general", "type": "text", "display_name": "General", "permissions": { "view": ["user"], "send": ["user"] }, "last_message": 1788940000.31, "last_message_id": "4c1f7a2e-2b1d-4a44-9d0c-3f1f9b8e6a10", "last_message_by_user": 1788939000.12, "slow_mode_cooldown": 0 } ]}val is an array of channel objects. The permissions objects above are shortened. The server fills in every permission key, using the default for any the channel doesn’t set.
- Separators are always included. Other channels appear only if your roles allow
view. - Text and voice channels include
last_message,last_message_id, andlast_message_by_user(your own latest message), eachnullwhen there is none. - Voice channels include
voice_state, the list of connected participants. - Forum channels include
threads, the threads you can see.
Replace your whole channel list with val. The server also sends an unrequested channels_get when channels are created, moved, renamed, or deleted, or when a role change alters what you can see.
Permissions
Section titled “Permissions”You must be logged in.
Errors
Section titled “Errors”None besides the generic authentication errors.
