tencent cloud

Chat

News and Announcements
Release Notes
Announcements
Product Introduction
Overview
Basic Concepts
Scenarios
Features
Account System
User Profile and Relationship Chain
Message Management
Group Related
Official Account
Audio/Video Call
Use Limits
Purchase Guide
Billing Overview
Pricing
Purchase Instructions
Renewal Guide
Service Suspension Explanation
Refund Policy
Development Guidelines
Demo Zone
Activate Service
Free Demos
Quick Run
Download
SDK and Demo Source Code
Update Log
Chat Interaction (UI Included)
TUIKit Introduction
Getting Started
Full-feature Integration
Single-function Integration
Build with AI
Build Basic Interfaces
More Features
Customizing Appearance
Internationalization
Push Service
Overview
Noun explanation
Activate the Service
Quick Start
Manufacturer Channel
Statistics
Troubleshooting Tool
Client APIs
REST API
Push Callback
Advanced Features
Release Notes
Error Codes
FAQS
Desk
Overview
Quick Start
Integration Guide
Admin Operation Manual
Agent Manual
More Practices
Live Streaming Setup Guide
AI Chatbot
Super Large Entertainment and Collaboration Community
Discord Implementation Guide
How to Integrate Chat into Games
WhatsApp Channel-style Official Account Integration Solution
Send Red Packet
Firewall Restrictions
No UI Integration
Quick Start
SDK Integration
Initialization
Login and Logout
Message
Conversation
Group
Community Topic
User Profile and Relationship Chain
Offline Push
Cloud Search
Local Search
Official Channel Management
Client APIs
JavaScript
Android
iOS & macOS
Swift
Flutter
Electron
Unity
React Native
C APIs
C++
Server APIs
Secure authentication with UserSig
RESTful APIs
Webhooks
Console Guide
New Console Introduction
Creating and Upgrading an Application
Basic Configuration
Feature Configuration
Account Management
Group Management
Official Channel Management
Webhook Configuration
Usage
Viewing Guide for Resource Packages
Real-Time Monitor
Auxiliary Development Tools
Access Management
Advanced Features
FAQs
uni-app FAQs
Purchase
SDK
Account Authentication
User Profile and Relationship Chain
Message
Group
Audio-Video Group
Nickname and Profile Photo
Security Compliance Certification
Service Level Agreement
Security Compliance Certification
Chat Policies
Privacy Policy
Data Privacy and Security Agreement
Migration
Migration Solutions
Migration Solutions Lite
Error Codes
Contact Us

Unity

PDF
Focus Mode
Font Size
Last updated: 2024-01-31 16:28:40

Overview

The sender listens for the characters in the input box. When the sender enters @, the group member selection UI will pop up. After the target group members are selected, the message will be displayed in the input box in the format of "@A @B @C......", which can be further edited before sent. In the group chat list of the receiver's conversation UI, the identifier "someone@me" or "@ all" will be displayed to remind the user that the user was mentioned by someone in the group chat.
Note:
Currently, only text @ messages are supported.

Sending a Group @ Message

1. The sender listens for the text input box on the chat UI and launches the group member selection UI. After group members are selected, the ID and nickname information of the members is called back. The ID is used to create the Message object, while the nickname is to be displayed in the text box.
2. The sender calls the MsgSendMessage API (details) to create a text @ message, create the Message message object, specify the target group members, and send the message object.
Sample code:
// Create a group @ message
var message = new Message
{
message_conv_id = conv_id,
message_conv_type = TIMConvType.kTIMConv_Group,
message_elem_array = new List<Elem>{new Elem
{
elem_type = TIMElemType.kTIMElem_Text,
text_elem_content = Input.text
}},
| message_group_at_user_array | UserID list of users that need to be mentioned (@) in the group message. To @all, pass in the `kImSDK_MesssageAtALL` field. |
};
StringBuilder messageId = new StringBuilder(128);
TIMResult res = TencentIMSDK.MsgSendMessage(conv_id, TIMConvType.kTIMConv_Group, message, messageId, (int code, string desc, string json_param, string user_data)=>{
// Async message sending result
});

Receiving a Group @ Message

1. When the conversation is loaded and updated, call the conv_group_at_info_array API (details) of ConvInfo to get the @ data list of the conversation.
2. Call the conv_group_at_info_at_type API (details) of the GroupAtInfo object in the list to get the @ data type and update it to the @ information of the current conversation.
Sample code:
TIMResult res = TencentIMSDK.ConvGetConvList((int code, string desc, List<ConvInfo> info_list, string user_data)=>{
foreach (ConvInfo info in info_list)
{
foreach (GroupAtInfo at_info in info.conv_group_at_info_array)
{
if (at_info.conv_group_at_info_at_type == TIMGroupAtType.kTIMGroup_At_Me) {
// @me
}
if (at_info.conv_group_at_info_at_type == TIMGroupAtType.kTIMGroup_At_All) {
// @all in the group
}
if (at_info.conv_group_at_info_at_type == TIMGroupAtType.kTIMGroup_At_All_At_ME) {
// @all in the group and @me alone
}
}
}
});

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback