notifme / notifme-sdk

A Node.js library to send all kinds of transactional notifications.
https://notifme.github.io/www/
MIT License
1.94k stars 149 forks source link

FCM Config #89

Closed abhiburk closed 2 years ago

abhiburk commented 2 years ago

I when using FCM push Please help me for id params in the config. What is the value for id in the below fcm. I tried secret server key and other keys bit I am not sure

new NotifmeSdk({
  channels: {
    push: {
      providers: [{
        type: 'fcm',
        id: 'xxxxx'
      }]
    }
  }
})
pryme0 commented 2 years ago

I am currently facing the same issues ..i have checked around the web for pointers but resources on this are scarce

abhiburk commented 2 years ago

I did something like this and it worked

push: {
    providers: [{
      type: 'fcm',
      phonegap: false,
      id: process.env.FCM_SERVER_KEY
    }]
},
pryme0 commented 2 years ago

okay..let me try that out

pryme0 commented 2 years ago

I get this error from my console when i try to sen a notification .

Error: Unknown registration id","stack":"Error: Error: Unknown registration

{ status: 'error', channels: { push: { id: undefined, providerId: 'push-fcm-provider' } }, errors: { push: 'Error: Unknown registration id' } }

this is how the send method is configured

await notify.send({ push: { id: 'xxxx', registrationToken: 'xxxxxxx', title: 'Hi John', body: 'Hello John! How are you?', icon: 'https://notifme.github.io/notifme-sdk/img/icon.png', }, }) Also what values am i supposed to use for the registrationToken and id in the send function?