How do I enable sound for new messages?
# 🤝help
a
How do I enable sound for new messages? I know it's not customizable, but I need to know if I can add sound to notifications as in Gordy's example on triggers: https://jsfiddle.net/GordyNumberOne/pbhf3L0d/
b
Copy code
// Include the Botpress Web Chat library
<script src="https://cdn.botpress.cloud/webchat/v0/inject.js"></script>
 
// Initialize the web chat with default options
<script>
  window.botpressWebChat.init({
      "botId": <botID>,
      "hostUrl": "https://cdn.botpress.cloud/webchat/v0",
      "messagingUrl": "https://messaging.botpress.cloud",
      "clientId": <ClientID>,
      "botName": "Wonderful-chatbot",

// Add this to enable notification sound
      "disableNotificationSound": false
  });
</script>
look at
Copy code
// Add this to enable notification sound
      "disableNotificationSound": false
a
Thank you for your answer! However, when I use "disableNotificationSound": false the bot fails to load 🥺
b
can you paste your code here? there's some fixes going around
a
window.botpressWebChat.init({ "composerPlaceholder": "Chat with Bot", "botConversationDescription": "This is your web Assistant", "botId": "", "hostUrl": "https://cdn.botpress.cloud/webchat/v0", "messagingUrl": "https://messaging.botpress.cloud", "clientId": "", "botName": "Botty", "avatarUrl": "", "phoneNumber": "", "termsConditions": "", "privacyPolicy": "", "emailAddress": "", "website": "", "stylesheet": "", "useSessionStorage": true, "enableConversationDeletion": true "disableNotificationSound": false });
I hided some of the information on the code
q
dude, you didnt add comma here "enableConversationDeletion": true" at end
@ambitious-policeman-67581 should be like this "<script src="https://cdn.botpress.cloud/webchat/v0/inject.js%22%3E window.botpressWebChat.init({ "composerPlaceholder": "Chat with Bot", "botConversationDescription": "This is your web Assistant", "botId": "", "hostUrl": "https://cdn.botpress.cloud/webchat/v0", "messagingUrl": "https://messaging.botpress.cloud/", "clientId": "", "botName": "Botty", "avatarUrl": "", "phoneNumber": "", "termsConditions": "", "privacyPolicy": "", "emailAddress": "", "website": "", "stylesheet": "", "useSessionStorage": true, "enableConversationDeletion": true, "disableNotificationSound": false }); "
I also use this from today, was forcing open chat, now only sound.
@bright-magazine-792 but there is sound only on firefox for me, on chrome not and on my phone there is no sound, it's weird
I had sound blocked on chrome it seems, incognitor chrome works
b
yeah might have blocked
a
Haha, sorry that was from the edit, the original script has the comma, thank you for pointing that out tho. And yes, the sound was disabled on the site for some reason, as I tried it with safari and the sound worked perfectly. Thank you guys for your answers!! @bright-magazine-792
6 Views