Genesys Cloud CX (formerly PureCloud)

Discussion Thread View
Expand all | Collapse all

Simulate a Genesys Cloud chat button on any website

Jump to Best Answer
  • 1.  Simulate a Genesys Cloud chat button on any website

    Posted 9 days ago
    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 9 days ago
    Edited by Jaime Perez 2 days ago
    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 9 days ago
    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 2 days ago
    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

    Top 25 Contributor
    Posted 2 days ago
    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
    ------------------------------