Development Guide
Message Block Notification Callback
The SDK supports the Message Block Notification Callback starting from version 5.1.4.
By default, the message sender is unaware of whether the message has been blocked by RC's moderation service. If the App wishes to notify the message sender when a message is blocked due to triggering moderation rules, the Message Block Notification Callback service can be enabled.
RC's content moderation service (including message sensitive words, IM moderation service, and message callback service) may block messages in the following scenarios:
- The content of a text message triggers RC's built-in sensitive words, preventing the message from being delivered to the recipient.
- The content of a text message triggers custom sensitive words (blocked sensitive words) defined by you, preventing the message from being delivered to the recipient.
- The message triggers the moderation rules set by the IM Moderation service or the Message Callback service, preventing the message from being delivered to the recipient.
Enabling the Service
You can enable the Blocked Message Status Callback to Sender feature in the RC Console under Configuration > Chat settings > Basic features > Security.
Message Block Delegate
When a sent message is blocked, the SDK triggers the following method of the RCMessageBlockDelegate
:
@protocol RCMessageBlockDelegate <NSObject>
/*!
Callback method when a sent message is blocked
@param blockedMessageInfo Information about the blocked message
*/
- (void)messageDidBlock:(RCBlockedMessageInfo *)blockedMessageInfo;
@end
RCBlockedMessageInfo
contains information about the blocked message:
Parameter | Type | Description |
---|---|---|
type | RCConversationType | The conversation type of the conversation where the blocked message is located |
targetId | NSString | The conversation ID of the conversation where the blocked message is located |
channelId | NSString | The ultra group channel ID of the conversation where the blocked message is located (supported in iOS SDK starting from version 5.2.4) |
blockedMsgUId | NSString | The unique ID of the blocked message |
blockType | RCMessageBlockType | The reason the message was blocked. See the RCMessageBlockType Description below |
extra | NSString | Additional information about the blocked message |
sentTime | long long | The send time of the blocked message (Unix timestamp, in milliseconds). Supported in iOS SDK version 5.2.4 and later. |
sourceType | NSInteger | The source type of the blocked ultra group message. 0 : The original message triggered the block (default). 1 : The message extension triggered the block. 2 : The modified message content triggered the block. Supported in iOS SDK version 5.2.5 and later (only for ultra groups). |
sourceContent | NSString | The content JSON string of the blocked ultra group message or extension. When the sourceType field is 1 , it represents the extension content. When sourceType is 2 , it represents the modified message content. See the sourceContent Description below. Supported in iOS SDK version 5.2.5 and later (only for ultra groups). |
-
RCMessageBlockType
Descriptiontypedef NS_ENUM(NSUInteger, RCMessageBlockType) {
/*!
Global sensitive words: Triggered RC's built-in global sensitive words
*/
RCMessageBlockTypeGlobal = 1,
/*!
Custom sensitive words: Triggered custom sensitive words defined by the client in RC
*/
RCMessageBlockTypeCustom = 2,
/*!
Third-party moderation: Triggered by a third-party (e.g., Shumei) or the message callback service (original template routing service) deciding not to deliver the message
*/
RCMessageBlockTypeThirdParty= 3,
}; -
sourceContent
Description- When
sourceType
is0
,sourceContent
is nil. - When
sourceType
is1
,sourceContent
is the message extension content, example:{"mid":"xxx-xxx-xxx-xxx","put":{"key":"sensitive word"}}
.mid
is the ID of the notification message. - When
sourceType
is2
,sourceContent
is the modified message content, example:{"content":"text containing sensitive information"}
. The message content format for built-in message types is described in Message Type Overview.
- When
Setting the Message Block Delegate
Note
This interface is available in
RCCoreClient
.
[RCCoreClient sharedCoreClient].messageBlockDelegate = self;