Ionic+Capacitor Push Notifications via Amazon SNS - amazon-web-services

How to use Ionic+Capacitor to register Push Notifications via Amazon SNS
Any guide on how to properly use ionic and capacitor to acquire tokens for SNS? I’ve seen the PushNotifications plugin but I’m not sure what “register” does? Do i have to setup my firebase and apn if im only using Amazon SNS?
Any guide/tips or overview steps will be useful.
Thanks

Hoping this would help anyone starting their Ionic+Capactior + FCM/APN + Amazon SNS journey
Device Token Setup
Follow this guide: https://capacitorjs.com/docs/guides/push-notifications-firebase. Follow all of them except all of the iOS Firebase ones (unless youre planning to use FCM to push to iOS as well)
Everytime the plugin runs, it should return a device token, log that or save that somewhere.
SNS Platform Setup
Feel free to follow any guide that teaches you how to create an FCM endpoint and an APNS endpoint. They're pretty straightforward, Cloud Messaging URL for FCM and a .p8 APNS key for iOS.
SNS Endpoint
Open your created platform application and Create a new endpoint, just chuck in the device token from the plugin. FCM and APNS have different token formats, APNS are mostly alphanumeric and all caps, while FCM are with special chars and mix of capital and small letters.
Of course this is just to establish a base point, I'm still working on trying to make them into services to actually push notifications via code. Good luck!

Related

AWS SNS in Flutter

I wonder if maybe anyone has worked with aws push notifications with flutter for ios, android and huawei platforms. If so, what plugins have they used?
If you have documentation on this topic, I would appreciate it if you share it.
You can use SNS Mobile Push notification in IOS & Android, but not in < Huawei > as I know !!
Visit this docs to understand more: https://aws.amazon.com/sns/faqs/#Mobile_push_notifications
SNS Mobile Push lets you use Simple Notification Service (SNS) to deliver push notifications to # Apple, Google, Fire OS, and Windows devices, as well as Android devices in China with Baidu Cloud Push # . With push notifications, an installed mobile application can notify its users immediately by popping a notification about an event, without opening the application.
AWS Amplify for Flutter
AWS Amplify announces its support for the Flutter framework.
AWS Amplify offers a variety of services such as Authentication, including third party/social media log in, push notifications, storage, GraphQL, Datastore, REST API, Analytics, PubSub, and more.
Visit this article : https://medium.com/flutter-community/aws-amplify-for-flutter-ed7890f75493
AWS amplify do not support notification for flutter.
You can link AWS SNS with your firebase messaging conf and got notification through Firebase notification.
Very good post / tutorial : https://medium.com/iiitians-network/flutter-push-notifications-using-aws-sns-dac464c1edf0

Is it necessary to use Amazon SNS when using Firebase Cloud Messaging (FCM) on AWS to send notifications?

I have an existing mobile app that can receive push notifications and I have an existing backend application that exposes an API for sending notifications to the app. The backend application uses Firebase Cloud Messaging (FCM), so it could be considered a wrapper around FCM. My backend application uses the Firebase Admin SDK to create messages and send them to Firebase. My customers hit an API exposed by my backend application (so, if we assume that the customer is using Postman, then the flow for sending a message is: Postman->My backend application->Firebase->Mobile app).
Until now I have been running my backend application on a local server, and it works fine. But now I need to deploy this on AWS. My question is: is it necessary to use Amazon SNS or not? I don't really need any additional functionality from AWS, I just want AWS to permit the required communication.
For example, I dont need to go to an AWS interface to enter the token to send messages to my phone. I already have an API exposed through my backend for sending messages. So, should I even bother to set up SNS?
I know that at a minimum I will have to make my firebase project google credentials available to my instance on AWS (in a file located at the path specified using GOOGLE_APPLICATION_CREDENTIALS). What other configuration steps would be needed? Thanks a lot.
After some investigation I found that it is not necessary to use Amazon SNS to achieve what I wanted to achieve.
I was able to deploy my server application (which uses Firebase Cloud Message) to AWS, and the messages arrive on the mobile phones without any problem.
I initialized my backend application using the steps described on the Google Firebase site: https://firebase.google.com/docs/admin/setup

