Manage your leads and customer data better by integrating registration forms with Kapure Chat.
This helps in integrating our chat to your web form which can create tickets and enquires in real-time.
Below are some screenshots that showcase the configuration set up for Enquiry
Auto reply messages set up for sending the welcome message, closing message and when the assignment is exceeded.
We can also schedule the working hours for the chat assignment as below:
Email alert option helps in getting an email while a chat is created.
Once the above details are filled, you can save the configuration and then proceed with the scripts to update in the website.
Following is the chat code for creating new enquiry/leads using registration form.
Please include the code below in your website. Note: For wordpress website, to avoid conflicts, please include the script in the footer section.
<script type="text/javascript"> /* Include the following script without any changes */ function initSupportScript(){var t=document.getElementsByTagName("head")[0],e=document.createElement("script");e.type="text/javascript",e.src="https://www.adjetter.com/static/assets/global/plugins/supportmessenger/js/kapturesupport.nojquery.min.js",e.onload=initKapchat,t.appendChild(e)}if("undefined"==typeof jQuery){var headTag=document.getElementsByTagName("head")[0],jqTag=document.createElement("script");jqTag.type="text/javascript",jqTag.src="https://www.adjetter.com/static/assets/global/plugins/jquery.min.js",jqTag.onload=initSupportScript,headTag.appendChild(jqTag)}else initSupportScript(); /* Initialize Kapchat */ function initKapchat() { Kapchat.initialize({ key: '86c9cf7b9b91bafa2496308b054c80729ecc98472122437819', label: 'enquiry', widget: 'kp_widget_eq', widget_color: 'rgba(0,224,17,0.83)', widget_text_color: 'rgba(0,224,17,0.83)', bubble_color: 'rgba(0,224,17,0.83)', bubble_text_color: 'rgba(0,224,17,0.83)', success: function() { // your callback here (optional) }, error: function(e) { console.log(e); } }); } </script>
Chat integration using customer login with Web:
Following are the steps for integrating the chat script in your website:
For security reasons, you will need to encrypt the customer code in your backend to avoid exposing customer code in the client side.
Refer to Step 3 for encryption details.
You will require the following:
This is a 16-byte random string that will be used for the initialization vector. Use this string for encryption along with the encryption key for encrypting customer code. Refer to Step 3 for sample code. You need to pass iv during initialization.
Note: For wordpress website, to avoid conflicts, please include the script in the footer section.
<script type="text/javascript"> /* Include the following script without any changes */ function initSupportScript(){var t=document.getElementsByTagName("head")[0],e=document.createElement("script");e.type="text/javascript",e.src="https://www.adjetter.com/static/assets/global/plugins/supportmessenger/js/kapturecustomersupport.v2.min.js",e.onload=initKapchat,t.appendChild(e)}if("undefined"==typeof jQuery){var headTag=document.getElementsByTagName("head")[0],jqTag=document.createElement("script");jqTag.type="text/javascript",jqTag.src="https://www.adjetter.com/static/assets/global/plugins/jquery.min.js",jqTag.onload=initSupportScript,headTag.appendChild(jqTag)}else initSupportScript(); /* Initialize Kapchat */ function initKapchat() { Kapchat.initialize({ customercode: '', // encrypted customer code key: '0e24d20b2f001f126c821f1470a93e92778e47870259604671', // partner support key iv: '', // pseudo random string in hex format label: 'Support Team', success: function() { // your callback here (optional) }, error: function(e) { console.log(e); } }); } </script>
You need to encrypt using AES 128-bit encryption with CBC mode and PKCS5/PKCS7 padding
You can find the sample code for encryption in your backend in the following languages:
#For PhP > 7.x version $KEY_SIZE = 16; $ENCRYPTION_KEY = 'thisisasamplepassphraseforencoding'; $plaintext = 'Hello World!'; $iv = ''; // Driver function function encrypt($iv, $plaintext) { global $ENCRYPTION_KEY, $KEY_SIZE; try { // Ensure that the key is no more than 16-bytes long $key = (strlen($ENCRYPTION_KEY) > $KEY_SIZE) ? substr($ENCRYPTION_KEY, 0, $KEY_SIZE) : $ENCRYPTION_KEY; $key = pack('a*', $key); // convert to binary // Generate initialization vector $iv = bin2hex(openssl_random_pseudo_bytes(8)); // Encrypt plaintext $ciphertext = openssl_encrypt($plaintext, 'aes-128-cbc', $ENCRYPTION_KEY, 0, $iv); echo "IV: " . $iv . "\n"; echo "Encrypted text: " . $ciphertext . "\n"; } catch (Exception $e) { echo 'An exception occurred while encrypting plain text in encrypt(): ' . $e->getMessage(); } } encrypt($iv, $plaintext); #For PhP < 7.x version $KEY_SIZE = 16; $ENCRYPTION_KEY = 'thisisasamplepassphraseforencoding'; // PKCS#5 Padding function pad_pkcs5($text) { try { $size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $pad = $size - (strlen($text) % $size); return $text . str_repeat(chr($pad), $pad); } catch (Exception $e) { echo 'Padding exception in pad_pkcs5(): ' . $e->getMessage(); } } // Encryption using AES CBC (128-bits) function encrypt($plaintext, $passphrase, $iv) { try { $padded_str = pad_pkcs5($plaintext); $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $passphrase, $padded_str, MCRYPT_MODE_CBC, $iv); return $ciphertext; } catch (Exception $e) { echo 'Encryption exception in encrypt: ' . $e->getMessage(); } } // Driver function function test() { global $ENCRYPTION_KEY, $KEY_SIZE; $plaintext = "Hello World!"; try { // Ensure that the key is no more than 16-bytes long $key = (strlen($ENCRYPTION_KEY) > $KEY_SIZE) ? substr($ENCRYPTION_KEY, 0, $KEY_SIZE) : $ENCRYPTION_KEY; $key = pack('a*', $key); // convert to binary // Generate initialization vector $randm = mcrypt_create_iv(8, MCRYPT_DEV_URANDOM); $hex = bin2hex($randm); $iv = pack('a*', $hex); // convert to binary // Encrypt plaintext $ciphertext = encrypt($plaintext, $key, $iv); echo "IV: " . $iv . "\n"; echo "Encrypted text: " . base64_encode($ciphertext) . "\n"; } catch (Exception $e) { echo 'An exception occurred while encrypting plain text in test(): ' . $e->getMessage(); } } // Test encryption test();
import java.security.AlgorithmParameters; import java.security.MessageDigest; import java.util.Arrays; import java.util.Random; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import javax.xml.bind.DatatypeConverter; import java.security.SecureRandom; public class CryptoDemo { private static int KEY_SIZE = 16; private static String ENCRYPTION_KEY = "thisisasamplepassphraseforencoding"; public static void main(String[] args) { String plaintext = "Hello World!"; try { // Ensure that the key is no more than 16-bytes long String passphrase = (ENCRYPTION_KEY.length() > KEY_SIZE) ? ENCRYPTION_KEY.substring(0, KEY_SIZE) : ENCRYPTION_KEY; byte[] key = passphrase.getBytes("UTF-8"); // Generate initialization vector byte[] iv = generateInitializationVector(KEY_SIZE); System.out.println("IV: " + new String(iv, "UTF-8")); System.out.println("Encrypted text: " + CryptoDemo.encrypt(plaintext.getBytes("UTF-8"), key, iv)); } catch (Exception e) { System.out.println("An exception occurred while encrypting plain text in main(): " + e); } } // Encryption using AES CBC (128-bits) private static String encrypt(byte[] plaintext, byte[] key, byte[] iv) { try { SecretKeySpec secretKeySpec; secretKeySpec = new SecretKeySpec(key, "AES"); // PKCS#5 Padding Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); AlgorithmParameters algorithmParams = AlgorithmParameters.getInstance("AES"); algorithmParams.init(new IvParameterSpec(iv)); cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, algorithmParams); byte[] encryptedBytes = cipher.doFinal(plaintext); return DatatypeConverter.printBase64Binary(encryptedBytes); } catch (Exception e) { System.out.println("Encryption exception in encrypt(): " + e); } return null; } /** * Utility function to generate initialization vector * * @return bytes */ private static byte[] generateInitializationVector(int len) { try { char[] CHAR_ARRAY = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456879".toCharArray(); SecureRandom srand = new SecureRandom(); Random rand = new Random(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < len; ++i) { if ((i % 10) == 0) { rand.setSeed(srand.nextLong()); } sb.append(Integer.toHexString(rand.nextInt(CHAR_ARRAY.length))); } return sb.toString().substring(0, KEY_SIZE).getBytes("UTF-8"); } catch (Exception e) { System.out.println("Error generating Initialization Vector: " + e); } return null; } }
from Crypto import Random from Crypto.Cipher import AES import base64 import binascii import random import os KEY_SIZE = 16 ENCRYPTION_KEY = b"thisisasamplepassphraseforencoding" # PKCS5 Padding def pad_pkcs5(text): try: length = KEY_SIZE - (len(text) % KEY_SIZE) return text + chr(length)*length except: print "Padding exception in pad_pkcs5()" # Encryption using AES CBC (128-bits) def encrypt(plaintext, passphrase, iv): try: aes = AES.new(passphrase, AES.MODE_CBC, iv) return base64.b64encode(aes.encrypt(pad_pkcs5(plaintext))) except: print "Encryption exception in encrypt()" # Driver function def test(): plaintext = "Hello World!" try: # Ensure that the key is no more than 16-bytes long key = ENCRYPTION_KEY[0:KEY_SIZE] if len(ENCRYPTION_KEY) > KEY_SIZE else ENCRYPTION_KEY # Generate initialization vector randm = os.urandom(8) iv = binascii.hexlify(randm); # Encrypt plaintext print "IV: %s" %iv print "Encrypted text: %s" %encrypt(plaintext, key, iv) except: print "An exception occurred while encrypting plain text in test()" # Test encryption test()
var CryptoJS = require("crypto-js"); var KEY_SIZE = 16; var ENCRYPTION_KEY = "thisisasamplepassphraseforencoding"; try { var plaintext = 'Hello World!'; // Ensure that the key is no more than 16-bytes long var key = (ENCRYPTION_KEY.length > KEY_SIZE ) ? ENCRYPTION_KEY.substr(0, KEY_SIZE) : ENCRYPTION_KEY; // Generate initialization vector var iv = CryptoJS.lib.WordArray.random(8).toString(); console.log('IV: ' + iv); console.log('Encrypted text: ' + encrypt(plaintext, key, iv)); } catch (error) { console.log('An exception occurred while encrypting plain text: ' + error.message); } function encrypt(plaintext, passphrase, iv) { try { var encrypted = CryptoJS.AES.encrypt( plaintext, CryptoJS.enc.Utf8.parse(passphrase), { mode: CryptoJS.mode.CBC, iv: CryptoJS.enc.Utf8.parse(iv), padding: CryptoJS.pad.Pkcs7 } ); return encrypted.ciphertext.toString(CryptoJS.enc.Base64); } catch (error) { console.log('Encryption exception in encrypt(): ' + error.message); } }
Chat template can be added for both ticketing and enquiries. The agent can choose the title while engaging with the customers so the added templates will pop up in the chat box.
Chat trigger will help in setting up the trigger for the customers with the expiration time. For example, if the customer is idle the alert will be triggered to the customer based on the expiration time set.
This helps in setting up the chat widget configurations in the frontend itself, as per the client requirements.