I have few doubts regarding sending SNS Push Notifications.
1) I referred this stackoverflow discussion where we can set sound for APNS. But how we do it for GCM ?
2) How to configure no sound alert ?
3) Is it possible to set sound for each Endpoint in PHP while creating them ? I just want to know this so that while sending message I can send to those with sound enabled and to those disabled while sending it with topicARN.
4) I referred this document for getting the delivery status of push notification as logs in cloudwatch. Is there any API to retrieve the delivery status of those endpoints which failed to receive in PHP ?
Amazon Simple Notification Service (SNS) sends notifications two ways, A2A and A2P. A2A provides high-throughput, push-based, many-to-many messaging between distributed systems, microservices, and event-driven serverless applications.
To stop these, open the Amazon app on your phone, open the menu, and tap “Settings”. Tap the “Notifications” option in the list. Disable the types of notifications you don't want to receive. For example, if you disable “Shipment Notifications”, you won't get a notification when Amazon ships you a package.
SNS is typically used for applications that need realtime notifications, while SQS is more suited for message processing use cases. SNS does not persist messages - it delivers them to subscribers that are present, and then deletes them. In comparison, SQS can persist messages (from 1 minute to 14 days).
The Fanout scenario is when a message published to an SNS topic is replicated and pushed to multiple endpoints, such as Kinesis Data Firehose delivery streams, Amazon SQS queues, HTTP(S) endpoints, and Lambda functions. This allows for parallel asynchronous processing.
For GCM, you can do like this:
$send = $sns->publish(array(
'TargetArn' => $EndpointArn, // to send notification to single user
'MessageStructure' => 'json',
'Message' => json_encode(array(
'default' => '',
'APNS' => json_encode(array(
'aps' => array(
'alert' => 'message to topic',
'sound'=> 'default',
'badge'=> 1
),
'userid' => '1'
)),
'GCM' => json_encode(array(
'data' => array(
'alert' => 'message to topic',
'userid' => '1'
),
))
))
));
Do you want to create a custom sound alert for each endpoint arn?
For 4th point refer this links:
1) http://docs.aws.amazon.com/sns/latest/dg/sns-msg-status.html?ref_=pe_411040_132389510
2) How to confirm delivery status when using amazonSNS mobile push?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With