- Open the notification (by clicking it or pressing Enter / Space)
- Dismiss the notification (by clicking ×)
- Open Webchat using the FAB (which dismisses the notification automatically)
You will need:
- A published bot
- Familiarity with HTML, CSS and JavaScript
Step 1: Add a Hook to your bot
- In the Studio, navigate to the Hooks section.
- Select Create Hook and set its type to Before Outgoing.
- Paste the following code into the Hook:
Step 2: Configure your website
Now, you can configure your website to display the notification bubble.Add the bubble HTML element
First, add the bubble element somewhere in your website’s HTML:Add JavaScript
Then, add the following snippet to your website’s JavaScript:- Displays the message received from the event’s payload
- Remains visible for 15 seconds before automatically closing
- Can be selected by clicking or pressing Enter / Space
Add CSS
Finally, add this CSS snippet to your website’s stylesheet:Now, your website will display a notification bubble when your bot sends a new message.