We're following this tutorial: How To: Windows Azure Notification Hubs (Android Apps) for Android.
Everything works fine when structuring the notification payload as described in the guide. That is:
{
"data": {
"msg": "$(property1)"
}
}
However, we'd like to extend the template to use more than one custom property in the payload. Something like:
{
"data": {
"msg": {
"message": "$(property1)",
"sender": "$(property2)"
}
}
}
where the back-end supplies the property values via:
Dictionary<string, string> templateValues = new Dictionary<string, string>
{
{ "property1", "Hello world" },
{ "property2", "foo" }
};
NotificationOutcome notificationOutcome = await Hub.SendTemplateNotificationAsync(templateValues, "test");
When registering the template in the notification hub from the mobile app we receive the following error:
"Supplied notification payload is invalid"
- Can several properties be used in the template?
- Should we send the property value (from the back-end) as a JSON (or other structure) string instead? What is the preferred approach? We will use the template on multiple platforms (iOS, Android)
Thanks in advance