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

React

PDF
Focus Mode
Font Size
Last updated: 2025-07-22 14:51:32
TUIKit provides default implementation for sending and displaying basic message types such as text, image, voice, video, and file. If these message types do not meet your needs, you can add custom message types.

Basic Message Type

Message Type
Display Effect
Text messages


Image messages


Video messages


File messages



Custom Notification

If the basic message type cannot meet your needs, you can use custom messages based on actual business needs.
Custom Message Preset Style
Display Effect
Hypertext messages


Rating messages


Order messages


The following context uses sending a hypertext that can navigate to the browser as a custom message to help you quickly understand the implementation process.

Thinking Requires Customized Data

For a message that can go to another website, a description text and a url link are required.
import { TUIChatService } from "@tencentcloud/chat-uikit-engine";

const sendCustomMessageParams = {
payload: {
data: JSON.stringify({
Welcome to the Tencent Cloud family
url: 'https://www.tencentcloud.com/document/product/269?from_cn_redirect=1'
}),
description: "text_with_link",
extension: "text_with_link"
},
};

// simulation send a custom message
TUIChatService.sendCustomMessage(sendCustomMessageParams)
.catch(err => { /** */ });
Send custom messages. Reference ChatEngine API Documentation.

2. Creating Components That Parse Custom Data

Here create a CustomMessage component. When the type of message is custom message and the extended fields of the message equal the text_with_link defined above, we can custom render the content; if it is other types of messages, use default Message component to render.
import { TUIChatEngine } from '@tencentcloud/chat-uikit-engine';
import { UIKitProvider, Message } from '@tencentcloud/chat-uikit-react';

function CustomMessage(props: React.ComponentProps<typeof Message>) {
if (props.message.type === TUIChatEngine.TYPES.MSG_CUSTOM) {
const { data, extension } = props.message.payload;
if (data && extension === 'text_with_link') {
const { text, url } = JSON.parse(data);
return (
<div style={{
backgroundColor: 'lightblue',
padding: '10px',
borderRadius: '10px',
}}
>
<div>{text}</div>
<a href={url} target="_blank" rel="noopener noreferrer">
Jump to
</a>
</div>
);
}
}
return <Message {...props} />;
}

function ChatApp() {
return (
<UIKitProvider language="auto" theme="light">
<div style={{ display: 'flex', height: '100vh' }}>
<ConversationList />
<MessageList Message={CustomMessage} />
</div>
</UIKitProvider>
);
}

export default ChatApp;



Help and Support

Was this page helpful?

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

Feedback