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:
- Create an Oauth2 API Credential. Here’s an example screenshot:
- 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!"
}
}
}