Javascript API
Open, Close and Toggle widget
LiveCaller.$emit('ui.widget.open');
LiveCaller.$emit('ui.widget.close');
LiveCaller.$emit('ui.widget.toggle');
example of a button, when clicked it will toggle Livecaller's widget frame
<script>
document.getElementById('your button id').addEventListener('click', function (e) {
e.preventDefault()LiveCaller.$emit('ui.widget.toggle')})
</script>
Listen to the widget opening or closing events
LiveCaller.$on('ui.widget.open', () => {});
LiveCaller.$on('ui.widget.close', () => {});
Change language
change en to your native language 2 letter iso code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
Change language before the widget load
LiveCaller.config.merge({app: {locale: 'en'}});
Update language inside the loaded widget
LiveCaller.$emit('app.locale.update', 'en');
For authentication and profile editing is used JWT verification algorithm HS256.
Token lifetime is 15 minutes
Necessary payload information:
sub - unique id of the customer in your system
iat - token generation timestamp ( UNIX timestamp seconds)
JWT Header example:
{
"alg": "HS256",
"typ": "JWT"
}
Edit Customer JWT Payload example:
{
"sub": "12ba81b2-c1fe-479b-8b4a-09fecb02a3d6",
"name": "John Doe",
"email": "[email protected]",
"mobile": "995000123456",
"iat": 1565610612
}
User authorization
LiveCaller.$emit('user.login', 'JWT Token Here');
User profile update
LiveCaller.$emit('user.update', 'JWT Token Here');
User Logout
LiveCaller.$emit('user.logout');
Last modified 1yr ago