Author Topic: Genesys Widgets - Chat  (Read 5019 times)

Offline GoodONE

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Genesys Widgets - Chat
« on: April 23, 2018, 02:34:08 PM »
Hey team,

I need your help in a doubt, I'm checking a test sample provided in the Genesys widgets docs, specifically for chat, I can see that when I fill the required fields to create a chat session I get a script and I can copy/paste it in the index.html in my other page, but I do not understand where to set it, I tried to put it into the window.onload  event, but it did not work,  any suggestion you may have?

The reason for doing this is to maintain the chat session alive when the user is moving across the website pages.

This is the sample page:
[b]Launcher:[/b]
https://docs.genesys.com/Documentation/GWC/Current/Deployment/GWCConfig

Thanks.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Genesys Widgets - Chat
« Reply #1 on: April 23, 2018, 03:38:24 PM »
you put in your HTML main code, but in that same HTML you need to reference the Genesys JS too


Follow first this:
https://docs.genesys.com/Documentation/GWC/Current/Deployment/Welcome

Offline GoodONE

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Genesys Widgets - Chat
« Reply #2 on: April 23, 2018, 04:43:25 PM »
Thanks for the reply,

It is in the same doc, and it loads correctly, but the script does not do anything else, maybe I'm waiting for something that won't happen, I think I should see the same open window chat, Am I wrong?

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Genesys Widgets - Chat
« Reply #3 on: April 23, 2018, 04:54:03 PM »
You should see a side bar.
Check with the debug mode (developer) on your browser, maybe a missing reference? You should be able to see what is wrong in there

Offline GoodONE

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Genesys Widgets - Chat
« Reply #4 on: April 23, 2018, 07:29:20 PM »
Actually, there's no error, it just won't load it, look at my sample, let me know if it's wrong:

This is the second page after I created a chat session then I move to this one so I put the generated script into a script tag:

[code]<!DOCTYPE html>
<html>
<title>Service</title>

<script id="genesys-widgets-script" src="/chattest/widgets.min.js"></script>

<script>

//Auto generated Script
window._genesys.widgets = {
      main: {
            debug: true,
            theme: "dark",
            lang: "en",
            customStylesheetID: "genesys_widgets_custom",
            plugins: [
                  "cx-webchat",
                  "cx-webchat-service"
            ]
      },
      webchat: {
            dataURL: "http://10.70.90.56:8080/genesys/2/chat/Test",
            apikey: "",
            userData: {},
            cometD: {
                  enabled: false
            },
            autoInvite: {
                  enabled: true,
                  timeToInviteSeconds: 5,
                  inviteTimeoutSeconds: 30
            },
            chatButton: {
                  enabled: true,
                  openDelay: 1000,
                  effectDuration: 300,
                  hideDuringInvite: true
            },
            uploadsEnabled: false
      }
};

</script>



<body>

<a href="/chattest/Sales.html">Sales</a>

<hr />
<a href="/chattest/Launcher.html">Launcher</a>

</body>
</html>[/code]

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: Genesys Widgets - Chat
« Reply #5 on: April 23, 2018, 07:57:03 PM »
Incorrect order - widgets.min.js should be loaded after configuration script

Offline GoodONE

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Genesys Widgets - Chat
« Reply #6 on: April 24, 2018, 01:23:20 PM »
Ok thanks, it did not work,

I have this other script, I found it in the docs, but it is still not working, Do you see something wrong with it?

[code]<!DOCTYPE html>
<html>
<title>Service</title>


<script>

(function(o){
var d = o.location;
var f = function(){
o.aTags = o.aTags || [];
for(var i=0;i<o.aTags.length;i++){
var oTag = o.aTags[i];
var fs = d.getElementsByTagName(oTag.type)[0], e;
if(d.getElementById(oTag.id)) return; e = d.createElement(oTag.type); e.id = oTag.id;
if(oTag.type == "script"){
e.src = oTag.path;
}else{
e.type = 'text/css';e.rel = 'stylesheet';e.href = oTag.path;
}
fs.parentNode.insertBefore(e, fs);
}
},ol = window.onload,showConfigData = function(){
// remote script has loaded, this is to show the config script on text area of launcher
d.getElementsByName('configData')[0].disabled = false;
d.getElementsByName('configData')[0].value = "window._genesys.widgets = " + JSON.stringify(window._genesys.widgets, undefined, 6).replace(/\"([^(\")"]+)\":/g,"$1:")+";";
};
if(o.onload){typeof window.onload != "function"?window.onload=f:window.onload=function(){ol();f();
showConfigData();}}else {f();showConfigData();};
})({location: document,
onload: false,
aTags: [{type:"script", id:"genesys-widgets-script", path:"/chattest/widgets.min.js"},
  {type:"link", id:"genesys-widgets-styles", path:"/chattest/widgets.min.css"}]});


</script>

<body>

<a href="/chattest/Sales.html">Sales</a>

<hr />
<a href="/chattest/Launcher.html">Launcher</a>

</body>
</html>[/code]

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Genesys Widgets - Chat
« Reply #7 on: April 24, 2018, 01:46:49 PM »
Please, read the whole documentation before trying to play with it. The docs are complementary.
You are missing this:
https://docs.genesys.com/Documentation/GWC/latest/Deployment/GWCConfig

Offline GoodONE

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Genesys Widgets - Chat
« Reply #8 on: April 24, 2018, 06:41:33 PM »
Thanks it is now working!.

Another question,
Do you know if by using this when the user moves to other page the chat session should be alived with the same chat history?


Offline Sones

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Genesys Widgets - Chat
« Reply #9 on: April 27, 2018, 11:18:25 AM »
I would certainly hope that this was the case, GoodONE. If not, it would be on my wishlist for sure! Otherwise, great functionality.

Offline GoodONE

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Genesys Widgets - Chat
« Reply #10 on: April 27, 2018, 09:48:09 PM »
Hey, thanks for the comment on this post,

Well, I'm still working on this because for some reason the cookies seem not to be working fine when creating a chat session, after moving to another website page from the one where the chat session is,  the chat window is gone and then after this, the chat button is displayed again, but I still have the chat alive in the other end, it's confusing, if you can provide any other suggestion it would be great.

Thanks.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Genesys Widgets - Chat
« Reply #11 on: April 27, 2018, 09:54:46 PM »
You are keeping the chat session at agent side only because there was no close event.
You need to manage it in your side, after you change the page you are creating a new instance of that script.
As far as I know you can't keep the same session when this happens. Your Web site would have to keep the unique page and via Ajax or similar do the navigation possible.
Maybe a frame for the chat?


Enviado de meu E6633 usando o Tapatalk


Offline GoodONE

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Genesys Widgets - Chat
« Reply #12 on: May 03, 2018, 03:24:07 PM »
Thanks for your suggestions,

I'd like to close this thread, we got some advice from the Genesys developers, first we saw that our sample was working in Firefox as it was, but it did not in Chrome or IE, the issue was that we were not accessing to the webpage from a fully qualified domain name in order for cookies to work, accessing that way that worked for us and now the chat session persists in all the website pages.

Hope this help for future reference.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Genesys Widgets - Chat
« Reply #13 on: May 03, 2018, 06:24:27 PM »
Nice!
Thanks for sharing. That is a good advice


Enviado de meu E6633 usando o Tapatalk