Skip to content

Instantly share code, notes, and snippets.

@drulabs
Last active June 14, 2023 15:27
Show Gist options
  • Save drulabs/c9f6802790c92d74cb7eb2427097899a to your computer and use it in GitHub Desktop.
Save drulabs/c9f6802790c92d74cb7eb2427097899a to your computer and use it in GitHub Desktop.
Curl command for sending FCM message
curl -i -H 'Content-type: application/json' -H 'Authorization: key=<your_server_key>' -XPOST https://fcm.googleapis.com/fcm/send -d '{
"registration_ids":["registration_ids", "of the", "target", "devices as array"],
"notification": {
"title":"Title of your notification",
"body":"content of your notification"
},
"data": {
"key1" : "value1",
"key2" : "value2",
"key3" : 23.56565,
"key4" : true
}
}'
@tyoc213
Copy link

tyoc213 commented Nov 6, 2018

should the values of the your_server_key and registration_ids need to be escaped?

No because of -d '{...}'

@Pitala
Copy link

Pitala commented Sep 20, 2019

Is there a way of adding a custom image to the message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment