https://discord.gg/botpress logo
Sound for new message
# 🤝help
b
Hi everyone, can someome help me to enable sound for new message in chatbot
Here my current code:
Copy code
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Botpress Full-Width in a DIV</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <style>
      /*body {
        display: flex;
        flex-direction: column; // 000Bo
        justify-content: center;
        align-items: center;
        height: 100vh;
        margin: 0;
        color: white;
        background-color: #000000;
        font-family: Arial, sans-serif;
      }*/
      
      h2, h3 {text-align: center}

      .container-bpFull {
        display: flex;
        flex-direction: column; // 000Bo
        justify-content: center;
        align-items: center;
      }
        
      .center-div {
        width: 80vw;
        height: 80vh;
        background-color: rgb(102, 71, 255);
        border-radius: 15px;
        padding: 5px;
        box-sizing: border-box;
        color: white;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
      }

      @media only screen and (min-width: 1024px) {
        .center-div {
          width: 50vw;
        }
      }

 /*     @media only screen and (max-width: 1024px) {
        .center-div {
          width: 80vw;
        }
      }*/

      #bpFull { 
        width: 100%;
        height: 100%;
        border: none;
        overflow: auto; /* Allow iframe to be scrollable */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling for iOS Safari */
      }
    </style>
  </head>

  <body>

    <script src="https://cdn.botpress.cloud/webchat/v2.3/inject.js"></script>
    <script src="https://files.bpcontent.cloud/2025/04/08/22/20250408222838-XXXXXXX.js"></script>
<script>
  document.addEventListener("DOMContentLoaded", function () {
    setTimeout(() => {
      botpress.open();
    }, 500); // Attends 0,5 seconde
  });
</script>
  </body>
</html>
f
b
The script window.botpressWebChat.init does'nt work on chatbot V2
f
It looks to work on my side:
Copy code
<script src="https://cdn.botpress.cloud/webchat/v2.3/inject.js"></script>
<script defer>
          window.botpress.init({
  "botId": "XXXX",
  "configuration": {
    "botName": "XXXX",
    "botAvatar": "XXXX",
    "website": {
      "title": "XXXX",
      "link": "XXXX"
    },
    "email": {},
    "phone": {},
    "termsOfService": {
      "title": "XXXX",
      "link": "XXXX"
    },
    "privacyPolicy": {
      "title": "XXXX",
      "link": "XXXX"
    },
    "color": "#4d04c4",
    "variant": "solid",
    "themeMode": "light",
    "fontFamily": "inter",
    "radius": 1,
    "showPoweredBy": false
  },
  "clientId": "XXXX"
});
        </script>
b
Yes thank's it worked
But when i add the command line to enable de sound, the sound doesn't work
Copy code
<script src="https://cdn.botpress.cloud/webchat/v2.3/inject.js"></script>
<script defer>
          window.botpress.init({
  "botId": "XXXX",
  "configuration": {
    "botName": "XXXX",
"disableNotificationSound": false,
    "botAvatar": "XXXX",
    "website": {
      "title": "XXXX",
      "link": "XXXX"
    },
    "email": {},
    "phone": {},
    "termsOfService": {
      "title": "XXXX",
      "link": "XXXX"
    },
    "privacyPolicy": {
      "title": "XXXX",
      "link": "XXXX"
    },
    "color": "#4d04c4",
    "variant": "solid",
    "themeMode": "light",
    "fontFamily": "inter",
    "radius": 1,
    "showPoweredBy": false
  },
  "clientId": "XXXX"
});
        </script>
f
Maybe try to put this line outside of the configuration part? I did you replace the XXXX with you own stuffs?
b
Yes i replaced the XXX, all working but the sound no
f
Maybe try to put the
"disableNotificationSound": false,
somewhere else in the JSON, I mean outside of the
configuration
?
b
It's not working outisde the configuration Did it worked for you ?
w
I'm afraid but i think this is not an option for new version
b
😫
w
1. create a functio on your website/app to play the sound 2. in the bot using hook send a custom event from webchat to page 3. create a listener for the event on your website/app that exceute your function
c
Hey team, any out-of-the-box solution for this? is annoying to do a custom development when all webchats I have worked with in my life offer this. Even the support chat on botpress does the sound 🥴
b
Hello @prehistoric-airplane-85682 , is it possible ?
4 Views