Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting an error in one signal push notification : contents must be key/value collections by language code

I'm trying to set as a simple message to the contents field in onesignal request body. And I'm getting an error message "contents must be key/value collections by language code".

ObjectNode jsonMessage = Json.newObject();
jsonMessage.put("contents", "{\"en\": \"English Message\"");

Push Response******** {"errors":["contents must be key/value collections by language code"]}

like image 883
Nik Avatar asked Oct 25 '25 00:10

Nik


1 Answers

Make sure you format the JSON string correctly, e.g:

{"en": "English Message", "es": "Spanish Message"}

Reference

like image 75
Rodrigo Gomez-Palacio Avatar answered Oct 27 '25 15:10

Rodrigo Gomez-Palacio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!