Genesys Cloud CX

Discussion Thread View
  • 1.  Simulate a Genesys Cloud chat button on any website

    Posted 10-07-2021 11:52
    Hello Community,

    In the DevCast | Introducing the Bot Connector @Jim Crespino briefly shared how to use TamperMonkey to simulate a chat button on any website. I've added the extension to google chrome but can't seem to get it to work. Therefore, I am hoping the community can provide guidance on how I can enable TamperMonkey for testing. If someone has a chat script they can share that would be great! I would like to set up a testing environment to learn more about Web Messaging capabilities. Thank you.
    #DigitalChannels
    #Implementation
    #SystemAdministration
    #GenesysCloudCXQAEpisode

    ------------------------------
    Jaime Perez
    The Avon Company
    ------------------------------


  • 2.  RE: Simulate a Genesys Cloud chat button on any website
    Best Answer

    GENESYS
    Posted 10-07-2021 13:55
    Edited by Jaime Perez 10-15-2021 11:49
    Jaime,

    In TamperMonkey I created a new script that I called "Genesys Web Messaging" in which I pasted in the code that Genesys Web Messaging generated for me in Admin->Messenger Deployments.  I had to slightly adapt it because the snippet in Admin is in a <script> tag for embedding into HTML.  Here is what my TamperMonkey script looks like:

    (NOTE: You will have to change the URL 'apps.mypurecloud.com' and deployment key appropriate for your Genesys Cloud org and region)

    (ALSO: It might not be evident but those comments matter!  Especially the 'match' one that tells TamperMonkey which web pages that the script should execute on)

    // ==UserScript==
    // @name Genesys Web Messaging
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description Use Web Messaging on any Web Page!
    // @author Jim Crespino
    // @match https://*.genesys.cloud/*
    // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
    // @grant none
    // ==/UserScript==

    (function (g, e, n, es, ys) {

    g['_genesysJs'] = e;

    g[e] = g[e] || function () {

    (g[e].q = g[e].q || []).push(arguments)

    };

    g[e].t = 1 * new Date();

    g[e].c = es;

    ys = document.createElement('script'); ys.async = 1; ys.src = n; ys.charset = 'utf-8'; document.head.appendChild(ys);

    })(window, 'Genesys', 'https://apps.mypurecloud.com/genesys-bootstrap/genesys.min.js', {

    environment: 'use1',

    deploymentId: '<paste_your_deployment_key_here>'

    });



    ------------------------------
    Jim Crespino
    Senior Director, Developer Evangelism
    Genesys
    https://developer.genesys.com
    ------------------------------



  • 3.  RE: Simulate a Genesys Cloud chat button on any website

    Posted 10-07-2021 15:54
    Hi Jim, great! I will take a look at the code and attempt to replicate it. I'll let you know if I run into any issues. I really appreciate the share!

    ------------------------------
    Jaime Perez
    The Avon Company
    ------------------------------



  • 4.  RE: Simulate a Genesys Cloud chat button on any website

    Posted 10-14-2021 13:40
    Jim, I have copied over your script, updated the URL and filled in my deployment key.  I assume the environment is left as 'use1'?  I am also getting an error and TamperMonkey is not working.  I am looking for some direction.  Thanks.




    ------------------------------
    Martin Bunting
    i3Vision Technologies Inc.
    ------------------------------



  • 5.  RE: Simulate a Genesys Cloud chat button on any website

    Posted 10-14-2021 19:34
    Hey Martin

    Looks like your org is in Canada Central, so you'll need to change that environment to match your region - cac1.  That error isn't critical as I get it as well but mine works :)

    ------------------------------
    Vaun McCarthy
    NTT New Zealand Limited
    ------------------------------



  • 6.  RE: Simulate a Genesys Cloud chat button on any website

    Posted 10-20-2021 08:54
    Hi Jim
    Sorry to hijack, but I am trying the same thing and getting no button, is my config below correct please?
    // ==UserScript==
    // @name Genesys Web Messaging
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description Use Web Messaging on any Web Page!
    // @author Jim Crespino
    // @match https://www.bbc.co.uk/news
    // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
    // @grant none
    // ==/UserScript==

    (function (g, e, n, es, ys) {
    g['_genesysJs'] = e;
    g[e] = g[e] || function () {
    (g[e].q = g[e].q || []).push(arguments)
    };
    g[e].t = 1 * new Date();
    g[e].c = es;
    ys = document.createElement('script'); ys.async = 1; ys.src = n; ys.charset = 'utf-8'; document.head.appendChild(ys);
    })(window, 'Genesys', 'https://apps.euw2.pure.cloud/genesys-bootstrap/genesys.min.js', {
    environment: 'euw2',
    deploymentId: '677f9a5c-c740-4d0f-9c70-851e8cxxxxxx'
    });

    ------------------------------
    Philip Thys
    British Telecommunications PLC
    ------------------------------



  • 7.  RE: Simulate a Genesys Cloud chat button on any website

    GENESYS
    Posted 10-21-2021 14:08
    @Philip Thys I assume you've checked that the deployment id is correct?  And that your Genesys Cloud org is hosted in the euw2 region?  You could also try to change the /@match to be something like "https://*.bbc.co.uk".  Lastly, make sure that you have actually enabled the script in tampermonkey to be active.​​

    ------------------------------
    Jim Crespino
    Senior Director, Developer Evangelism
    Genesys
    https://developer.genesys.com
    ------------------------------



  • 8.  RE: Simulate a Genesys Cloud chat button on any website

    Posted 10-22-2021 09:04
    Thanks Jim
    I've created a new deployment and this now works, can't figure out why the other one didn't, but I'm up and running 👍

    Thanks Again

    ------------------------------
    Philip Thys
    British Telecommunications PLC
    ------------------------------