Using JavaScript, we can set the the Keyboard shortcut to start or initialize or initiate the Salesforce Chat.
The following implementation is for Salesforce Embedded Service Deployment Chat.
In the following example, I have used JavaScript to set the the Keyboard shortcut to start or initialize or initiate the Salesforce Chat.
Add the following JavaScript snippet in the Website where your Salesforce Chat is hosted.
<script>
document.addEventListener( 'keyup', ( event ) => {
console.log(
'Key is',
event.key
);
if ( event.key == 's' ) {
console.log(
"S key was pressed"
);
embedded_svc.liveAgentAPI.startChat({
directToAgentRouting: {
buttonId: "5735f000000Tm6g",
fallback: true
},
extraPrechatInfo: [],
extraPrechatFormDetails: []
});
}
}, false );
</script>
Update the buttonId using the buttonId value from the Embedded Service Deployment Code Snippet.
As per the above JavaScript, if the users presses s or S on their keyboard, it will initiate the Chat Widget.