User identity verification
Follow this guide to implement a robust authentication system within your chatbot projects.
Step 1: Enable User Identity
In the chatbot settings, enable “User Identity Verification” to allow automatic user token checks during interactions.

Step 2: Setting up the API endpoint
To verify user tokens, set up an API endpoint that accepts POST requests.
Specify the Endpoint: Add the endpoint’s URL in your chatbot settings. This is where verification requests will be directed.
Configure for POST Requests: Ensure the endpoint is prepared to handle POST requests, as AI Chatbot Hub will send token data through these requests for secure verification.

Verification Flow
Token submission: AI Chatbot Hub sends a verification request with the user’s token to your endpoint.
Processing: Validate the token to allow or deny user access.
Outcome Handling:
Successful Verification: When the token is verified, the chatbot grants access, allowing the authenticated user to continue the chat.
Failed Verification: If the API returns an error, the verification is unsuccessful, and the user is directed to an error screen.
Step 3: Store user data
To improve the User Identity Verification process and keep records of user interactions, you can store the data from each successful verification by enabling "Save data on success".
Each time a user is authenticated, the response details (usually user identification info) are saved and linked to their specific chat sessions.
Valid JSON Only: Ensure all data for storage is in valid JSON format. Any non-JSON or improperly formatted data will be disregarded and won’t be saved in the chat history.
Example JSON:
{
"userId": "12345",
"userName": "JohnDoe",
"email": "[email protected]",
"verified": true,
"roles": ["user", "admin"],
"profile": {
"firstName": "John",
"lastName": "Doe",
"age": 30
}
}
Step 4: Integrate token in AI Chatbot Hub
Chat Widget
Add the token to GPTTConfig
in your site’s chatbot script:
<script>
window.GPTTConfig = {
uuid: "15b1f07cd512346c94c210779a6c3c19",
token: <"Custom token">
}
</script>
<script src="https://app.aichatbothub.com/widget-asset.min.js" defer></script>
You can also directly set the GPTTConfig
object with your token using a JavaScript call, which is ideal if you need to update the token dynamically based on user interactions or other triggers within your application. Here's how:
window.GPTTConfig.token = "Custom token";
Once the token property is updated, the system will initiate authentication with the new token to verify the user’s identity every time they interact with the chatbot.
Iframe
Include the token directly in the iframe src
URL:
<iframe
src="https://app.aichatbothub.com/widget/162223v?token=<custom_token>"
width="100%"
height="500px"
frameborder="0"
></iframe>
By following these steps, you can set up secure user identity verification with AI Chatbot Hub for a reliable user experience.
Last updated