FCM Payload Builder
Build a correct Firebase Cloud Messaging HTTP v1 message for Android and iOS without digging through the docs, then copy the JSON or a ready-to-run cURL command.
{
"message": {
"token": "DEVICE_FCM_TOKEN",
"notification": {
"title": "Your order is out for delivery",
"body": "Arriving in about 20 minutes."
},
"data": {
"order_id": "20481"
},
"android": {
"priority": "high",
"ttl": "3600s",
"notification": {
"sound": "default"
}
},
"apns": {
"headers": {
"apns-priority": "10",
"apns-push-type": "alert"
},
"payload": {
"aps": {
"sound": "default"
}
}
}
}
}cURLcurl -X POST "https://fcm.googleapis.com/v1/projects/YOUR_PROJECT_ID/messages:send" \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-d '{"message":{"token":"DEVICE_FCM_TOKEN","notification":{"title":"Your order is out for delivery","body":"Arriving in about 20 minutes."},"data":{"order_id":"20481"},"android":{"priority":"high","ttl":"3600s","notification":{"sound":"default"}},"apns":{"headers":{"apns-priority":"10","apns-push-type":"alert"},"payload":{"aps":{"sound":"default"}}}}}'Notifications showing up late? Read what actually controls push delivery speed. Getting an iOS token error? See how to fix “No APNS token specified”.
Send to segments, not tokens
notifySphere sends through FCM for you, with audience segments, scheduling, delivery and open tracking, and WhatsApp in the same dashboard. Free up to 1,000 users.
Try notifySphere freeFrequently asked questions
What's the difference between notification and data in an FCM message?
The notification block is shown by the operating system automatically, even when your app is closed. The data block is a set of key-value pairs passed to your app's code, for example an order ID to open the right screen. You can send both in one message.
Why must FCM data values be strings?
The HTTP v1 API only accepts string values in the data map. Numbers and booleans are rejected with an error, so convert them to strings, as this builder does, and parse them in the app.
How do I make an FCM notification arrive immediately?
Set Android priority to high and the APNs priority header to 10. Normal priority messages can be delayed while the phone is idle. See why push notifications arrive late for the full list of causes.
How do I get an access token for the HTTP v1 API?
Use a service account from your Firebase project. For testing, gcloud auth print-access-token works with an account that has the Firebase Cloud Messaging permission. In production, your server library (such as firebase-admin) gets and refreshes tokens for you.
More free tools: Push Notification Preview · All tools