Sunshine(v1) Step 3: Add the widget

This is the third step of integrating Sunshine Conversations (v1). Make sure you have:

To add the Sunshine Conversations Web Messenger widget to your website, you need to add a code snippet to the pages of your website.

Have your App ID ready

You'll need to replace a part of the script with your App ID. If you don't have it handy, copy it from your Sunshine Conversations App Settings page.

Add the Sunshine Conversations Web Messenger widget

Add this script inside near the end of the <head> section of your web pages.

<script>
 !function(e,n,t,r){function s(){try{var e;
    if((e="string"==typeof this.response?JSON.parse(this.response):this.response).url){
    var t=n.getElementsByTagName("script")[0],r=n.createElement("script");
    r.async=!0,r.src=e.url,t.parentNode.insertBefore(r,t)}}catch(e){}}
    var o,p,a,i=[],c=[];e[t]={init:function(){o=arguments;
    var e={then:function(n){return c.push({type:"t",next:n}),e},catch:function(n){
    return c.push({type:"c",next:n}),e}};
    return e},on:function(){i.push(arguments)},
    render:function(){p=arguments},destroy:function(){
    a=arguments}},e.__onWebMessengerHostReady__=function(n){
    if(delete e.__onWebMessengerHostReady__,e[t]=n,o)
    for(var r=n.init.apply(n,o),s=0;s<c.length;s++){
    var u=c[s];r="t"===u.type?r.then(u.next):r.catch(u.next)}
    p&&n.render.apply(n,p),a&&n.destroy.apply(n,a);
    for(s=0;s<i.length;s++)n.on.apply(n,i[s])};var u=new XMLHttpRequest;
    u.addEventListener("load",s),
    u.open("GET","https://web-messenger.ingenious.ai/loader.json",!0),
    u.responseType="json",u.send()}(window,document,"ingeniousai");
 </script>
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.