/ SDKs / .NET
SDKs
Chat SDKs .NET v4
Chat SDKs .NET
Chat SDKs
.NET
Version 4

Accept or decline an invitation

Copy link

A user who is invited to a group channel can accept or decline the invitation. If a user accepts an invitation, they join the channel as a new member and can start chatting with other members. If the user declines the invitation, the invitation is no longer valid.

Users can join up to 2,000 group channels. When the number of group channels a user can join reaches the maximum number, new invitations are automatically declined.

groupChannel.AcceptInvitation((inError) =>
{
    if (inError != null)
        return; 
    // Handle error.
});

groupChannel.DeclineInvitation((inError) =>
{
    if (inError != null)
        return; 
    // Handle error.
});

Set the channel invitation preference for your Sendbird application which determines whether a user can automatically accept a group channel invitation or manually accept invitations. By using the SetChannelInvitationPreference() method, you can determine for users within an application whether they can automatically join a private group channel without having to accept an invitation to join. If the value of SetChannelInvitationPreference() is set to true, invitations are automatically accepted. If the value is set to false, users can either accept or decline invitations. By default, the value is set to true.

SendbirdChat.SetChannelInvitationPreference(inAutoAccept: false, (inError) =>
{
    if (inError != null)
        return; 
    // Handle error.
});

If the client app is in the foreground, members of the group channel are notified whether the newly invited user has accepted or declined the invitation. To implement this functionality, use the OnUserReceivedInvitation() and OnUserDeclinedInvitation() handlers of a channel event handler. For more information, see the event handler page.