Create channel

The chat.createChannel method on a Client instance makes a POST request to the chat/channels endpoint and returns the created or rejoined channel.

Warning: This endpoint is not tested, you may or may not run into unexpected behavior.

Parameters

ParameterTypeOptionalDescription
type‘PM’ | ‘ANNOUNCE’Channel type to create or rejoin

If type is set to PM then the parameters are as follows:

ParameterTypeOptionalDescription
type‘PM’
optionsCreatePMChannelOptions

options.body

ParameterTypeOptionalDescription
target_idnumberTarget user ID
messagestringMessage to send
channelChannelDetailsChannel details
channel.namestringChannel name
channel.descriptionstringChannel description

If type is set to ANNOUNCE then the parameters are as follows:

ParameterTypeOptionalDescription
type‘ANNOUNCE’
optionsCreateAnnounceChannelOptions

options.body

ParameterTypeOptionalDescription
messagestringMessage to send with the announcement
target_idsnumber[]Target user IDs
channelChannelDetailsChannel details
channel.namestringChannel name
channel.descriptionstringChannel description

Returns

Promise<Channel>;

Types

Possible Exceptions

See the error handling documentation for more information.

  • invalid_json_syntax
  • network_error
  • unexpected_response

Notice that something is missing? Found a typo? Think something's incomplete? Or think that something can be explained better? Feel free to open a pull request or submit an issue on the library's Github repository .