How to invoke Embedded Service Chat on click of a button in Salesforce?

embedded_svc.bootstrapEmbeddedService() can be used. Check the following article for additional information.  
Sample Code in VF Page:
<apex:commandButton value="Start Chat" onclick="embedded_svc.bootstrapEmbeddedService();" reRender="chatDetails"/> 

Sample code in HTML:
    <input type="button" value="Start Chat" onclick="startChat();"/><br/><br/><br/>
    <input type="button" value="Clear Chat Session" onclick="clearSession();"/><br/>
        Snipped Code from Embedded Service Deployment
        function startChat() {
            console.log( 'Inside Start Chat' );
                directToAgentRouting: {
                buttonId: "5735f000000Tpl7",
                fallback: true
            extraPrechatInfo: [],
            extraPrechatFormDetails: []
        function clearSession() {
            console.log( 'Inside Start Chat' );


No comments:

Post a Comment