This method can be used to create a new channel with the given name, image and purpose. It takes a list of members that are to be added to the channel. The user whose token is used to create the channel is also added to the channel. The method returns the channel id in the response.
The method endpoint is https://api.flock.co/v1/channels.create
and follows the method calling conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
token | String | Yes | Authentication token of the user creating the channel |
name | String | Yes | Name of the channel (max 255 characters) |
purpose | String | No | Channel purpose |
profileImage | String | No | URL of the channel's profile image |
type | String | No | Can be "public" or "private" . Set to "private" by default. |
members | Array | Yes | A list of user identifiers to be added to the channel |
Response
The response object has the following attributes:
Name | Type | Description |
---|---|---|
id | String | Identifier for the channel |
members | Object | An object whose keys are user ids of the members who were added and values are ChannelMemberStatus objects, indicating whether the addition was successful or not. |
Here's an example response:
Example
{ "id": "g:<id1>", "members": { "u:<id2>": { "status": "added" }, "u:<id3>": { "status": "failed", "error": "UserNotFound" } } }