For Salesforce Chat Sound Notification to Visitors, we can make use of embedded_svc.addEventHandler() for onAgentMessage and onChasitorMessage events. For playing the Audio or the Notification sound, we can make use of audio HTML tag and play() from JavaScript.
embedded_svc.addEventHandler() for onAgentMessage and onChasitorMessage events should be added before the embedded_svc.init() method. Please check the following for reference.
Code for Reference:
<audio id="AudioId">
<source src="SampleMusic.mp3" type="audio/mpeg">
</audio>
embedded_svc.addEventHandler("onChasitorMessage", function(data) {
console.log("onChasitorMessage event was fired");
let objSound = document.getElementById("AudioId");
objSound.play();
});
embedded_svc.addEventHandler("onAgentMessage", function(data) {
console.log("onAgentMessage event was fired");
let objSound = document.getElementById("AudioId");
objSound.play();
});