How to invoke Embedded Service Chat on click of a button in Salesforce Site?For custom website(not site), check the following link.

<apex:page ><input type="button" value="Start Chat" onclick="startChat();"/><br/><br/><br/><input type="button" value="Clear Chat Session" onclick="clearSession();"/><br/><!-- Paste your Embedded Service Snippet code here --><script>function startChat() {console.log( 'Inside Start Chat' );embedded_svc.liveAgentAPI.startChat({directToAgentRouting: {buttonId: "5735f000000Tpl7",fallback: true},extraPrechatInfo: [],extraPrechatFormDetails: []});}function clearSession() {console.log( 'Inside Start Chat' );embedded_svc.liveAgentAPI.clearSession();}</script></apex:page>




Technical Blogger, Software Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Speed Up UI Development with KnowCode for Flutter

Programming with Functions #9: Try, for-comprehension, and monadic laws

Meet The Inspirational Laura Camargo

My Personal Projects

Part 8- Kubernetes Services- External Name

Modifying STL files to work with URDF

Laragon — The best alternative of the Xampp server!

WEEK9| Capstone Progress[3/10–03/17]

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Technical Blogger, Software Engineer

More from Medium

How to display Currency field with decimal values in lightning-datatable in Salesforce Lightning…

5G — Architecture, Enabling Technologies.

iOS-Swift language learning notes: iOS Concurrency with GCD and Operations<Haven’t finished the…

Redundant Language in the 21st Century: Perversely persisting “towards Sustainability”​