Send test FCM push notification with Amazon SNS

If you’d like to test your Firebase push notifications service or you’re considering to use another push notifications service provider you should take a look at Amazon Simple Notification Service.  You can use Amazon SNS for sending example push notifications via Firebase Cloud Messaging to your mobile application.

In this short example I’ll show you how you can send a message to a specific user of your Android application. So far I couldn’t find a solution to send messages to Firebase topics subscribers but at least you don’t have to deal with OAuth tokens.

It’s just a simple showcase for manual single push notification sending. Using Amazon SNS makes more sense when you’re having multiple topics and platforms to handle. Then you should use SNS topics and provide proper data to it.

Let’s go

  • Create SNS platform application and provide proper Firebase Cloud Messaging credentials (from your Firebase console, go to Project settings -> Cloud Messaging -> Server key).
  • Create an endpoint
    If you’re storing your device tokens in Firebase database you can use it here.

  • Test your endpoint
    After endpoint creation you can test it. Press the Publish message button.
    Select Custom payload for each delivery protocol option.

    The most important part here is to provide proper body message. It has changed since previous Google Cloud Message service. Please take a note that example provided by Amazon is no longer valid.

Now you should use this message:

{"GCM": "{ \"notification\": { \"text\": \"Hello. This is text message. Enjoy!\" } }"}

Click on the Publish message button. And that’s it. Your notification should already be delivered. Enjoy!

One thought on “Send test FCM push notification with Amazon SNS”

Leave a Reply

Your email address will not be published.