Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS SNS push notification clarification

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 ?

like image 621
Reaching-Out Avatar asked Mar 24 '16 15:03

Reaching-Out


People also ask

Is SNS push based?

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.

How do I manage push notifications on Amazon?

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.

What is simple notification service SNS and how is it different from SQS?

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).

How is fanout done in Amazon SNS?

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.


1 Answers

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?

like image 117
Pathik Vejani Avatar answered Oct 02 '22 13:10

Pathik Vejani