Skip to main content

Sensitive Information Block Notification Callback

Note

The Web SDK supports the Sensitive Information Block Notification Callback starting from version 5.0.2.

If you are using RC's content moderation services (including message sensitive words, IM moderation services, and message callback services), you may want to notify the sender when a message is blocked due to triggering moderation rules. Starting from SDK version 5.0.2, the client SDK can trigger a callback to notify the sender when a message is blocked.

Messages may be blocked for containing sensitive information under the following circumstances:

  • The content of a text message hits RC's built-in sensitive words, causing the message not to be delivered to the recipient.
  • The content of a text message hits your custom sensitive words, causing the message not to be delivered to the recipient.
  • The message hits the moderation rules set by the IM Moderation service or the Message Callback service, causing the message not to be delivered to the recipient.

Enabling the Service

You can enable the Blocked Message Status Callback to Sender feature by navigating to Configuration > Chat settings > Basic features > Security in the RC Console.

Setting Up the Sensitive Information Block Listener

You can set up a sensitive word block listener using the following method to monitor blocked messages and the reasons for blocking.

const listener = (blockedMessageInfo) => {
console.log('Message blocked due to sensitive information:', blockedMessageInfo)
}

RongIMLib.addEventListener(RongIMLib.Events.MESSAGE_BLOCKED, listener)

For details on removing the listener and the full list of events, refer to the IMLib documentation Event Listener.

Return Value Description

ParameterTypeDescription
blockedMessageInfoIBlockedMessageInfoCallback parameters for messages blocked due to sensitive information
  • IBlockedMessageInfo Description

    Attribute NameDescription
    blockTypeThe reason the message was blocked. See MessageBlockType Description below.
    blockedMessageUIdThe unique ID of the blocked message.
    channelIdThe channel ID of the conversation where the message was blocked (only applicable to messages in ultra groups).
    conversationTypeThe conversation type of the conversation where the message was blocked.
    extraAdditional information about the blocked message. Supported starting from Web SDK version 5.3.3.
    targetIdThe conversation ID of the conversation where the message was blocked.
    sourceTypeThe source trigger type of the blocked message. See MessageBlockSourceType Description below. (Only for ultra groups)
    sourceContentThe source content object of the blocked message. When sourceType is 1, it represents extended content; when sourceType is 2, it represents message content. (Only for ultra groups)
  • MessageBlockType Description

    Enum ValueValueDescription
    GLOBAL1Global sensitive words: The message hit RC's built-in global sensitive words.
    CUSTOM2Custom sensitive words: The message hit custom sensitive words set by the client in RC.
    THIRD_PARTY3Third-party moderation: The message hit moderation rules set by a third party (e.g., Shumei) or the message callback service (original template routing service) and was not delivered.
  • MessageBlockSourceType Description

    Enum ValueValueDescription
    MSG_ORIGINAL0Original message
    MSG_EXPANSION1Message expansion
    MSG_MODIFY2Message modification