"Call-service API error. Error Message: extra keys not allowed @ data['sound']"

Just trying to add one of the pre-installed iOS notifications to the notify jSON and I get this error…? Any help is greatly appreciated.

Switch is On/Off and the change rule is turning On/Off into Open/Closed for the notification.

My jSON is simply:

{
"title":"Sensor: {{ data.old_state.attributes.friendly_name }}",
"message":"State: {{payload}}",
"sound":"US-EN-Alexa-Back-Door-Opened.wav"
}

This is saying that sound is not a supported parameter.

If you look at the documentation here you can see that the sound parameter needs to be in the data dictionary. So you need to change your json to the following:

{
"title":"Sensor: {{ data.old_state.attributes.friendly_name }}",
"message":"State: {{payload}}",
"data":{ "sound": "US-EN-Alexa-Back-Door-Opened.wav"}
}

Have yet to test but thank you very much! This answer might have solved a bunch of other data[] issues I’ve had, or at least pointed me in the direction to start looking. Cheers!

No longer receiving any errors, but the preloaded ios app sound isn’t being pushed to my phone as a notification sound? Still getting the standard ding of a notification… Any thoughts?

Maybe lets take a step back.

I am not sure which service you’re using, I am using notify.mobile_app_ service and my mobile app is the 2.0 beta version.
The following code gives me desired results (as far as sound). I can’t use your exact code. but this is good enough.

{
"title":"Test",
"message":"Test",
"data":{ "sound": "US-EN-Alexa-Back-Door-Opened.wav"}
}

If you copy/paste this json block into home assistant and call the service do you get the desired result?

SD card died on me… Let me get the system back up and I’ll give it a test and respond. Thanks for following up!

Bringing back old topic - same debugging. Feel like I am missing something simple, like a space… ugh

when I put this into developer tools, services - I get the notification. as expected:

 {
 "title":"test",
 "message":"message",
 "data":{ "sound":"US-EN-Alexa-Garage-Door-Opened.wav" }
 
 }

However, in node red, I get API error with following payload in a function node (trying to build out a template for dynamic use)

var payload = {"title":"test","message":"message","data":{ "sound":"US-EN-Alexa-Garage-Door-Opened.wav" }}
msg.payload = payload
return msg

flow:

[{"id":"3b0f5d3f.da4942","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"b2174036.73bfb","type":"inject","z":"3b0f5d3f.da4942","name":"","topic":"","payload":"test","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":100,"wires":[["59e9e428.2351dc"]]},{"id":"f8401ce2.b84a7","type":"api-call-service","z":"3b0f5d3f.da4942","name":"test IOS","server":"2a12269e.94634a","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_paul_xs","entityId":"","data":"{{msg.payload}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":620,"y":100,"wires":[[]]},{"id":"59e9e428.2351dc","type":"function","z":"3b0f5d3f.da4942","name":"Create Alexa Alert","func":"var name = \"IOS Alert Template: \"\n\nvar message1 = \"Beging message here \" \nvar message2 = flow.get('friendly_name')  \nvar message3 = \"End of message here\"\nvar sound = \"US-EN-Alexa-Garage-Door-Opened.wav\"\n\n\nvar final_msg = `${message1}` + `${message2}` + `${message3}`\nvar payload = {\n    \"title\":\"test\",\"message\":\"message\",\"data\":{ \"sound\":\"US-EN-Alexa-Garage-Door-Opened.wav\" }\n    \n}\nmsg.payload = payload\nreturn msg","outputs":1,"noerr":0,"x":330,"y":100,"wires":[["f8401ce2.b84a7","5aa00df6.b8abd4"]]},{"id":"5aa00df6.b8abd4","type":"debug","z":"3b0f5d3f.da4942","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":530,"y":160,"wires":[]},{"id":"2a12269e.94634a","type":"server","z":"","name":"Home Assistant1","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

Debugged my own problem. Needed to add {“data”}: before “title”

Function:

var payload = {"data":
{
    "title": "test",
    "message": "message",
    "data": {
        "sound": "US-EN-Alexa-Front-Door-Opened.wav"
    }
}
}
2 Likes