This is something new i am asking as i haven\'t got it any answers for it on SO.
I am using Amazon SNS Push for sending push to my registered devices, everything is
The Amazon SNS documentation is still lacking here, with few pointers on how to format a message to use a custom payload. This FAQ explains how to do it, but doesn't provide an example.
The solution is to publish the notification with the MessageStructure parameter set to json and a Message parameter that is json-encoded, with a key for each transport protocol. There always needs to be a default key too, as a fallback.
This is an example for iOS notifications with a custom payload:
array(
'TargetArn' => $EndpointArn,
'MessageStructure' => 'json',
'Message' => json_encode(array(
'default' => $title,
'APNS' => json_encode(array(
'aps' => array(
'alert' => $title,
),
// Custom payload parameters can go here
'id' => '123',
's' => 'section'
))
))
);
The same goes for other protocols as well. The format of the json_encoded message must be like this (but you can omit keys if you don't use the transport):
{
"default": "",
"email": "",
"sqs": "",
"http": "",
"https": "",
"sms": "",
"APNS": "{\"aps\":{\"alert\": \"\",\"sound\":\"default\"} }",
"APNS_SANDBOX": "{\"aps\":{\"alert\": \"\",\"sound\":\"default\"} }",
"GCM": "{ \"data\": { \"message\": \"\" } }",
"ADM": "{ \"data\": { \"message\": \"\" } }"
}