Create a public channel. Optionally, include specified users. The channel creator is included as a member by default. Permission required: create-c.
Channel naming has restraints following the regex filter [0-9a-zA-Z-_.]+ by default. See UTF8 Settings to modify regex filter for channel names. Channel names must not allow for any whitespaces.
Changelog
| Version | Description |
|---|---|
| 6.4.1 | Added excludeSelf param |
| 0.13.0 | Added |
The authToken of the authenticated user.
The userId of the authenticated user.
{
"name": "channelname",
"members": [
"rocket.cat"
],
"readOnly": true,
"excludeSelf": true,
"customFields": {
"type": "default"
},
"extraData": {
"broadcast": true,
"encrypted": false,
"teamId": "658441562dd9f928ad9951aa"
}
}The name of the channel.
An array of the users to be added to the channel when it is created.
Set if the channel is read only or not. It is false by default.
If set to true, the user calling the endpoint is not automatically added as a member of the channel. The default value is false.
If you have defined custom fields for your workspace, you can provide them in this object parameter. For details, see the Custom Fields document.
Enter the following details for the object:
broadcast: Whether the channel should be a broadcast room.encrypted: Whether the channel should be encrypted.teamId: Enter an existing team ID for this channel. You need thecreate-team-channelpermission to add a team to a channel.
For more information, see Channels
OK
{
"channel": {
"_id": "ByehQjC44FwMeiLbX",
"name": "channelname",
"t": "c",
"usernames": [
"example"
],
"msgs": 0,
"u": {
"_id": "aobEdbYhXfu5hkeqG",
"username": "example"
},
"ts": "2016-05-30T13:42:25.304Z"
},
"success": true
}Unauthorized
{
"status": "error",
"message": "You must be logged in to do this."
}