This article assumes that you have Firebase Cloud Messaging client app on Android registered for notifications and handling the receipt of a message. You would need following information to test and verify the Push notification using POSTMAN-
1. FCM endpoint: https://fcm.googleapis.com/fcm/send , your app server must direct all HTTP requests to this endpoint. POSTMAN will act as a app server.
2. Server key: A server key that authorizes your app server for access to Google services, including sending messages via the Firebase Cloud Messaging legacy protocols. You obtain the server key when you create your Firebase project. You can view it in the Cloud Messaging tab of the Firebase console Settings pane.
3. Registration token: A unique token string that identifies each client app instance. The registration token is required for single device and device group messaging. Note that registration tokens must be kept secret. You can get this from your DB.
Once you have these 3 values ready, you can test the PUSH Notification using POSTMAN.
>> Open POSTMAN and create a POST request with endpoint as https://fcm.googleapis.com/fcm/send.
>> Add Headers with Key “Authorization” and “Content-Type” with values key=<replace with Server key> and application/json respectively.
>>Add the below JSON content to Body
{
“to”:”Aswdfaas_asdfwgpg:APyteYTYRihjkkrU-CTjhghjjkh3234523HYGFJuughjft6yYUUIgjhguy6tfgkjg6ytU&y3Caml”,
“notification”: {“body”: “This is test push notification message”}
}
The POSTMAN POST message will look like this-
Click on SEND. Check the response Body, if everything goes right then the response should be something like this-
You can also test the PUSH notification using AWS SNS service. You have to create platform application in AWS SNS.
>> To create FCM platform application in AWS SNS, provide application name, select FCM from Push Notification platform drop-down, enter the Server Key value in API key field.
>> For logging of delivery status, select IAM roles in “Delivery status logging” option. You can use existing role or create new role to provide access to cloudwatch. Then click Create Platform Application.
>> Select the newly created platform and create application endpoint using the Registration token of the client app. It will appear like this once added-
>>To send PUSH notification, select the radio button in front of the Endpoint and click Publish Message.
>>Please the JSON format message in Message body and click Publish Message.
>> Successful notification message will show
>>The same can be verified on CloudWatch logs