跳到主要内容

Word Filter

To maintain a safe and respectful environment in the chatroom, BlendVision provides a word filter feature. This feature automatically hides messages containing inappropriate words or phrases. As a live event host, you can customize the word filter to suit specific events and audiences.

The word filter is achieved through the use of dictionaries and patterns. A chatroom can define and enable multiple dictionaries, each containing multiple patterns. A pattern represents a rule for filtering text. Currently, we only support case-insensitive exact matches. If a sent message exactly matches the defined patterns, it will be filtered.

Acquire an Access Token

You need to acquire an access token before using the APIs to manage dictionaries and patterns:

POST /bv/chatroom/v1/dictionaries/tokens

The following example illustrates the server's response to a successful request:

{
"token": "eyJz93a...k4laUWw",
"expires_in": 604800
}

This response is a JSON object comprising two key components:

  • token: A unique identifier required for authentication in future API calls, particularly for dictionary and pattern management.
  • expires_in: Specifies the token's validity duration in seconds. It is important to generate a new one before expiration to maintain uninterrupted API access.

Create a Dictionary

To create a dictionary, send a POST request to the following API:

POST /bv/chatroom/v1/dictionaries

The request body should contain the following parameters:

  • name: The name of the dictionary to create.
  • description: (Optional) The description of the dictionary to create.

Manage Dictionaries

You can manage your dictionaries using the following APIs:

  • Get a dictionary: GET /bv/chatroom/v1/dictionaries/{id}
  • Delete a dictionary: DELETE /bv/chatroom/v1/dictionaries/{id}
  • Update a dictionary: PUT /bv/chatroom/v1/dictionaries/{id}
  • List dictionaries: GET /bv/chatroom/v1/dictionaries

Replace {id} with your dictionary ID.

Create a Pattern

Once you have a dictionary, you can create a pattern in it by using the following API:

POST /bv/chatroom/v1/dictionaries/{id}/patterns

The request body should contain the following parameter:

  • text: The text of the pattern to create.

Manage Patterns


You can manage your patterns using the following APIs:

  • Delete a pattern: DELETE /bv/chatroom/v1/patterns/{id}
  • Update a pattern: PUT /bv/chatroom/v1/patterns/{id}
  • List patterns: GET /bv/chatroom/v1/dictionaries/{id}/patterns

Replace {id} with your pattern ID.

Control the Dictionary

In addition to creating and managing dictionaries and patterns for the word filter in your chatroom, BlendVision also allows you to enable or disable specific dictionaries. This gives you greater control over the word filter according to the needs of specific events.

To enable/disable a specific dictionary in the chatroom, send a POST request to the following APIs:

  • POST /bv/chatroom/v1/chatrooms/dictionaries/{id}:enable
  • POST /bv/chatroom/v1/chatrooms/dictionaries/{id}:disable

Replace {id} with the dictionary ID that you want to enable/disable.