Genesys Cloud - Main

 View Only

Discussion Thread View
  • 1.  Chat Widget Not Laucnhing Chat

    Posted 02-21-2020 12:48
    Hi all,

    I had this working yesterday, now it is now.  Wondering if anyone can help me.  When I click the Start Chat on the web site, it does nothing.  I have parsed out my org identifiers, but they do match what was generated in the Version 1.1 Widget.  I have Widget pointed to a good Chat Call Flow as well



    <!DOCTYPE html>
    <html>

    <head>
    <meta charset="utf-8">
    <title>PureCloud Web Chat Demo</title>
    </head>

    <body>
    <form id="chatForm">
    <h3>Participant Information- local</h3>

    <table class="webchat-config">
    <tbody>
    <tr>
    <th>First Name:</th>
    <td><input type="text" id="first-name" value="John" /></td>
    </tr>
    <tr>
    <th>Last Name:</th>
    <td><input type="text" id="last-name" value="Doe" /></td>
    </tr>
    <tr>
    <th>Agent Email:</th>
    <td><input type="text" id="agent-email" value="alex.agent@example.com" /></td>
    </tr>
    </tbody>
    </table>
    <button type="button" id="chat-button">Start Chat</button>
    </form>
    <div id="chat-container" style="height:600px"></div>
    <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
    <script
    id="purecloud-webchat-js"
    type="text/javascript"
    src="https://apps.mypurecloud.com/webchat/jsapi-v1.js"
    region="us-east-1"
    org-guid="MATCHES MY ORG ID"
    deployment-key="MATCHES MY DEPLOYMENT KEY"
    ></script>

    <script type="text/javascript">

    $(document).ready(function initializeChat () {
    var chatConfig = {
    // Web chat application URL
    webchatAppUrl: 'https://apps.mypurecloud.com/webchat',

    // Web chat service URL
    webchatServiceUrl: 'https://realtime.mypurecloud.com:443',

    // organization GUID
    orgGuid: 'MATCHES MY ORG ID',

    // Numeric organization ID
    orgId: 21992,

    // Organization name. Replace with your org name.
    orgName: 'MATCHES MY ORG NAME',
    4
    // Requested agent language skill (Agent must have this language skill to receive chat)
    language: 'English - Written',

    // Requested agent skills (Agent must have these skills to receive chat)
    skills: ['Computers', 'Printers'],
    // OR
    //skills: [],

    // Priority
    priority: 0,

    // Queue Name
    queueName : 'Support',

    // Target agent email (OPTIONAL)
    agentEmail: 'alex.agent@example.com',

    // Whether to show submit button or send message on Enter keypress
    showSubmitButton: true,

    // Log level
    logLevel: 'DEBUG',

    // Locale code
    locale: 'en',

    // Whether to allow reconnects
    reconnectEnabled: true,

    //Allowed reconnect origins
    reconnectOrigins: ['https://example.com', 'https://help.example.com', 'https://shop.example.com'],

    // Logo used within the chat window
    companyLogoSmall: {
    width: 149,
    height: 149,
    url: 'https://dhqbrvplips7x.cloudfront.net/webchat/1.0.23/company-logo-small-9c9fe09b.png'
    },
    // Fallback image used for agent if no agent image is defined in the agent's PureCloud profile
    agentAvatar: {
    width: 462,
    height: 462,
    url: 'https://dhqbrvplips7x.cloudfront.net/webchat/1.0.23/agent-e202505f.png'
    },

    // Text displayed with chat window is displayed
    welcomeMessage: 'Thanks for chatting.',

    // CSS class applied to the chat window
    cssClass: 'webchat-frame',

    // Custom style applied to the chat window
    css: {
    width: '100%',
    height: '100%'
    }
    };
    var chatButton = document.getElementById('chat-button');

    // Required if reconnects are enabled
    window.PURECLOUD_WEBCHAT_FRAME_CONFIG = {
    containerEl: 'chat-container'
    };

    ININ.webchat.create(chatConfig)
    .then(function (webchat) {
    // Optionally use isAutoJoined if reconnects are enabled
    if (webchat.isAutoJoined()) {
    // Do something to disable chat button
    } else {
    chatButton.onclick = function () {
    var firstName = document.getElementById('first-name').value;
    var lastName = document.getElementById('last-name').value;
    var agentEmail = document.getElementById('agent-email').value;

    // Use getConfig.setConfigProperty() for any web chat configuration property to dynamically set config values.
    webchat.getConfig().setData({
    firstName: firstName,
    lastName: lastName,
    addressStreet: '64472 Brown Street',
    addressCity: 'Lindgrenmouth',
    addressPostalCode: '50163-2735',
    addressState: 'FL',
    phoneNumber: '1-916-892-2045 x293',
    email: 'willie.duit@myspace.com',
    phoneType: 'Cell',
    customerId: 59606
    });

    //Use the updateConfig function to update batches of properties by passing in a partially filled chatConfig object
    webchat.updateConfig({
    agentEmail: 'debrah.agent@example.com',
    locale: 'en',
    welcomeMessage: 'Welcome to the Adapt Health Chat Demo',
    });

    // Alternatively, call webchat.renderPopup here. Note that reconnects do not apply to popup chat.
    return webchat.renderFrame({
    containerEl: 'chat-container'
    });
    };
    }
    })
    .catch(function (err){
    console.log(err);
    });
    });

    </script>

    </body>
    </html>
    #PlatformAdministration

    ------------------------------
    Michael McQuaid
    AdaptHealth LLC
    ------------------------------


  • 2.  RE: Chat Widget Not Laucnhing Chat

    Posted 02-21-2020 15:36
    I was trying to help you but am having the same issue. This used to work. But now today it is not.

    I even started from scratch - copied the sample code from the developer site and only added my org's info.

    I did find that it did work in Edge but not in Chrome or old versions of IE.

    The error in the Chrome console is:
    storage-9d861c40.js:214 Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'Window': Invalid target origin 'null' in a call to 'postMessage'.
    at https://dhqbrvplips7x.cloudfront.net/webchat/669/storage-9d861c40.js:214:3469
    at n (https://dhqbrvplips7x.cloudfront.net/webchat/669/storage-9d861c40.js:3:490)
    at Generator._invoke (https://dhqbrvplips7x.cloudfront.net/webchat/669/storage-9d861c40.js:3:1592)
    at Generator.t.<computed> [as throw] (https://dhqbrvplips7x.cloudfront.net/webchat/669/storage-9d861c40.js:3:669)
    at n (https://dhqbrvplips7x.cloudfront.net/webchat/669/storage-9d861c40.js:214:218)
    at https://dhqbrvplips7x.cloudfront.net/webchat/669/storage-9d861c40.js:214:331

    The Chat API Tool here: https://developer.mypurecloud.com/developer-tools/#/webchat

    does continue to work.

    I suggest you post in the Developer Forum. Something is wrong with the example or something with the imported scripts changed and now the example is broken.

    ------------------------------
    Dan Fontaine
    Altivon
    ------------------------------



  • 3.  RE: Chat Widget Not Laucnhing Chat

    Posted 02-21-2020 15:42
    Are you by chance using WordPress?  I am, and it stopped.  But when I upload the HTML to jsfiddle.net, it works as it should.

    ------------------------------
    Michael McQuaid
    AdaptHealth LLC
    ------------------------------



  • 4.  RE: Chat Widget Not Laucnhing Chat

    Posted 02-21-2020 15:51
    I was just opening the .html file locally on my PC using the various browsers. It works in Edge and only Edge when I do that. I tested with version 1 and version 1.1.

    I did upload my code (v1.1) to jsfiddle.net (in Chrome) and it did function.

    This is strange.

    ------------------------------
    Dan Fontaine
    Altivon
    ------------------------------



  • 5.  RE: Chat Widget Not Laucnhing Chat

    Posted 02-21-2020 16:01
    I just did the same thing you did, woth the same results.

    ------------------------------
    Michael McQuaid
    AdaptHealth LLC
    ------------------------------



  • 6.  RE: Chat Widget Not Laucnhing Chat

    Posted 02-21-2020 15:56
    The page works, well, it opens as it should, it is when I click the start chat button, nothing happens.  Not sure if I mentioned that.  But the Start Chat works in HTML test sites.

    ------------------------------
    Michael McQuaid
    AdaptHealth LLC
    ------------------------------



  • 7.  RE: Chat Widget Not Laucnhing Chat

    Posted 02-24-2020 09:22
    It appears we have found the issues, Genesys looks to be blocking our development web domain.  When using the same widget code on Wix.com or from jsfiddle.com it works, but not from our domain.  We have a ticket opened and should hopefully have it working soon!

    ------------------------------
    Michael McQuaid
    AdaptHealth LLC
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources