We have a React Native App which is trying to send push notifications using the Firebase Cloud Messaging Service. We are testing this using Insomina.
To do this, we are using a package called “react-native-push-notification” by zo0r.We’ve been able to obtain an iOS apn token from a real life apple device. We are then able to successfully send a POST request to this url:
https://iid.googleapis.com/iid/v1:batchImport
to convert the apns token into a registration token for Google’s firebase cloud messaging platform.
However, when we try and send a message using the converted token, by sending a POST request to this endpoint:
https://fcm.googleapis.com/fcm/send
using this JSON payload:
{"direct_book_ok": true,"to": "fTiQ5mg266o:APA91bGQN1s9sYJh9U_B6h1vuwAjpQVrPIJFnCWWsiv4PgKTCOCqLiKIdAD6ls48f-dBbnV3tOdc6NvTScXSRJYrXNHz_5QonSFraEau5jKSJPcw8HYeOb2YnutC39TlaIlKBnD3FpSx","notification": {"title": "Breaking News","body": "New Story available." },"priority": "high"}
AND these headers:
Authorization: key=<OUR_SECRET_KEY> and Content-Type: application/json
The Google API responds with the following error, indicating that the notification has failed because of an “invalid argument”.
{"multicast_id": 3503657462083604439,"success": 0,"failure": 1,"canonical_ids": 0,"results": [ {"error": "InvalidParameters: RpcError:INVALID_ARGUMENT" } ]}
How would we remedy this? We’ve tried both sandbox=true and sandbox false.