tencent cloud

Feedback

Last updated: 2024-06-13 12:08:11
    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:
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support