Add a profanity word
Add a profanity word to the filter list. Text messages containing the word are either blocked or have the word replaced, depending on configuration. Supports direct, group, open, and community channels.
- Default maximum: 50 profanity words (expandable via the console).
- Changes take effect after approximately 15 minutes.
- Supported languages: Chinese, English, Japanese, German, Russian, Korean, Arabic.
See Content moderation overview for profanity filter rules.
Prerequisites
The profanity filter is built in and requires no activation. By default, it applies only to messages sent from client SDKs. To apply it to server API messages, enable Moderate messages sent by server API in the console.
Request
POST: https://[Base URL](/platform-chat-api/base-url)/sensitiveword/add.json
Rate limit: 100 requests per second
Authentication: All server API requests require signature verification. See API request signing.
Request body
Content type: application/x-www-form-urlencoded
| Parameter | Type | Required | Description |
|---|---|---|---|
word | String | Yes | The profanity word to add. Max 32 characters (letters, digits, or Chinese characters). |
replaceWord | String | No | Replacement text (max 32 characters). If not set, messages containing the word are blocked entirely. If set, the word is replaced with this value before delivery. |
Request example
HTTP
POST /sensitiveword/add.json HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/x-www-form-urlencoded
word=money&replaceWord=****
Response
| Property | Type | Description |
|---|---|---|
code | Number | Status code. 200 indicates success. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{"code":200}