Customer Support Assistant

The customer support assistant involves providing chat assistance specifically to identified customers, focusing on addressing both general and crucially personalized inquiries related to transactions

Integration procedure for Customer Support (After Authentication)

To provide conversational, chat-based customer support on your website, integration is necessary within a page accessible after your customers complete the login process. This allows identification of the customer ID, ensuring personalised services linked to the user ID and facilitating the provision of specific details tailored to each customer.

Place the JavaScript code in the <head> HTML

Add the script to the <head> section

Copy the following JavaScript code and paste it before the closing `</head>` tag of your website's HTML file:

<script defer
 src="https://cdn.cleandesk.co.in/public/build/clean_ai_bot.js"></sc
ript>

This script loads the necessary CleanDesk Ai Bot library.

Add the chat widget code

Copy the following code and paste it before the closing `</body>` tag of your website's HTML file or paste it where you would like to use the widget:

<cleandesk-chat-widget app_id="YOUR_APP_ID" app_secret="YOUR_APP_SECRET" access_by_id="{USER_ID_VARIABLE]"></cleandesk-chat-widget>    

Replace `YOUR_APP_ID`, `YOUR_APP_SECRET with the appropriate values that you have generated in the admin section of CleanDesk Ai.

Replace "USER_ID_VARIABLE" with the actual Customer ID variable once the customer has logged in. This identification is crucial for enabling personalized customer support services; without providing the access_by_id parameter, personalized assistance cannot be initiated.

How to pass the user ID

Passing the user ID typically involves retrieving the user ID after the user has logged in and using that information in your system. In a typical web environment like WordPress or other frameworks, once a user logs in, their ID or relevant information can be retrieved from the session, or the database.

Here's a general concept of how you might handle it in case the variable name of your user ID could carry a variable name CUSTOMER_ID, USER_ID, CUST_ID etc., Assuming that your variable is CUSTOMER_ID, then the code will look like below in your environment.

<cleandesk-chat-widget app_id="YOUR_APP_ID" app_secret="YOUR_APP_SECRET" access_by_id="CUSTOMER_ID"></cleandesk-chat-widget>    

The above code is only a sample. However, the exact method to pass the user ID can vary significantly depending on the platform, the way your website is built, and the specific functionalities or APIs you're working with.

It's important to consult the documentation or resources related to the specific system or platform you're using for more precise guidance.

Handle Logout

As the widget operates independently from your platform, it's essential to manage the logout process. This ensures that the customer's authorisation token is cleared, allowing them to obtain a new token upon their subsequent login.

Place the JavaScript code in the <body> HTML

Place the provided script just before the closing tag in your website's HTML file. This ensures that the script is loaded after the rest of the page has loaded

<script defer src="https://cdn.cleandesk.co.in/js/widget_logout.js"></script>

When you want to initiate the logout process, call the CleandeskWidgetLogout() function from the widget_logout.js script. This function clears all relevant cookies and handles the logout process.

Last updated