Chat SDK Javascript
v2
Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
Desktop Push Notifications
AI Tools
Copy Markdown
Open in ChatGPT
Open in Claude
You can create your own desktop notification by using newMessageCallback, for example:
// Show a nofication when receiving new message from Qiscus Chat SDK
qiscus.init({
AppId: 'YOUR_APP_ID',
options: {
// For documentation about event handler in Qiscus Chat SDK
// you can read it here
// http://sdk.qiscus.com/docs/web#event-handler
// and for more information about message object\
// you can just inspect it with your prefered devtools
// or even just doing `console.log` it.
newMessageCallback: function (messages) {
// Here you can setup a notification to notify your user,
// You can use a desktop notification, or simply
// modifying browser title
const message = messages
showDesktopNotification(message)
}
}
})
// For example showing a desktop notification for every new message
// docs: https://developer.mozilla.org/en-US/docs/Web/API/notification
function showDesktopNotification (data) {
if (Notification.permission() !== 'granted') {
Notification.requestPermission()
}
var username = data.username
var useravatar = data.user_avatar
var message = data.message
var notification = new Notification('You get a new message from ' + username, {
icon: useravatar,
body: message
})
}
Last updated on
Was this page helpful?
Next to read:
Change logQiscus Technology
Discard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message