I'm dev-ing nodejs server for push server. so I downloaded private key and set up this file. but I faced with some problems. as I see many examples, there is a token. I realized that token is for sending to specific device. but I wanna send all devices.
const admin = require('firebase-admin');
const serviceAccount = require('./firebase_account/firebase_account.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "url"
});
const registrationToken =""
const payload={
notification:{
title:"title",
body:"body"
}
}
admin.messaging().sendToDevice(registrationToken,payload,"")
.then(function(response){
console.log(response)
})
.catch(function(error){
console.log(response)
})