超过10亿
月活跃用户数
超过5,500亿
每日消息上限
100,000 +
全球用户
99.99%+
消息成功率
Use In-app Chat Features to Drive Higher Engagement
几行代码,无需繁琐开发
JavaScript
Android
iOS/Mac
Flutter
RN
Unity
Electron
C
// create an instance of the chat SDK
let chat = TencentCloudChat.create({
SDKAppID: 0
});
// login
chat.login({userID: 'your userID', userSig: 'your userSig'});
// This event is triggered when the SDK receives a newly pushed one-to-one message, group message, group notification, or group system message
let onMessageReceived = function(event) {
// event.data - An array that stores the Message objects - [Message]
};
chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
// create a text message
let message = chat.createTextMessage({
to: 'user1',
conversationType: TencentCloudChat.TYPES.CONV_C2C,
payload: {
text: 'Hello world!'
}
});
// send message
let promise = chat.sendMessage(message);
promise.then(function(imResponse) {
console.log(imResponse);
}).catch(function(imError) {
console.warn('sendMessage error:', imError);
});
// logout
chat.logout();