decision-labs / fcm

Ruby bindings to Firebase Cloud Messaging (FCM) for Android, iOS or Web
MIT License
511 stars 156 forks source link

Please tell me how I can implement web push #127

Open m7madmagdy opened 1 day ago

erimicel commented 15 hours ago

You can do something like this I believe:

message = {
  'token': "000iddqd", # send to a specific device
  'data': {
    payload: {
      data: {
        id: 1
      }
    }.to_json
  },
  'notification': {
    title: notification.title_th,
    body: notification.body_th,
  },
  'webpush': {
      ....data
  }
}

https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#WebpushConfig