Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Latest commit

 

History

History
55 lines (43 loc) · 3.05 KB

File metadata and controls

55 lines (43 loc) · 3.05 KB

Create Channel

Creates a new public channel, optionally including specified users. The channel creator is always included.

{% hint style="info" %} Channel naming has restraints following the regex filter [0-9a-zA-Z-_.]+ by default.

This can be modified in the Admin > General > UTF8. Channel names should not allow for any whitespaces. {% endhint %}

HTTP MethodURLRequires Auth
POST/api/v1/channels.createyes

Body Parameters

KeyExample ValueDescription
name*channelnameThe name of the new channel.
members["rocket.cat"]The users to add to the channel when it is created.
readOnlytrueSet if the channel is read-only or not. The default value is false.
excludeSelftrueIf set to true, the user calling the endpoint is not automatically added as a member of the group. The default value is false.
customFields{ "type": "default" }If you have defined custom fields for your workspace, you can provide them in this object parameter.
extraData

"extraData": { "broadcast": true, "encrypted": false,

"teamId": "658441562dd9f928ad9951aa" }

Enter the following details for the object:

  • broadcast: Whether the group should be a broadcast group.
  • encrypted: Whether the group should be encrypted.
  • teamId: Enter the team ID for which you want to create a group.

For more information, see Channels.

Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type: application/json" \
     https://localhost:3000/api/v1/channels.create \
     -d '{ 
          "name": "channelname" }'

Example Response

{
   "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
}

Change Log

Version Description
6.4.1 Added excludeSelf param
0.13.0 Added