Instant Messaging
iOS
Getting Started
Product Introduction
Overview
Features
Feature overview
Account Integration and Login
Basic Message Features
Group Chat
Chat Room
Chat Room Tags
Multi-device Login
Statistics Monitoring
Limits
Development Integration
Message Sending
Message Receiving
Recent Chats
Server Sessions
User Profile
User Relationship
Online Status Subscription
System Notification
APNs
Superteam
Chat Room
Anti-spam
Chat Extension
Miscellaneous Features
Reference Documents
Configuration Instruction for PushKit
Push Configuration for Apple iOS
API References
iOS API Reference
Status Codes

Anti-spam

Update time: 2021/12/06 15:32:35

Overview

CommsEase supports four anti-spam features, including general anti-spam, client-side anti-spam, GuideEase anti-spam,and user-defined anti-spam.

By default, IM service provides the general anti-spam. This type of anti-spam requires no configuration. For more information, see Product Introduction.

Client-side anti-spam

To enable the anti-spam feature, contact our business manager. The feature applies to scenarios where text messages are required such as one-to-one chat, team chat, and chat room. Anti-spam rules support two matching methods, including keywords and regular expression.

The anti-spam trigger words is managed and configured by the developer in the background of CommsEase. The SDK downloads and manages the trigger words. Three replacement rules are available for anti-spam words:

  • Client-side replacement Replace the words which are in accord with anti-spam rules with specified texts, and send the replaced text to the server.
  • Client-side interception Once a message that is in accord with anti-spam rules is detected, developers should not send the message.
  • Server processing The developer configures attributes of a message as the specific server interception library, then, sends the message to the server. Although the message is sent, the CommsEase server will not deliver the message. Therefore, the receiver can not receive the message. For more information on configuration methods, see as follows:

Get trigger words

The SDK will obtain the trigger words from the server automatically at login.

Sensitive words detection

Input the texts to be checked and the character strings for local replacement. For example, to replace the original text as **, just input ** . The SDK will check whether the message is in the anti-spam trigger words, and return the result.

@protocol NIMAntispamManager <NSObject>

/**
 * Local client anti-spam checker
 *
 * @param option - Local anti-spam check options. Option.content is a text message to be checked. Option.replacement is the character string for local replacement.
 * @param error - Error prompt
 * @discussion - This extension will not be roamed to other clients. The upper-level developers need to ensure that NSDictionary can be transformed into JSON.
 * @return - Local-client anti-spam check results. The local anti-spam list will be updated synchronously each time after the login.
 * Poor network conditions or non-login status will result in errors in a local anti-spam list. For details, see the error.
 */
- (NIMLocalAntiSpamCheckResult *)checkLocalAntispam:(NIMLocalAntiSpamCheckOption *)option
                                              error:(NSError **)error;

@end

Parameter List

Parameter Type Description
option NIMLocalAntiSpamCheckOption Local anti-spam options, which are used for the local anti-spam check. You can replace some character strings locally.

If NIMLocalAntiSpamCheckResult type is returned. Specific types are detailed as follows:

/**
 * Types of local anti-spam check
 */
typedef NS_ENUM (NSInteger, NIMLocalAntiSpamOperate){
    /* No local anti-spam list. */
    NIMAntiSpamOperateFileNotExists,
    /* Local replacement. */
    NIMAntiSpamResultLocalReplace,
    /* Local block. */
    NIMAntiSpamResultLocalForbidden,
    /* Server block. */
    NIMAntiSpamResultServerForbidden,
    /* Pass the anti-spam check. */
    NIMAntiSpamResultNotHit,
    /* Resolution failure */
    NIMAntiSpamResultError
};
/**
 * Local anti-spam check option
 * @discussion - This option is used for the local anti-spam check. You can replace some character strings locally.
 */
@interface NIMLocalAntiSpamCheckResult : NSObject

/**
 * Result types
 */
@property (nonatomic, assign, readonly)     NIMLocalAntiSpamOperate type;

@end

To match with the server-side interception library, configure the specific attributes. If not, the server will not conduct the interception. Method: NIMMessage - antiSpamOption - hitClientAntispam. Click YES.

GuideEase anti-spam

GuideEase refers to enabling and implementing anti-spam feature. It supports anti-spam for messages in the one-to-one chat, team chat, and chat room, photo profiles, and user profile.

If you need to use GuideEase anti-spam, you shall apply for the function firstly. After enabling, the types which enable GuideEase anti-spam may be set on the console, such as IM one-to-one chat, team chat, chat room text, and image messages.

To handle custom messages with GuideEase anti-spam, the developer can indicate the text type (image or video, etc.) by configuring the NIMMessage's antiSpamOption at the time of sending a message due to the particularity, so that GuideEase performs the anti-spam feature based on the specific type.

Custom anti-spam

CommsEase also supports developers to implement user-defined anti-spam with the third-party callback.

Was this topic helpful?
Yes
No
  • Overview
  • Client-side anti-spam
  • Get trigger words
  • Sensitive words detection
  • GuideEase anti-spam
  • Custom anti-spam