Azure / azure-notificationhubs-android

Android SDK and Samples for Azure Notification Hubs
Apache License 2.0
33 stars 62 forks source link

Registering template with nested payload #308

Open mrzslr opened 3 weeks ago

mrzslr commented 3 weeks ago

Query/Question

In Android(FCM v1)/APN, How is it possible to register with a nested template? for example, I want the notification I send have some other properties in nested form, i.e

{ "message": "Simple notification message" "object1":{ "prop1": "value 1", "prop2": "value 2" } For Android, I have:

String templateBody = "{\"message\":{\"android\":{\"data\":{\"message\":\"$(message)\",\"object1\":{\"prop1\":\"$(prop1)\", \"prop2\":\"$(prop2)\"}}}}}"; it gets registered, but not receive notifications when I do send JSON body notifications with REST API in Postman like this:

{ "message": "Simple notification message", "object1": { "prop1": "value 1", "prop2": "value 2" } }

If I don't use nested objects after message and just use a property, I'll work fine. What could go wrong here?