I want to send a json payload to Windows phone 7+ in push notification. I am using MPNS. I am using AWS SNS service for sending push notification. IF i am sending a String payload .Everything works for string payload. I got stuck with Json payload.
paylaod = {default: "None", MPNS: "<?xml version=\"1.0\" encoding=\"utf-8\"?><wp:Notification xmlns=\"WPNotification\"><wp:Toast><wp:Text1>SNS Test Message</wp:Text1></wp:Toast></wp:Notification>"}
resp = SNS.publish( target_arn: "arn:aws:sns:usXXXb64", message: paylaod.to_json, message_structure: 'json')
I'm awfully unfamiliar with the Ruby language, but it seems to me that your call lacks message attributes, which are mandatory for JSON-based MPNS messages.
The two attributes are as follows:
For reference, the attributes are the following:
Attribute name:
AWS.SNS.MOBILE.MPNS.TypeType: string
Possible values:
token(for tile notifications),toastorrawAttribute name:
AWS.SNS.MOBILE.MPNS.NotificationClassType: string
Possible values:
realtime*,priority,regular(realtime worked for me with the Java SDK)So your last line should look like this:
Note that the
message_structure: 'json'line is equally important.