Chat / Unreal
Current version: v3
Chat Unreal v3
Chat Unreal
Chat
Unreal
Home
/
Chat
/
Unreal
/
Channels

Create a group channel

A group channel can be created any time a user invites another user in their client app. To create a group channel at the implementation level, you need to pass the IDs of users to invite as an argument to a parameter in the creation method.

Note: Before creating a group channel, you should make sure to turn on the distinct property of the channel. Otherwise, the distinct property will be turned off by default, in which a new channel will be created with the same group of members even if there is already an existing channel between them. In this case, multiple 1-to-1 channels between the same two users can exist, each with its own chat history and data.

SBDGroupChannel::CreateChannel(USER_IDS, NAME, IS_DISTINCT, COVER_URL, DATA, CUSTOM_TYPE, [](SBDGroupChannel* groupChannel, SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }
});

Another way to create a new group channel is by following the implementation below and configuring SBDGroupChannelParams.

std::vector<std::wstring> user_ids;
user_ids.push_back(L"Jane");
user_ids.push_back(L"Katherine");
user_ids.push_back(L"Julia");

std::vector<std::wstring> operator_user_ids;
operator_user_ids.push_back(L"Tyler");

SBDGroupChannel::CreateChannel(SBDGroupChannelParams().SetUserIds(user_ids).SetOperatorUserIds(operator_user_ids), [](SBDGroupChannel* groupChannel, SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }
});

List of arguments

ArgumentTypeDescription

USER_IDS

std::vector

Specifies a list of one or more users to invite to the channel.

NAME

std::wstring

Specifies the topic or the name of the channel.

IS_DISTINCT

boolean

Determines whether to reuse an existing channel or create a new channel. If set to true, returns a channel with the same users in the USERS or creates a new channel if no match is found.

* You can also use this property in conjunction with CUSTOM_TYPE and USER_IDS to create distinct channels for a specified channel custom type and a set of specified users. In order to enable the functionality, visit this page and contact us on Sendbird Dashboard.

COVER_URL

std::wstring

Specifies the cover image URL of the channel.

DATA

std::wstring

Specifies additional channel information such as a long description of the channel or a JSON formatted string.

CUSTOM_TYPE

std::wstring

Specifies the custom channel type which is used for channel grouping.

Using the cover_url property and the UpdateChannel() method, you can get and update the cover image URL of a channel.

Note: You can also create a group channel using the Chat API which helps you control channel creations and member invitations on your server-side.