New help validating web chat code

I am trying to add web chat to my community portal and I have meshed together code from various examples, but it does not appear to work. Can someone help me determine what I am missing? I hit the buttons, but nothing launches.

Marketo Customer Cares Chat

Marketo Customer Cares Live Chat

<table class="webchat-config">
    <tbody>
    <tr>
        <th>First Name:</th>
        <td><input type="text" id="firstName" value="" /></td>
    </tr>
    <tr>
        <th>Last Name:</th>
        <td><input type="text" id="lastName" value="" /></td>
    </tr>
    <tr>
        <th>Contact Email:</th>
        <td><input type="text" id="contactEmail" value="" /></td>
    </tr>
    </tbody>
</table>

<button type="button" onclick="startEmbeddedChat()">Start Embedded Chat</button>
<button type="button" onclick="startPopupChat()">Start Pop-up Chat</button>
var chatConfig = {}; function createChatConfig(){ var firstName = document.getElementById('firstName').value; var lastName = document.getElementById('lastName').value; var contactEmail = document.getElementById('contactEmail').value; let chatConfig = { "webchatAppUrl": "https://apps.mypurecloud.com/webchat", "webchatServiceUrl": "https://realtime.mypurecloud.com:443", "orgId": "16336", "orgName": "marketo", "queueName": "Customer Care", "logLevel": "DEBUG", "locale": "en", "data": { "firstName": "", "lastName": "", "contactEmail":"", }, "companyLogo": { "width": 600, "height": 149, "url": "https://marketo--c.na32.content.force.com/servlet/servlet.ImageServer?id=01538000002Epu3&oid=00D500000006sHb&lastMod=1504632059000" }, "companyLogoSmall": { "width": 25, "height": 25, "url": "https://marketo--c.na32.content.force.com/servlet/servlet.ImageServer?id=01538000002Epu8&oid=00D500000006sHb&lastMod=1504632405000" }, "agentAvatar": { "width": 462, "height": 462, "url": "https://d3a63qt71m2kua.cloudfront.net/developer-tools/552/assets/images/agent.jpg" }, "welcomeMessage": "Thank you for connecting, one of our Customer Care representatives will be right with you.", "cssClass": "webchat-frame", "css": { "width": "100%", "height": "100%" } }; ININ.webchat.create(chatConfig, function(err, webchat) { if (err) { console.error(err); throw err; } webchat.renderPopup({ width: 400, height: 400, title: 'Chat' }); });

Are you getting any errors or anything in the console or network tab in the browser?

Not seeing any errors at all. Hitting the buttons appears to have no reaction or activity. Does the code actually look correct?

If this is all of your code, you're calling startPopupChat() on the button click, but that function isn't defined anywhere. It looks like you should be calling createChatConfig().

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.