Closed Suven closed 7 years ago
Do you try insert a prop title in your Notification object?
notification: {
title: 'YOUR TITLE',
body: 'YOUR MESSAGE'
},
Yup, also tried that :/ The strange thing is that the response would always be successfull, even if I directly send it to one device. It's like firebase is ignoring ios.
I just tested it via Postman and Curl and have the same problem.
Feel free to close this then, as it does not seem to be related to that module :/
Edit:/ I found the issue. The priority-flag does NOT belong into the notification-object, but into the root-object. 😅 Thanks for your help.
So just for anybody else who might find this through google, here is the working example:
var FCM = require('fcm-node');
var fcm = new FCM('YOURKEY');
var topic = 'YOURDEVICEKEY';
// topic = '/topics/test';
var push = { text: 'foo' };
fcm.send({
to: topic,
priority: 'high',
notification: { body: push.text },
}, function (error, response) {
if (error) {
winston.warn('A pushmessage could not be send', { error });
return;
}
winston.info('Push was send', response);
});
I am having the same issue. I also want to send the payload along with title and body, how can I achieve that?
Hey,
I have the following behaviour: iOS-Users receive messages send through the firebase-console BUT not send via the script. Android-Users receive both.
I tried it with single-device-targeting, topic-targeting and with/without priorities.
Is there anything else to be aware of? Are pushes send from the HTTP-API using the dev-cert instead of the prod-cert?
I really would appreciate a working example.. Here is my test-script: