Firebase Cloud Messaging

Other topics

Sending Downstream Messages via cURL

You can test sending messages using the FCM REST API by sending a request through cURL.

curl --header "Authorization: key=<API_KEY>" \
       --header Content-Type:"application/json" \
       https://fcm.googleapis.com/fcm/send \
       -d "{\"registration_ids\":[\"ABC\"]}"

Syntax retrieved from here.

The API_KEY indicated above is referring to the Server Key that can be seen in your Firebase Console's Cloud Messaging Tab.

The part where:

"{\"registration_ids\":[\"ABC\"]}"

is, can be replaced with your own payload. See the FCM HTTP Protocol Documentation for more details.

Sending Downstream Messages using Postman

To do this in Postman, you simply have to set the following:

  1. Set request type to POST
  2. In the Headers, set the following:
  3. Set the payload parameters in the Body (in this example, we used the raw option, see screenshot (2))
  4. Send the request to https://fcm.googleapis.com/fcm/send

Screenshots:

(1) enter image description here

Note: Always keep your Server Key a secret. Only a portion of my key is visible here so it should be fine.

(2) enter image description here

(3) enter image description here

Notice that the request was a success with the message_id in the response.

Contributors

Topic Id: 8242

Example Ids: 26480,26577

This site is not affiliated with any of the contributors.