Group channel
A group channel is a chat that allows close interactions among a limited number of users. It can be private or public. A private group channel can let a user join the chat through an invitation by another user who is already a member of the chatroom. For 1-to-1 messaging, you can create a private group channel with two members. A public group chat can let a user join the chat without invitation from others. A group channel can consist of one to one hundred members by default setting. This default number of members can increase per request.
A user can receive all messages from the group channels that they are a member of, and sends a message to those channels. They can also receive push notifications, typing indicators, unread counts and read receipts from the joined channels when they go offline. For more information, see the Push notifications page which describes how to turn on and manage the push preference.
Note: To learn about differences between open channels and group channels, see Channel types.
Choose a type of a channel
With our Chat SDK for iOS, you can use a variety of behavior related properties when creating different types of group channels. You can create a group channel after configuring these properties.
Private vs. Public
A private group channel can be joined only by users that have accepted an invitation from an existing channel member by default. On the other hand, a public group channel can be joined by any user without an invitation, like an open channel.
A private channel can be used for 1-on-1 conversations, such as clinical consultations and Instagram-style Direct Messages, while a public channel for 1-to-N conversations, such as small group discussions among students.
1-to-1 vs. 1-to-N
The distinct
property determines whether to resume an old channel or to create a new one when someone attempts to open a channel with the same members. For a 1-to-1 chat, it is highly recommended that you turn on the distinct
property to continuously use the existing channel.
Let's say there is a distinct group channel with user A, B, and C. If you attempt to create a new channel with the same members, the existing channel will be used. This is similar to Twitter-style 1-to-1 direct messaging. If the distinct
property of the channel is set to false, a new channel will be created.
Note: The default value of this option is false. When a new member is invited or an existing member leaves the channel, then the
distinct
property of the channel is automatically turned off as well.
Supergroup vs. Group
For occasions that demand engagement among a high volume of members, you can create a Supergroup channel, an expanded version of a group channel. It can be used for midsize conferences or large group discussion, such as company-wide stand-ups.
When the super
option is set to true, a Supergroup channel will be created and up to tens of thousands of members can gather in the channel. The maximum number of members for a Supergroup channel can be adjusted depending on your Chat subscription plan.
Note: When
super
is set to YES or true,distinct
can't be supported.
Ephemeral vs. Persistent
Messages sent in an ephemeral group channel are not saved in Sendbird's database. As such, old messages that are pushed out of a user's chat view due to new messages can't be retrieved. On the other hand, messages sent in a persistent group channel are stored permanently in the database by default.
Create a channel
A user can create a group channel from inviting other users anytime in their client app. At the implementation level, you just need to write your code which passes the IDs of users to invite as an argument to a parameter in the creation method.
Before you write the code for creating a group channel for a typical 1-to-1 chat, you should make sure that you turn on the distinct
property of the channel. Otherwise, if you turn off the distinct
property, a new channel will be created with the same partner user 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.
However, if you plan to create a Supergroup channel, the distinct
property should be turned off.
Note: If you want to retrieve a list of group channels, which also includes the current user's empty channels without any chat, you should set the
includeEmptyChannel
option of aSBDGroupChannelListQuery
instance to YES for the retrieval.
When creating a channel, you can also append additional information like cover image and description by passing several arguments to the corresponding parameters.
List of arguments
Argument | Description |
---|---|
| Type: NSString |
| Type: BOOL |
| Type: BOOL |
| Type: NSArray |
| Type: NSString |
| Type: NSString |
| Type: NSString |
You can get a cover image URL using the coverUrl
property of a SBDGroupChannel
object, and update the channel's cover image using a method like updateChannelWithName:isDistinct:coverUrl:data:completionHandler:
.
Note: You can also create a group channel using Chat Platform API which helps you control channel creations and member invitations on your server-side.
Otherwise, you can configure SBDGroupChannelParams
and create a new channel with that like below.
Note: By default, the Allow creating group channels option is turned on which means that group channels can be created by any user with Sendbird Chat SDK. This may grant access to unwanted data or operations, leading to potential security concerns. To manage your access control settings, you can turn on or off each option in Settings > Application > Security > Access control list on Sendbird Dashboard.
Invite users as members
Only members of a group channel can invite new users to the channel. You can also determine whether the newly invited user sees the past messages in the channel or not.
Note: In your dashboard, go to the Settings > Chat > Channels > Group channels, and there is the
Chat history
option. If the option is turned on, new users can view all messages sent before they have joined the channel. If turned off, new users only see messages sent after they have been invited. By default, this option is turned on.
Accept or decline an invitation from another user
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. Otherwise, the invitation will be canceled if a user declines it. Since a user is allowed to join up to 2,000 group channels, the invitation to a user who already belongs to a maximum number of group channels will be canceled automatically.
By implementing the channel:didReceiveInvitation:
and channel:didDeclineInvitation:
in the channel delegate, you can make the client apps of other members in the foreground to be notified of the results of two actions above. If you want more information, see the Event delegate page.
Note: By using the
setChannelInvitationAutoAccept:completionHandler:
, you can determine for users within an application whether or not to automatically join a private group channel promptly from an invitation without having to accept it. By default, the value of channel invitation preference is YES. If you want to give them the option to decide whether to accept or decline an invitation, you should set the value of the preference to NO through thesetChannelInvitationAutoAccept:completionHandler:
like the following sample code.
Join a channel as a member
This is only for public group channels. Any user can join a public group channel as a member without an invitation and chat with other members in the channel. Since a user is allowed to join up to 2,000 group channels, a user who already belongs to a maximum number of group channels can't join a new channel.
Leave a channel
A user can leave group channels as shown below. After leaving, the user can't receive messages from the channel, and this method can't be called for deactivated users.
Freeze and unfreeze a channel
You can temporarily disable various functions of a group channel to stop members from chatting in the channel, and enable the functions so that the members chat with each other. Note that in a frozen channel, normal members can't chat with each other but the operators can send a message to the channel.
Delete a channel
Only the operators of a group channel can delete the channel. Otherwise, an error is returned through the completionHandler
.
Note: The following code works properly in the operators' client apps only.
Retrieve a list of channels
You can retrieve a list of the current user's private group channels using the loadNextPageWithCompletionHandler:
method of a SBDGroupChannelListQuery
instance, which returns a list of SBDGroupChannel
objects.
Note: Using the
includeEmptyChannel
option of aSBDGroupChannelListQuery
instance, you can determine whether to include empty channels in the result. Empty channels are group channels that have been created but do not contain any messages, and are not included by default. However, if you turn off theChat history
option in your dashboard, you may retrieve empty channels in the result.
You can also retrieve a list of the current user's public group channels using the loadNextPageWithCompletionHandler:
method of a SBDPublicGroupChannelListQuery
instance, which returns a list of SBDGroupChannel
objects.
Note: Using the
includeEmptyChannel
option of aSBDPublicGroupChannelListQuery
instance, you can determine whether to include empty channels in the result. Empty channels are group channels that have been created but do not contain any messages, and are not included by default. However, if you turn off theChat history
option in your dashboard, you may retrieve empty channels in the result.
Note: Refer to this section in the Advanced page for information on how to search for specific group channels with keywords and filters.
Retrieve a channel by URL
Since a channel URL is a unique identifier of a group channel, you can use a URL when retrieving a channel object.
Note: We recommend that you store a user's channel URLs to handle the lifecycle or state changes of your client app, or other unexpected situations. For example, when a user is disconnected from Sendbird server due to switching to another app temporarily, you can provide a smooth restoration of the user's state using a stored URL to fetch the appropriate channel instance.
Hide or archive a channel from a list of channels
The following code will allow you to hide or archive a specific group channel from a list of the channels.
List of arguments
Argument | Description |
---|---|
| Type: BOOL |
| Type: BOOL |
Using the channel.hiddenState
, you can check the channel state with regard to the list.
You can also filter channels by their state like the following:
Filter channels by user IDs
Using the SBDGroupChannelListQuery
's userIdsExactFilter
or userIdsIncludeFilter
, you can filter group channels by user IDs. Let's assume the ID of the current user is Harry and the user is a member of two group channels:
- channelA consists of Harry, John, and Jay.
- channelB consists of Harry, John, Jay, and Jin.
A userIdsExactFilter
returns a list of the current user's group channels containing exactly the queried user IDs. In case you specify only one user ID in the filter, the filter returns a list of the current user's one (distinct) or more 1-to-1 group channels with the specified user.
A userIdsIncludeFilter
returns a list of the current user's group channels including the queried user IDs partially and exactly. Two different results can be returned according to the value of the queryType
parameter.
Send a message
In a group channel, users can send messages of the following types:
Message type | Class | Description |
---|---|---|
Text | A text message sent by a user | |
File | A binary file message sent by a user |
In addition to these message types, you can further subclassify a message by specifying its custom type. This custom type takes on the form of a NSString
and can be used to search or filter messages. It allows you to append information to your message and customize message categorization.
The following code shows several types of parameters that you can configure to customize text messages by using SBDUserMessageParams
. Under the SBDUserMessageParams
object, you can assign values to message
, data
and other properties. By assigning arbitrary string to the data
property, you can set custom font size, font type or JSON
object. To send your messages, you need to pass the SBDUserMessageParams
object as an argument to the parameter in the sendUserMessageWithParams:completionHandler:
method.
Through the completionHandler
of the sendUserMessageWithParams:completionHandler:
method, Sendbird server always notifies whether your message has been successfully sent to the channel. When there is a delivery failure due to network issues, an exception is returned through the callback method.
A user can also send binary files through the Chat SDK. The two ways to send a binary file are: sending the file itself, or sending a URL.
Sending a raw file means you're uploading it to Sendbird server where it can be downloaded in client apps. When you upload a file directly to the server, there is a size limit imposed on the file depending on your plan. You can see the limit in your dashboard and adjust it with our sales team.
The other option is to send a file hosted on your server. You can pass the file's URL, which represents its location, as an argument to a parameter. In this case, your file is not hosted on Sendbird server and it can only be downloaded from your own server. When you send a file message with a URL, there is no limit on the file size since it's not directly uploaded to Sendbird server.
Note: You can use
sendFileMessagesWithParams:progressHandler:sentMessageHandler:completionHandler:
, which is another method that allows you to send up to 20 file messages per one method call. Refer to our API Reference to learn more about it.
The following code shows several types of parameters that you can configure to customize your file messages by using SBDFileMessageParams
. Under the SBDFileMessageParams
object, you can assign specific values to customType
and other properties. To send your messages, you need to pass the SBDFileMessageParams
object as an argument to the parameter in the sendFileMessageWithParams:completionHandler:
method.
Through the completionHandler
of the sendFileMessageWithParams:completionHandler:
method, Sendbird server always notifies whether your message has been successfully sent to the channel. When there is a delivery failure due to network issues, an exception is returned through the callback method.
If an app goes to the background while uploading a file such as a profile image or a picture, the app can complete the uploading process by using application:handleEventsForBackgroundURLSession:completionHandler:
method in your AppDelegate. To complete the uploading, a background event delegate should be added and implemented in the following delegation. If you don't want to upload the file on the background mode, remove the following delegation in the AppDelegate.
Send a critical alert message to iOS devices
A critical alert is a notification that can be sent to iOS devices even when mute or Do Not Disturb is turned on. Critical alert messages can be sent to iOS devices through the sendUserMessageWithParams:completionHandler:
and sendFileMessageWithParams:completionHandler:
methods. To do so, create an SBDAppleCriticalAlertOptions
instance and set it as an attribute of a SBDUserMessageParams
instance. Then pass the created SBDUserMessageParams
instance as an argument to a parameter in the sendUserMessageWithParams:completionHandler:
or sendFileMessageWithParams:completionHandler:
method.
Note: To learn more about how to set critical alerts, visit Apple critical alerts.
Receive messages through a channel delegate
Messages sent from other members can be received through the channel:didReceiveMessage:
method in the channel delegate. A SBDBaseMessage
object for each received message is one of the following three message types.
Message type | Class | Description |
---|---|---|
Text | A text message sent by a user | |
File | A binary file message sent by a user | |
Admin | A text message sent by an admin through the Platform API |
The UNIQUE_DELEGATE_ID
is a unique identifier to register multiple concurrent delegates.
If the UI isn't valid anymore, remove the channel delegate.
Reply to a message
You can reply to a specific message in a channel through the sendUserMessageWithParams:completionHandler:
or sendFileMessageWithParams:completionHandler:
method. To do so, you should create a SBDUserMessageParams
or a SBDFileMessageParams
object and then specify the parentMessageId
property of the object. Sending reply messages works the same way as sending regular messages to a channel except replies have an additional parentMessageId
property.
Reply with a text message
When replying to a message through the sendUserMessageWithParams:completionHandler:
method, you should specify and pass a SBDUserMessageParams
object to the method as a parameter.
List of arguments
Argument | Description |
---|---|
| Type: long long |
Reply with a file message
When replying with a file message through the sendFileMessageWithParams:completionHandler:
method, you should specify and pass a SBDFileMessageParams
object to the method as a parameter.
List of arguments
Argument | Description |
---|---|
| Type: long long |
Mention other members in a message
When a member wants to call the attention of other members of a group channel, they can mention those members in a message. To do so, you should:
- Specify a list of the user IDs to mention.
- Add the list to either
SBDUserMessageParams
orFileMessageParams
which may contain options for further action. - Pass the params to either
sendUserMessageWithParams::
orsendFileMessageWithParams::
. - Then only up to 10 members mentioned in the message will be notified.
React to a message
Message reactions will help you build a more engaging chat experience that goes beyond text messages. They are a quick and easy way for users to respond to a message. Users can express their acknowledgement of or feelings about a message without written text by simply adding reactions. They can also view and delete their reactions to the message.
Note: Currently, message reactions are only available in group channels.
You can decide how to display reactions that were added to messages in the current user’s chat view.
Note: The
getPreviousMessages()
method is deprecated as of August 2021. Accordingly, use thegetMessagesByTimestamp:params:completionHandler:
method instead.
Note: By using the
SBDPreviousMessageListQuery
'sloadPreviousMessagesWithLimit:reverse:completionHandler:
method, messages along with their reactions can also be retrieved. To learn more, refer to the Load previous messages section below.
If one of the channel members reacts to a message, the channel:updatedReaction:
method in the channel event delegate will be invoked on all channel members’ devices including the one that belongs to the current user. The applyReactionEvent:
method will reflect the reaction change to the message in real time.
Load previous messages
By using the loadPreviousMessagesWithLimit:reverse:completionHandler:
method of a SBDPreviousMessageListQuery
instance which returns a list of SBDBaseMessage
objects, you can retrieve a set number of previous messages in a group channel. With a returned list, you can display the past messages in your UI once they have loaded.
Note: You can decide whether a user can see the messages sent prior to the user joining a group channel. In your dashboard, go to the Settings > Chat > Channels > Group channels, there is the
Chat history
option. If turned on, new users are allowed to view a message history in joined group channels. If turned off, new users aren't allowed to see the messages prior to joining a group channel.
List of arguments
Argument | Description |
---|---|
| Type: NSInteger |
| Type: BOOL |
A LIMIT
parameter indicates how many messages to be included in a returned list. A SBDPreviousMessageListQuery
instance itself does pagination of a result set according to the value of the LIMIT
parameter, and internally manages a token to retrieve the next page in the result set.
Each time the loadPreviousMessagesWithLimit:reverse:completionHandler:
method is called, the instance retrieves a set number of messages in the next page and then updates the token's value to complete the current call and prepare a next call.
If you create a new query instance and call the loadPreviousMessagesWithLimit:reverse:completionHandler:
method, a set number of the most recent messages are retrieved because its token has nothing to do with the previously created instance. So we recommend that you create a single query instance and store it as a member variable for traversing through the entire message history.
Note: Before calling
loadPreviousMessagesWithLimit:reverse:completionHandler:
method again, you should receive a success callback through thecompletionHandler
first.
The following table shows all the supported filters for SBDPreviousMessageListQuery
to search for messages you want to retrieve. You can use any filters in a similar fashion with the sample code above.
List of filters
Name | Filters |
---|---|
MessageTypeFilter | Messages with the specified message type. Specifying the |
CustomTypeFilter | Messages with the specified custom message type. Specifying the |
S1enderUserIdsFilter | Messages that are sent by the specified users. Specifying the |
Load messages by timestamp or message ID
Using the getMessagesByTimestamp:params:completionHandler:
method, you can retrieve a set number of previous and next messages on both sides of a specific timestamp in a group channel.
Note: The
getPreviousMessages()
method is deprecated as of August 2021. Accordingly, use thegetMessagesByTimestamp:params:completionHandler:
method instead.
The following code shows several types of parameters that you can configure to customize a message query by using SBDMessageListParams
. Under the SBDMessageListParams
object, you can assign specific values to previousResultSize
, messageType
, and other properties. To retrieve messages in a channel, you need to pass the SBDMessageListParams
object as an argument to the parameter in the getMessagesByTimestamp:params:completionHandler:
method.
List of arguments
Argument | Description |
---|---|
| Type: long long |
| Type: BOOL |
| Type: NSInteger |
| Type: NSInteger |
| Type: BOOL |
| Type: SBDMessageTypeFilter |
| Type: NSString |
You can also retrieve a set number of previous and next messages on both sides of a specific message ID in a group channel, using the getMessagesByMessageId:params:completionHandler:
method and SBDMessageListParams
object.
List of arguments
Argument | Description |
---|---|
| Type: long long |
| Type: BOOL |
| Type: NSInteger |
| Type: NSInteger |
| Type: BOOL |
| Type: SBDMessageTypeFilter |
| Type: NSString |
List messages along with their replies
The loadPreviousMessagesWithLimit:reverse:completionHandler:
, getMessagesByTimestamp:params:completionHandler:
or getMessagesByMessageId:params:completionHandler:
methods can be used to retrieve messages and their replies in a specific thread.
Load channel messages
The loadPreviousMessagesWithLimit:reverse:completionHandler:
method of a SBDPreviousMessageListQuery
instance returns a list of SBDBaseMessage
objects. With this method, you can retrieve previous messages in a specific channel.
List of arguments
Argument | Description |
---|---|
| Type: NSInteger |
| Type: BOOL |
| Type: BOOL |
| Type: ENUM |
| Type: BOOL |
| (Deprecated) Type: BOOL** |
| Type: BOOL |
Load messages by timestamp or message ID
The getMessagesByTimestamp:params:completionHandler:
and getMessagesByMessageId:params:completionHandler:
methods of a SBDBaseChannel
instance return a list of SBDBaseMessage
objects.
When using either of the methods above, you can also pass a SBDMessageListParams
object as an argument to the parameter in those methods.
List of properties
Property name | Description |
---|---|
previousResultSize | Type: NSInteger |
nextResultSize | Type: NSInteger |
isInclusive | Type: BOOL |
reverse | Type: BOOL |
includeThreadInfo | Type: BOOL |
replyType | Type: ENUM |
includeParentMessageInfo | Type: BOOL |
| (Deprecated) Type: BOOL |
| (Deprecated) Type: BOOL |
By timestamp
The getMessagesByTimestamp:params:completionHandler:
method returns a set number of messages of previous and next messages on both sides of a specific timestamp in a channel.
List of arguments
Argument | Description |
---|---|
| Type: Long |
By message ID
The getMessagesByMessageId:params:completionHandler:
method returns a set number of previous and next messages on both sides of a specific message ID in a channel.
List of arguments
Argument | Description |
---|---|
| Type: long long |
List replies of a parent message
With the timestamp of the parent message, you can retrieve a single message with its replies by creating and passing a SBDThreadedMessageListParams
object into the getThreadedMessagesByTimestamp:params:completionHandler:
method as an argument.
List of arguments
Argument | Description |
---|---|
| Type: long long |
| Type: NSInteger |
| Type: NSInteger |
| Type: BOOL |
| Type: BOOL |
| Type: BOOL |
| (Deprecated) Type: BOOL |
Retrieve a message
You can retrieve a specific message by creating and passing the SBDMessageRetrievalParams
object as an argument into the getMessageWithParams:completionHandler:
method.
List of arguments
Argument | Description |
---|---|
| Type: long long |
| Type: SBDChannelType |
| Type: NSInteger |
Update a message
A user can update any of their own text and file messages sent. An error is returned if a user attempts to update another user's messages. In addition, channel operators can update any messages sent in a channel.
If a message is updated, the channel:didUpdateMessage:
method in the channel delegate will be invoked on all channel participants' devices except the one that updated the message.
Delete a message
A user can delete any messages which were sent by themselves. An error is returned if a user attempts to delete the messages of other members. Also channel operators can delete any messages in a channel.
If a message is deleted, the channel:messageWasDeleted:
method in the channel delegate will be invoked on all channel participants' devices including the one that deleted the message.
Copy a message
A user can copy and send their own message in the same channel or to another channel.
User message
File message
List of arguments
Argument | Type | Description |
---|---|---|
| object | Specifies a message to copy. |
| object | Specifies a target channel to send a copied message to. |
| handler | Specifies the callback handler to receive the response from Sendbird server for a message copy request. |
Clear the chat history
By using the resetMyHistoryWithCompletionHandler:
method, you can help the current user clear the chat history in a group channel and start a fresh conversation with other members in the same channel. As the method's name implies, the chat history will be cleared only from the channel view of the current user, and will no longer be shown in that view. But the messages are not deleted from the database of the Sendbird system, and other members can still see all the messages in their channel views.
This method simply clears the messages for the user by updating the lastMessage
and readReceipts
properties of a group channel object in addition to other internally managed data such as the number of the user’s unread message.
When a user is online, all data associated with the group channels they are a member of are automatically updated by the SBDMain
instance. However, when a user is disconnected from Sendbird server and reconnects later, you should call the refreshWithCompletionHandler:
method to update the channels with the latest information.
Note: If you want to make your users see the channels updated to the most recent when their client apps are in the foreground, we recommend you call the
refreshWithCompletionHandler:
in thedidSucceedReconnection
method which receives a callback from Sendbird server when successfully reconnected.
Retrieve a list of all members
You can retrieve a list of members in a group channel using the members
property of a SBDGroupChannel
object.
Members of a group channel are automatically updated when a user is online. But when a user is disconnected from Sendbird server and then reconnected, you should use the refreshWithCompletionHandler:
method to update their channels with the latest information. See the Refresh all data related to a group channel section for the sample code.
Retrieve the online status of members
To stay updated on the online status of each member in a group channel, call the refreshWithCompletionHandler:
method before using the members
property of a SBDGroupChannel
object to retrieve the members of the channel.
By checking the connectionStatus
property of each SBDMember
object in the members
property, you can then retrieve the user's current connection status. The connectionStatus
property has one of the following two values:
Objective-C
Value | Description |
---|---|
SBDUserConnectionStatusOffline | The user is not connected to Sendbird server. |
SBDUserConnectionStatusOnline | The user is connected to Sendbird server. |
Swift
Value | Description |
---|---|
SBDUserConnectionStatus.offline | The user is not connected to Sendbird server. |
SBDUserConnectionStatus.online | The user is connected to Sendbird server. |
Note: If your client app needs to keep track of the connection status of users in real time, we recommend that you call periodically the
loadNextPageWithCompletionHandler:
method of aSBDApplicationUserListQuery
instance after specifying itsuserIdsFilter
filter, perhaps in intervals of one minute or more.
Retrieve a list of members and operators in a specific order
The members and operators of a group channel can be retrieved by using the loadNextPageWithCompletionHandler:
method of a SBDGroupChannelMemberListQuery
instance. For a specific order, set either option in the table below to the order
property of SBDGroupChannelMemberListQuery
.
SBDMemberListOrder
Value | Description |
---|---|
SBDMemberListOrderNicknameAlphabetical | Members are arranged in an alphabetical order (Default). |
SBDMemberListOrderOperatorThenMemberNicknameAlphabetical | Operators are sequenced before the members, both in an alphabetical order. |
SBDGroupChannelOperatorFilter
For filtering, set one of the options in the table below to the operatorFilter
of SBDGroupChannelMemberListQuery
.
Value | Description |
---|---|
SBDGroupChannelOperatorFilterAll | No filter is applied to the group channel list (Default). |
SBDGroupChannelOperatorFilterOperator | Only operators are retrieved for the list. |
SBDGroupChannelOperatorFilterNonOperator | All members, except for operators, are retrieved for the list. |
Retrieve a list of operators
You can create a SBDOperatorListQuery
instance and use the loadNextPageWithCompletionHandler:
method to retrieve a list of operators who monitor and control the activities in a group channel.
Register operators
You can register members as an operator of a group channel.
Cancel the registration of operators
You can cancel the registration of operators from a group channel but leave them as members.
If you want to cancel the registration of all operators in a channel at once, use the following code.
Retrieve a list of banned or muted users
You can create a query instance to get a list of banned or muted users from a group channel. This is only available for users who are registered as operators of a group channel.
Ban and unban a user
Operators of a group channel can remove any users that behave inappropriately in the channel by using our Ban feature. Banned users are immediately expelled from a channel and allowed to join the channel again after the time period set by the operators. The operators can ban and unban users from group channels using the following code.
Note: Instead of
banUser:seconds:completionHandler:
andunbanUser:completionHandler:
methods, you can usebanUserWithUserId:seconds:completionHandler:
andunbanUserWithUserId:completionHandler:
, as they have the same abilities.
Mute and unmute a user
Operators of a group channel can prohibit the selected users from sending messages using our Mute feature. Muted users remain in the channel and are allowed to view the messages, but can't send any messages until the operators unmute them. Operators can mute and unmute users in the channel using the following code:
Note: Instead of
muteUser:completionHandler:
andunmuteUser:completionHandler:
methods, you can also usemuteUserWithUserId:completionHandler:
andunmuteUserWithUserId:completionHandler:
, as they have the same abilities.
Report a message, a user, or a channel
In a group channel, a user can report suspicious or harassing messages as well as the other users who use abusive language. The user can also report channels if there are any inappropriate content or activity within the channel. Based on this feature and our report API, you can build your own in-app system for managing objectionable content and subject.
List of arguments
Argument | Type | Description |
---|---|---|
| object | Specifies the message to report for its suspicious, harassing, or inappropriate content. |
| object | Specifies the user who uses offensive or abusive language such as sending explicit messages or inappropriate comments. |
| enum | Specifies a report category which indicates the reason for reporting. Acceptable values are SBDReportCategorySuspicious, SBDReportCategoryHarassing, SBDReportCategoryInappropriate, and SBDReportCategorySpam. |
| string | Specifies additional information to include in the report. |