tencent cloud

Feedback

Last updated: 2024-02-07 11:38:59
    This document describes how to quickly integrate the Tencent Cloud Chat SDK into your web project.

    File Structure of the SDK

    
    
    

    Integrating the SDK

    You can integrate the Chat SDK into your web project by using npm (recommended).
    You can integrate the upload plugin for faster and safer upload of rich media resources. For more information, see tim-upload-plugin.
    You can integrate the local moderation plugin tim-profanity-filter-plugin to moderate the text content sent by the Chat SDK on the client locally. The plugin can intercept or replace configured sensitive words in the text content to ensure your product experience and business security.

    Integration via npm (recommended)

    Use npm to install appropriate 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
    // The local moderation plugin is needed to intercept or replace sensitive words.
    npm install tim-profanity-filter-plugin --save
    import TencentCloudChat from '@tencentcloud/chat';
    import TIMUploadPlugin from 'tim-upload-plugin';
    import TIMProfanityFilterPlugin from 'tim-profanity-filter-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 logging 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 log level in a production environment
    chat.setLogLevel(0);
    // chat.setLogLevel(1);
    
    // Register the Tencent Cloud Chat upload plugin.
    chat.registerPlugin({'tim-upload-plugin': TIMUploadPlugin});
    
    // Register the Tencent Cloud Chat local moderation plug-in.
    chat.registerPlugin({'tim-profanity-filter-plugin': TIMProfanityFilterPlugin});

    Relevant resources

    SDK APIs

    FAQs

    1. 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