Android Question Using windows Curl command line utility for send Firebase notifications

Wolodymyr

Member
Hi for all
Erel's b4j-sendingtool-zip working great, but may be anybody know way to use CURL (already built in installed in windows 10) to send such messages?

I cannot found ready to use guide to build command line parameters for CURL yet. We must use only 4 incoming parameters: API_KEY (firebase server key for your project), topic name, title and body.
 

DonManfred

Expert
Licensed User
Longtime User

 
Upvote 0

Wolodymyr

Member
Main problem was because JSON part must use double quotes as special symbols like <\">, so simplest method is to use external file with ready to use JSON part
Example for sending messages by topic name "general". Launching b4j-sendingtool take about two seconds to arrive messages, CURL - about one second
curl -H "Content-type: application/json;charset=UTF-8" -H "Authorization:key=<CHANGE-TO-YOURS-FIREBASE-SERVER-KEY>" -X POST -d @jsondata.txt https://fcm.googleapis.com/fcm/send

--jsondata.txt--
{"data":{"title":"CURL test","body":"CURL sending is working!!"},"to":"\/topics\/general"}
 
Upvote 0
Top