By default Qiscus Omnichannel Widget v2 provides login form to get Name and Email in order for users to get into chat room. If for some reason, you want your users to automatically log into the widget using your built in credential account system, you can follow this steps,
Check User ID in Local Storage and Use Your Available User Account
// Get local storage to set up user
var qismoLs = localStorage.getItem('qismo-widget');
if(!qismoLs) localStorage.setItem('qismo-widget', JSON.stringify({
"user_id":"fikri@qiscus.com", // change this one to use your available account
"user_name":"Fikri", // this one as well
}));
You need to update the user_id and user_name field with your available user account.
Full code
<script>
// Get local storage to set up user
var qismoLs = localStorage.getItem('qismo-widget');
if(!qismoLs) localStorage.setItem('qismo-widget', JSON.stringify({
"user_id":"fikri@qiscus.com", // change this one to use session user
"user_name":"Fikri", // this one as well
}));
// Default Qiscus Omnichannel Widget Code
document.addEventListener('DOMContentLoaded', function() {
var s,t; s = document.createElement('script'); s.type = 'text/javascript';
s.src = 'https://s3-ap-southeast-1.amazonaws.com/qiscus-sdk/public/qismo/qismo-v2.js'; s.async = true;
s.onload = s.onreadystatechange = function() { new Qismo("your_app_id"); }
t = document.getElementsByTagName('script')[0]; t.parentNode.insertBefore(s, t);
});
</script>
Check the demo at https://codepen.io/ishlah/full/NZyOzg
Comments
0 comments
Please sign in to leave a comment.