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

Accept or decline an invitation from another user

A user who is invited to a group channel can either accept or decline the invitation. If a user accepts an invitation, they join as a new member and can start chatting with other members in the channel. If the user declines an invitation to join a channel, the invitation no longer exists. Since a user is only allowed to join up to 2,000 group channels, if a user who already belongs to a maximum number of group channels receives an invitation, it will be automatically canceled.

// Accepting an invitation.
groupChannel->AcceptInvitation([](SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }
});

// Declining an invitation.
groupChannel->DeclineInvitation([](SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }
});

Note: By implementing the InvitationReceived() and InvitationDeclined() of a channel event handler, you can make the client apps of other members in the foreground to be notified of the results of two actions above. For more information, see the Event handler page.

Using the SBDMain::SetChannelInvitationPreference(), you can determine whether users will automatically join a private group channel promptly from an invitation without having to accept it. By default, the value of channel invitation preference is set to true. To give users the options to accept or decline an invitation, set the value of invitation preference to false using SBDMain::SetChannelInvitationPreference() like the code below.

// The value of true (default) means that a user will automatically join a group channel without the option of accepting or declining an invitation.
bool autoAccept = false;

SBDMain::SetChannelInvitationPreference(autoAccept, [](SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }
});