Customize the notifications behavior
You can change how the Messenger notifies the user when there is a new message waiting for them. By default, the Messenger will:
- Play a notification sound (chime) if the window tab of the Messenger is in focus.
- Rotate the page title of the Messenger window, no matter whether it's focused or not.
Change the sound
To change the sound, pass the path of a sound file to the notificationOptions.notificationSound
property. If you leave it empty, the Messenger will play the default chime sound.
If you pass a null
value, no sound will be played at all.
1
2
3
4
5
6
<Messenger
publicKey='your-public-key'
notificationOptions={{
notificationSound: 'https://upload.wikimedia.org/wikipedia/commons/4/48/Mudchute_cow_1.ogg'
}}
/>
Change the page title
To change the <title/>
of the Messenger window, pass a string to the notificationOptions.pageTitle
property. The default value is [You have a new message]
.
If you pass a null
value, the page title will not change.
1
2
3
4
5
6
<Messenger
publicKey='your-public-key'
notificationOptions={{
pageTitle: '📢 New message!'
}}
/>