How to Bypass Omnichannel Widget Login Form

  • Updated

By default, Qiscus Omnichannel Widget will ask users for their unique id and display name through the login form. But, in case you already have the data, you can bypass this login form using this code.

<script>
// this params is optional, it's needed for customizing login form
const params = {
options: {
channel_id: xxx, // see from Omnichannel dashboard > Integration > Omnichannel Widget
// extra fields are optional, this data will be shown as additional fields in the room
extra_fields: JSON.stringify([{
name: "company",
placeholder: "Type your company name",
visible: true
}]),
}
};

const qiscusls = localStorage.getItem("qismo-widget");

if(!qiscusls) localStorage.setItem("qismo-widget", JSON.stringify({
unique_id: "fikri@qiscus.com",
display_name: "Fikri (Qiscus)",
// property below is not needed, it's only needed if you want to pass additional info
extra_fields: JSON.stringify([{ key: "company", value: "Qiscus" }])
}));

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-v4.js";
s.async=true;
s.onload=s.onreadystatechange=function(){
new Qismo("change-this-to-your-own-app-id",params);
};
t=document.getElementsByTagName("script")[0];
t.parentNode.insertBefore(s,t);
});
</script>

Result:

This chat screen will be directly opened without filling in the login form.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.