Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

Integrating Core Code

Updated on 2024-03-05 GMT+08:00
  1. Introduce the required JavaScript framework. In the following example, the jQuery component needs to be introduced. The reference version is jQuery 3.4.1. If the co-browsing function is required, introduce the cobrowse.js and cobrowseCommon.js components or release the cobrowse plugin for use. (For details about the development of the plugin, see section 3.1 "Guide to the Development and Usage of the cobrowse Plugin.") Introduce the cobrowse.js and cobrowseCommon.js components in CDN mode. Replace ip:port with the IP address and port number of the CEC, or directly with the domain name of theCEC, for example, https://www.test.com/service-cloud/resource.root/cobrowse/sdk/cobrowse.js. Figure 1 shows an example of the code.

    Figure 1 JavaScript framework reference example
    NOTE:

    1. Co-browsing operations cannot be performed on a new tab page.

    2. When the cobrowse.js and cobrowseCommon.js components for co-browsing are introduced and the third-party page contains nested iFrames, co-browsing operations can be performed only in the iFrame where the JavaScript components are introduced. If an iFrame has a parent iFrame, co-browsing operations cannot be performed in the parent iFrame.

  2. Generate the authorization signature on the server by following the instructions provided in Developing an Authorization Signature Generation Mechanism.
  3. On the frontend of the enterprise system, send an Ajax request to obtain the authorization signature generated on the server.

    function testAjax() {
         let timestamp = new Date().getTime();
         let serviceUrl = "authorizationService";
         let thirdUserData = {};
         thirdUserData['thirdUserName'] = userName;
         thirdUserData['thirdUserId'] = userId;
         thirdUserData['tenantSpaceId'] = tenantSpaceId; 
         thirdUserData['channelConfigId'] = configId;
         thirdUserData['locale'] = locale;
         thirdUserData['mapService'] = tencent; 
         thirdUserData['timestamp'] = timestamp;
         var request = $.ajax({
             url: serviceUrl,
             method: "POST",
             contentType: "application/json",
             data: JSON.stringify(thirdUserData),
         });
         request.done(function(message){
             if(message){
                 thirdUserData['thirdPartAuthorization'] = message;
                 thirdValidate(thirdUserData);
             }
             return  message;
         });

  4. After obtaining the signature, use the Ajax to request the JavaScript script to be integrated.

    const $ContextPath = "https://ip:port/service-cloud"; 
    function thirdValidate(thirdUserData) {
      let timestamp = new Date().getTime();
      let serviceUrl = $ContextPath + "/webclient/chat_client/js/newThirdPartyClient.js?"+"&t=" + timestamp;
          var request = $.ajax({ 
             url: serviceUrl,
             method: "POST",
             data: JSON.stringify( ),
             crossDomain: true,
             dataType:"text",
             xhrFields: {withCredentials: true},
             error: function (XMLHttpRequest, textStatus, errorThrown)
                  { console.log(XMLHttpRequest.status); console.log(XMLHttpRequest.readyState); console.log(textStatus); },
             success: function (data) {
                 importScript(data)
             }    
    });
    Table 1 Parameters for developing an integration page

    Parameter

    Mandatory or Not

    Description

    $ContextPath

    Yes

    Actual domain name. Replace https://ip:port/ with the public network domain name of the CEC.

    thirdPartAuthorization

    Yes

    Authorization signature generated by the enterprise, which must be the same as the signature in 7.

    tenantSpaceId

    Yes

    Tenant space ID. Choose Configuration Center > System Management > Tenant Information to view the value.

    thirdUserId

    Yes

    Enterprise user ID. The value must be the same as that of thirdUserId in 5.

    thirdUserName

    Yes

    Enterprise username. The value must be the same as that of thirdUserName in 5.

    channelConfigId

    Yes

    Channel ID. After the operations in 6 are complete, choose Configuration Center > Access Configuration > Channel Configuration to view the value.

    locale

    Yes

    Language information of third-party tenant space.

    • zh: Chinese
    • en: English

    timestamp

    Yes

    Timestamp. The time string is formatted to the yyyy-MM-dd'T'HH:mm:ss.SSS'Z format.

    mapService

    No

    User map service.

    • tencent
    • google

    The default value is tencent.

    NOTE:

    Tencent Maps does not support locations outside China.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback