3. The original message object for creating a targeted group message cannot be a group @ message.
4. The targeted group message feature is not available for community and audio-video (AVChatRoom) groups.
5. By default, targeted group messages are excluded from the unread count of the group conversation.
Effect
By using the targeted group message feature, you can achieve the effect shown in the figure below:
Sending a Targeted Group Message
A targeted group message is a message sent to specified members in a group, which cannot be received by other group members.
To send a targeted group message to a single member in a group, pass in both groupID and receiver.
To send a targeted group message to multiple members in a group, follow the instructions below:
1.1 Call the createXxxMessage API (here, Xxx indicates the message type) to create an original message object V2TIMMessage.
1.2 Call the createTargetedGroupMessage API (Android / iOS and macOS / Windows) to create a targeted message object V2TIMMessage based on the original message object and specify the list of group members to receive the message.
1.3 Call the sendMessage API to send the targeted message.
Sample code:
Android
iOS and macOS
Windows
// Create an original message object
V2TIMMessage v2TIMMessage =V2TIMManager.getMessageManager().createTextMessage(“This is a targeted group message”);
// Create a targeted group message object, and specify the recipients "Vinson" and "Denny"
By default, targeted group messages are excluded from the unread count of a group conversation.
A targeted group message can be received in the same way as an ordinary message. For detailed directions, see Receiving Message.