please select
  • UIKit
  • SDK
  • Server APIs
Chat/
SDK/
Web/
Message/
SDK
  • Install Chat SDK
  • Initialize Chat SDK
  • Login and Logout
  • Client APIs
  • Changelog
  • Message
    • Overview
    • Send a Message
    • Receive a Message
    • Historical Message
    • Forward Messages
    • Modify a Message
    • Delete Messages
    • Clear History Message
    • Recall a Message
    • Send an Online Message
    • Message Read Receipt
    • Query Messages
    • Targeted Group Message
    • Do not Notify
    • Key-Value Extensions
    • Translation
  • Conversation
    • Overview
    • Conversation List
    • Get Conversations
    • Unread Count
    • Pin Conversations
    • Delete Conversations
    • Mark
    • Conversation Group
  • Group
    • Overview
    • Group Management
    • Group Profile
    • Group Member Management
    • Group Member Profile
    • Custom Group Attribute
    • Group Counter
  • Community Topic
    • Community Management
  • User Profile and Relationship Chain
    • User Profile
    • User Status
    • Friend Management
    • Friend Group
    • Block List
  • Guideline for Beginners
  • Console Guide
    • Creating and Upgrading an Application
    • Basic Configuration
    • Feature Configuration
    • Account Management
    • Group Management
    • Webhook Configuration
  • Product Introduction
    • Message Management
      • One-to-One Message
      • Message Storage
      • Offline Push
      • Group Message
      • Message Formats
    • Account System
      • Login Authentication
      • Online Status Management
    • Group Related
      • Group System
      • Group Management
    • User Profile and Relationship Chain
      • Profile Management
      • Relationship Chain Management
  • Purchase Guide
    • Billing Overview
    • Pricing
  • Error Codes

Targeted Group Message

Feature Description

A targeted group message is a message sent to specified members in a group, which cannot be received by other group members.
Note
1. To use this feature, you need to purchase the Premium edition as instructed in Pricing.
2. When creating a group @ message, you cannot specify the list of group members to receive the message (receiverList).
3. The targeted group message feature is not available for community and audio-video (AVChatRoom) groups.
4. By default, targeted group messages are excluded from the unread count of the group conversation.

Display Effect

By using the targeted group message feature, you can achieve the effect shown in the figure below:


Sending a Targeted Group Message

To send a targeted group message to specified members in a group, follow the instructions below:
Call the createXxxMessage API (here, Xxx indicates the message type) to create a message (specify the message recipients via receiverList).
Call the sendMessage API to send the message.
Sample
// Create a targeted group message
let message = chat.createTextMessage({
to: 'test',
conversationType: TencentCloudChat.TYPES.CONV_GROUP,
payload: {
text: 'Hello world!'
},
receiverList: ['user0', 'user1']
});

// Send the message
let promise = chat.sendMessage(message);
promise.then(function(imResponse) {
// Message sent successfully
console.log(imResponse);
}).catch(function(imError){
// The message failed to be sent
console.warn('sendMessage error:', imError);
});

Receiving a Targeted Group Message

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.