How does AWS SNS send Application notifications?

I have a React Native application that works on iOS and Android and I am looking to integrate AWS SNS. I have some questions that I hope people with SNS experience could answer.
From my understanding, AWS SNS is merely a gateway for using GCM (Android) and APNS (iOS)
Is this correct?
If the above is correct, imagine that I have an Android-only app, what's the point of using AWS SNS when I could directly use GCM/Firebase? I can even use Firebase with iOS.
My app needs to allow a single User to send a notification to one or more Users.
Is there an RESTful API I can consume to achieve this?
Or would I need to set up API Gateway and use Lambda functions?
How do I automatically store tokens on SNS?
I read that I have to integrate AWS Cognito for this, or use a Proxy Server.
Edit:
I've managed to write a Node.js server that uses the aws-sdk to communicate with SNS.
Questions corresponding to their above question numbers
Still looking for answers
Still looking for answers
I've written a Node server, I suppose I could embed the aws-sdk code into my React Native app as it can use Node APIs
For question #4 - I used createPlatformEndpoint
I am no specialist but given you have not received an answer yet, I thought I would try to help
you can use AWS SNS to send messages via GCM, but it can do much more, since it's a pub-sub service: for example, if can be configured to receive email complaints from mails sent by AWS SES, and then you get either either a lambda function or a queue (SQS) to receive those actions emitted by SNS, allowing you to act on them
for an Android-app only I don't see a good reason to bother, and even if it was also on iOS, you could configure yourself the sending of push notifications with an if/else in your code. I could argue it's a matter of personal taste, whether you want more configuration in your code vs in the infra-structure (I know the limit can get blurry), but it seems so much easier to keep it in the code that I wouldn't believe a word I said
My app needs to allow a single User to send a notification to one or
more Users.
If it's a user writing to 1 to a few users, like in a messaging app, I would say it's easier to define (and maintain) the logic within your app and iterate over the group of recipients to send the push notifications.
If you're going to have a few people who are going to be followed by thousands of people and needs to write to them, you might have a case for using SNS Topics (each "popular user" can write - maybe via your own api - to an SNS topic to which the "followers" subscribed; keep in mind the max number of topics you can create), as SNS will take care of any scaling issue (it can take time and resources to send a push notification to your 1 million followers)
What you said if you're going to user SNS, otherwise sending a push notification via GCM/FCM is as simple as a POST request.

Amazon simple notification service for web apps

I want to receive notifications using amazon simple notification service in my android,iOs and web apps. I found, how to enable this in android and ios, but could someone please help me that is it possible to do the same in my web app(node js)? If yes, then how??
Thanks
Have a look at the following gist -> https://gist.github.com/tmarshall/6149ed2475f964cda3f5
It shows you how to interface with SNS from a Node.js app.
And here is the documentation to the SDK itself - http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html
You would need to support receiving or subscribing to the SNS notifications in the web app. iOS and Android come with services to process push notifications, you would have to build this for your app.
You can send SNS to an http endpoint but it may be easier for you to send notifications to SQS for your node app to consume.
I can't find an npm package for subscribing to SNS but there is a good blog post here https://deepstream.io/blog/publishing-aws-sns-messages-to-browsers-tutorial/

Xamarin - How to add endpoints automatically to Amazon SNS

I am working on an Android and iOS app using Xamaring and I want to send push notifications via Amazon SNS.
But I don't know how it works exactly. In my case, the app is a kind of a chat, where there is a plenty of users sending messages to each other.
I wonder how to register automatically the device's token to the Amazon SNS.
Who register the token? The backend or the application side?
And how would I do that?
Note: I'm using NodeJS as backend.
Hopefully you've found it on your own, but the SNS documentation is pretty solid on this front. Work your way through all the docs before you begin. With a Node backend you'll be using the AWS JS library, which is also well documented.
Start here: AWS SNS Mobile Push
then read about token management