Firebase Push Notification via HTTP Node

How to use this Below cURL Format in HTTP Request Node

curl -X POST -H "Authorization: key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" -d '{
  "notification": {
    "title": "Hello World",
    "body": "Test Push",
    "icon": "https://example.com/assets/icons/Icon-48.png",
    "click_action": "https://example.com"
  }
  "registration_ids": ["eUhmaO_NNL88ZoMSfE3eE8:APA91bFfIolITf2y4dn5o-6m-TregQFhVSy1iNn6RnXX3c2Y6yMPi_fkVzEcavzZ4oV9jAT2cGdItZ-D8N-fR4kXX_CXOInT5ZtcSb_rqWy8kWgb42fgJETlgL-xwHmTissNzUgG-gqc", "eDFeL9gn8rLQVG8W-O09CN:APA91bGCssz7IMdaexXRCx-SFTRDO3X0LEiYWrzVbAydIHln3456Z3ENLAERFzV-lnrhLhjTQGzP_uFDUW406dGJjMOtp_j5rRxhrlQgchyX3mZV4MEIfRhohjxboTBpiXC54zXeCDqG"]
}' "https://fcm.googleapis.com/fcm/send"
1 Like

Hey @mskian!

I am sharing an example that might help you.

I have set the Authentication method to Header Auth and I am configuring my Server Key. The below image should help you better understand how I have set my credentials.

The JSON in the body might be different for you, depending on the content.

I hope this helps! :slightly_smiling_face:

3 Likes

@harshil1712 Thanks a Lot Perfect :100:

2 Likes

This API calling method is deprecated and no longer recommended. Instead, I suggest using the Oauth2 approach for authentication and the latest version of Firebase Cloud Messaging (FCM). You can find more information about the new version here: FCM REST API Reference.

To implement this solution, follow these steps:

  1. Create an Oauth2 API Credential. Here’s an example screenshot:
  2. Set up the HTTP request with the following settings:

    Here’s a sample body template (replace the ‘sample token’ with the user ID you want to target):
{
  "validate_only": false,
  "message": {
    "token": "cEb141NmHELjrPmZ:APA91bGEzoPt4RHMnkSUiVJFw0uWcmE_XiJMk-RE6jWcw1V2pFjbKBQQNMpRKKMZKhphanXRSCCDlR4TcaxQrITTZS08gQ7GId0tf973uVTVUW5Gx4jc6BvM9tl0uuxq_uONGH_Ge",
    "data": {
      "key1": "value1"
    },
    "notification": {
      "title": "New Message",
      "body": "Hello from FCM!"
    }
  }
}
2 Likes

Thank for this let me check it out

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.