Create Channel
Create Channel
POST
https://api.talkplus.io/v1.4/api/channels/create
You can enter up to 5 key-value pairs in data field. The maximum size of key is 128 characters and the maximum size of value is 1024 characters. Both key and value must be strings.
Headers
Name | Type | Description |
---|---|---|
content-type | string | application/json |
app-id* | string | App ID |
api-key* | string | App API key |
Request Body
Name | Type | Description |
---|---|---|
name | string | channel name |
ownerId | string | channel owner (if unspecified, channel can be modified only through REST API) |
type* | string | channel type (private, public, invitationOnly...) |
channelId | string | If empty, server will generate a random ID |
reuseChannel | boolean | read docs below |
invitationCode | string | Required if channel type is 'invitationOnly' |
members | array | Array of user IDs (string). Channel owner added by default. |
imageUrl | string | Channel image URL |
data | object | key-value data |
maxMemberCount | integer | maximum number of members allowed. - super channel: default: -1 (unlimited), min: 1, max: 100. - the rest: default: 100, min: 1, max: 100 |
hideMessagesBeforeJoin | boolean | whether to hide from new member messages that were sent before new member joining |
category | string | used as filter during search. max length: 32 characters |
subcategory | string | extra filter used along with category. max length: 32 characters |
Supported channel types are follows: private, public, invitationOnly, broadcast, super_broadcast, super_public and super_private.
type and members fields are required.
invitationCode
field is required forinvitationOnly
channel type.
Type | Value | Can Join Channel | FCM Support |
PRIVATE | private | X | O |
PUBLIC | public | O | O |
INVITATION ONLY | invitationOnly | O (need Invitation Code) | O |
BROADCAST | broadcast | O | O |
SUPER_BROADCAST | super_broadcast | O | X |
SUPER_PRIVATE | super_private | O | X |
SUPER_PUBLIC | super_public | O | X |
For private channel, setting
reuseChannel
to true allows you to reuse existing channel if channel ID and member IDs match those of existing channel and members. This feature is useful when implementing 1:1 chat.Anyone can join a public channel, except for banned users.
For invitationOnly channel, invitationCode field is required.
For broadcast and super_broadcast channel:
When the channel owner sends a message, the message is sent to all channel members.
When a channel member other than the channel owner sends a message, the message is sent only to the channel owner.
For super_broadcast, super_private and super_public channel:
You can set the maximum number of members above 100.
Set the maximum member limit to -1 allows unlimited members.
super channel returns empty
members
,bannedUsers
andmutedUsers
fieldsunreadCount
,invitationCode
,lastReadAt
fields are not supported.FCM push notifications are not sent since there can be too many users and notifications.
super channel example
Last updated