Sound Options for Push Notifications

ctsmith
Mega Sage

In Push Notification Message Content, part of code is this:

(function buildJSON(/*GlideRecord*/ current, /*String*/ message, /*Object*/ attributes) {

var json = {};

json = {
"aps" : {
"sound" : "default",
"category" : "accept_decline_foreground"
},

I've never seen anything other than "sound" : "default" in postings or existing content records on our instance.

I had a ticket with HI, and they intoned that was a reference to the instance sound table.  There is no default sound in there.  And that wouldn't necessarily make sense as this is for a push notification that triggers sounds local to the user's device, right? 

If that is the case, though, can I simply add whatever sound I want to the sound table and replace "default" with the name of that new sound and that sound will push to the iOS and Android devices?  Doesn't seem plausible, but... 

What are the options here with sound for push notifications?

The scenario is that we want to have a better notification sound for push notifications other than the iOS standard sound.  Is that an option?  We will be using the app for paging purposes, and that generic sound isn't going to cut it.  Our current paging app has built in sounds that are more annoying (which is good so the user knows they're getting a page).  Can the native SN app use customized sounds for notifications in any capacity?

Thanks!

8 REPLIES 8

bala37
Kilo Contributor

okk thank you

neofait
Tera Contributor

For adding sound options to push notifications in ServiceNow, consider exploring various audio alerts to enhance user engagement and response times. Customizable sound alerts can make notifications more noticeable and effective.

I

Joel Stevenson
Tera Contributor

The correct settings for the different sounds is "soundName.caf". So for NotificationAlert-1 the json would be:

 

"sound": "NotificationAlert-1.caf"

elemonnier
Tera Expert

The only way I was able to change the sound is this. And there was only one different sound available. Everything else results in the same sound.

(function buildJSON( /*GlideRecord*/ current, /*String*/ message, /*Object*/ attributes) {
    var layoutFields = {
        "Identifier": "u_component",
        "Description": "u_name",
        "Status": "u_severity"
    };
    var push_json = new global.ActionablePushPayloadBuilder(current, "0fb9402e1b3d20502b330feddc4bcbea", layoutFields).buildJSON();
    push_json['aps']['sound'] = 'NotificationAlert-4.caf';
    return push_json;
	
})(current, message, attributes);

 Maybe in the many years since I did this, they added more sounds.