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

NameTypeRequiredDescription
tokenStringYesAuthentication token of the user creating the channel
nameStringYesName of the channel (max 255 characters)
purposeStringNoChannel purpose
profileImageStringNoURL of the channel's profile image
typeStringNoCan be "public" or "private". Set to "private" by default.
membersArrayYesA list of user identifiers to be added to the channel

Response

The response object has the following attributes:

NameTypeDescription
idStringIdentifier for the channel
membersObjectAn 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" }
    }
}