We apologize for the inconvenience of this page no longer being maintained. For the latest product information, please visit our current product introduction page. >>

Chat Room Tags

Update time: 2024/08/20 15:45:46

Feature overview

The IM service help you build an in-app chat room that is widely used in social entertainment and education live streaming. By default, all online users in a chat room can receive messages. Starting from V8.4.0, we provide the chat room tag, meeting the needs of delivering messages to specific users. Also, specific messages may be received.

Scenarios

Breakout classes

When a teacher gives lectures online, students are organized in small sizes to involve in teachings. The model can lower the teaching cost and make students more involved.

The above shows the scenario of a breakout class:

  • All class members are in the same chat room.
  • Teachers can send online messages to all classes, and also can receive session messages from all classes.
  • Students can only receive session messages and send messages in their respective classes.
  • Users can set teaching assistants as required, who can manage one or more online classes.

Large live streaming chat room

In a large live streaming chat room, in consideration of barrage refreshing and debate, users may be grouped by tags to yield the following effect:

  • In the live streaming of multiple stars or entertainers, internal interaction is supported among the fans of any of the stars or entertainers, but there is no interaction among the fans of different stars.
  • In sports competitions, e-sports or other competitions, audiences may choose a preferred team, and interact with fans
  • Prepare an appropriate tag strategy based on users' characteristics. The users in the same chat room, having the same hobbies and at the same age may interact with each other.

Feature description

Chat room tags are used to set tag-related fields to send and receive messages in a personalized manner at login and when messages are sent. A specific process is detailed as follows:

Login

At login, two parameters are required:

  • The first parameter "tags" is used to identify which tags the long connection of the login belongs to. It is a json array, and at most 10 tags may be set for a long connection. Each tag consists of 32 characters at most, such as ["abc", "def"].
  • The second parameter notifyTargetTags is a tag expression that indicates the tag users to whom in and out notifications generated by the login and the subsequent logout operation should be broadcast. If missing, the server will automatically generate a tag expression based on tags based on the rule by which all tags are combined by the keyword "and", which means that the users in all tags may receive in and out notifications.

Send messages using the SDK

A parameter, known as notifyTargetTags, may be set. It is a tag expression, and means the targets to whom the message is sent. If missing, the parameter notifyTargetTags set at login will be used.

Send messages by calling APIs

A parameter, known as notifyTargetTags, may be set. It is a tag expression, which means the targets to whom the message is sent. If missing, the message will be sent to all.

Three APIs (including SDK API and server API) are added as follows:

  • Mute/unmute a tag user. Only the administrator or the chat room creator is allowed to call The API. After calling, users for which the tag has been set shall not send messages. For example, if tag A is muted, the customers for whom tags ["A","B"] have been set shall not send messages.
  • Query the number of online users under a tag. In the event of multi-device login for an account, only one online user is included.
  • Query the list of online members under a tag. It is an API for paging queries. If a user logs in at multiple devices, The API will return several records.

Tag expression

Tag expression is used to set the target to which chat room notifications/messages are delivered, and supports the setting of intersection and union, as well as regex match. Brackets may be used to set the priority in the expression (similar as the brackets in addition, subtraction, multiplication, and division). Each tag expression consists of up to 128 characters.

Examples of some tag expressions:

1) Match tag abc

{"tag": "abc"}

2) Match tag abc or def

{"tag": "abc"} or {"tag": "def"}

3) Match tag abc and def

{"tag": "abc"} and {"tag": "def"}

4) Use regex match tag abc

{"tag": "abc.*", "matchType": "regex"}

5) Match tag abc or def, and regex match tag 123 or 456

({"tag": "abc"} or {"tag": "def"}) and ({"tag": ".*123", "matchType": "regex"} or {"tag": "456.*", "matchType": "regex"})
Was this page helpful?
Yes
No
  • Feature overview
  • Scenarios
  • Breakout classes
  • Large live streaming chat room
  • Feature description
  • Login
  • Send messages using the SDK
  • Send messages by calling APIs
  • Add tag-related APIs
  • Tag expression