Web app installation using Custom User ID method
Last updated
Last updated
@ 2024 Mampu AI
ChatkuAI now allows its users to pass bot user information from their website directly into the omnichannel bot via setting a custom user ID. This feature will enable users to send specific flows to guest users vs users who have given their information as well as be able to fetch chat history and other user specific flows which was not possible before.
Inside the omni bot, click on “Webchat Widget Settings” then click on “Display Style” tabs and then “Set Custom User ID”
The setup will look like the following:
The special key is a set of strings that ChatkuAI uses to decrypt the hash you send to it from your website. This is important as it allows ChatkuAI to verify that the user is indeed created from your website and is authorized and authentic.
Identifier hash is a set of string composed of the user ID you want to set which is then encrypted to string using SHA256 algorithm with HMAC enabled. This hash is the unique signature that ChatkuAI then verifies to confirm and authorize that the request is being made from your website.
This hash needs to be created from the backend of your website. You will have to send this value in its encrypted form to ChatkuAI otherwise the request will be denied. A sample code written in PHP for such an encryption can be found below:
The code snippet for this will have to be pasted in the same area where you put the code snippet for the bot itself i.e in the header section of your website.
The snippet code contains the payload for the user details, along with mandatory fields of user_id and identifier hash.
Here, you can enter custom details for users such as name and email, as well as you can set the user_id.
Note: The {user_id} and {indentifier_hash} variables need to be replaced with the variables where the values you want to set can be mapped.
Instructions
Copy the snippet code into the header of your website, the same place where you place the snippet code for the bot itself.
Replace the {user_id} variable with the custom user_id you want to set for the user. The value for this will most likely have to be fetched from your server or website’s backend.
Using the same user_id, create the identifier hash from your server or website’s backend using SHA256 algorithm with HMAC enabled.
Copy both to the snippet code, then publish it live to your website. You will then be able to create users with custom user IDs.