talkk.ai Chatbot Theming and Integration Guide

This guide provides developers with detailed instructions for integrating and customizing the Talkk.ai Web Chatbot. Learn how to apply advanced theming options for UI components like buttons, message bubbles, and headers using CSS variables and API configurations. step-by-step integration steps, this document ensures a seamless setup process.



Integration Details

right-arrow
Item Value
Encryption Algo CryptoJS.AES
IV Key xxxxxxxxxxxxxxxx
API URL https:/[api_domain]/
Socket Encrypted URL wss:/[api_domain]/talkk/?q=U2FsdGVkX182ujjp1ve%2BkJRrJ0FPBkzpCeRKvNEQu07GqR0sph9b4hmYReL4dhUznRgxt52z35f2hsJUs2ZkZpgLPH%2Bz38aYU8PVmyXavFec0ZY7VcvjHl%2FduT6dybG3O3mZXoRnKyMc%2B%2Bqw5j03bknPIZ8ihQ%2FTwzIkcdKqH2iDpOJ4WjUXzT9Wn9AvVEcfJP7h%2FywqMZF8Zi7%2FH9pV3A%3D%3D&EIO=3&transport=websocket
Sample Group ID *****************
ENCRYPTION_KEY xxxxxxxxxxxxxxxx
API_CHAT_BASE_URL https://[chat_domain]/
GROUPID *****************

Replace variables like {GROUPID}, {API_CHAT_BASE_URL}, {ENCRYPTION_KEY} accordingly in implementation and store them in a .env file for global access.

Get Bot Information

right-arrow

The API called to get bot information like themeing.

Base Configuration

Base URL: https://[chat_domain]/
Endpoint: /api/1.0.0/getBotInfoEnc
Method: POST
Retrieves configuration data for your chatbot, including theming, company info, bot details, and form specifications.

Authentication & Security

The API uses AES encryption for request/response data. All data must be encrypted before sending and decrypted upon receipt using the provided encryption key.

Request Body

{ 
    data:encryptData({ 
       group_id:GROUPID, 
       type:"new" 
    }) 
} 
                        

Response Handling

const response = { data: decryptData(responseEnc.data.data) } 
                        

Encryption/Decryption Methods

// Encryption
function encryptData(obj) {
    var string = JSON.stringify(obj);
    return CryptoJS.AES.encrypt(string, ENCRYPTION_KEY).toString();
}
                        
// Decryption
function decryptData(obj) {
    try {
        var string = CryptoJS.AES.decrypt(obj.toString(), ENCRYPTION_KEY).toString(CryptoJS.enc.Utf8);
        string = JSON.parse(string);
        return string;
    } catch (e) {
        return [];
    }
}
                        

Response Structure

  • appInfo: Chatbot theming configuration
  • company: Company information
  • bot: Bot configuration
  • leadForm: Lead collection form configuration
  • postForm: Feedback form configuration

Implementation Steps

Set up your environment variables:

  • ENCRYPTION_KEY: Your unique encryption key
  • GROUPID: Your default group ID
  • PROD: Production environment flag

Import the crypto libraries:

import CryptoJS from 'crypto-js';
                        

Steps to follow:

  • Implement the encryption/decryption functions as shown above
  • Make the API call to retrieve bot configuration
  • Apply theming and configuration from the response to your chatbot implementation
  • Implement the lead and feedback forms according to the response specifications

Error Handling

The decryption function returns an empty array [] if decryption fails. Implement proper error handling to manage API failures or decryption errors.

Notes for Developers

  • Always store encryption keys securely
  • The API returns all necessary information to render and configure the chatbot in a single call
  • Use the theming information from appInfo to maintain brand consistency
  • Lead and feedback forms should be implemented exactly as specified in the response