please select
  • UIKit
  • SDK
  • Server APIs
Chat/
SDK/
Web/
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

Install Chat SDK

This document describes how to quickly integrate the Tencent Cloud Chat SDK into your web, mini program, and uni-app projects.

File Structure of the Chat SDK



Integrating the SDK

You can integrate the Chat SDK into your web, mini program, and uni-app projects by using npm.
You can integrate the upload plugin tim-upload-plugin for faster and safer upload of rich text resources.

Integration via npm (Recommended)

Use npm to install the corresponding Chat SDK dependencies in your project.
npm install @tencentcloud/chat --save
// The Tencent Cloud Chat upload plugin is required to send messages such as images and files.
npm install tim-upload-plugin --save
import TencentCloudChat from '@tencentcloud/chat';
import TIMUploadPlugin from 'tim-upload-plugin';

let options = {
SDKAppID: 0 // Replace 0 with the SDKAppID of your Chat application when connecting.
};
// Create an SDK instance.
// The `TencentCloudChat.create()` method returns the same instance for the same `SDKAppID`.
// The SDK instance is usually represented by chat.
let chat = TencentCloudChat.create(options);

// Set the SDK log level.
// 0: Common level. You are advised to use this level during access as it covers more logs.
// 1: Release level. You are advised to use this level for key information in a production environment.
chat.setLogLevel(0);
// chat.setLogLevel(1);

// Register the Tencent Cloud Chat upload plugin.
chat.registerPlugin({'tim-upload-plugin': TIMUploadPlugin});

Relevant Resources

FAQs

Are there any open-source UI components that can be reused or redeveloped? Tencent Cloud Chat provides open-source UIKits for all platforms that can be reused or redeveloped by developers. Find the reference documentation below: