Arun Girivasan
Arun Girivasan

Reputation: 602

How to customize firebase push notification in ionic 4?

I used cordova fcm plugin to show push notifications.I need push notification with buttons like whatsapp and facebook push notifications.Is there any way to add buttons in fcm push notifications? If not, how can I do that?

Upvotes: 1

Views: 1328

Answers (1)

rtpHarry
rtpHarry

Reputation: 13125

Seems like you can do it with FCM. The concept is to set up actions within the data part of the payload:

Structured like this:

{
  "registration_ids": ["my device id"],
  "data": {
    "title": "AUX Scrum",
    "message": "Scrum: Daily touchbase @ 10am Please be on time so we can cover everything on the agenda.",
    "actions": [
      {
        "icon": "emailGuests",
        "title": "EMAIL GUESTS",
        "callback": "emailGuests",
        "foreground": true
      },
      {
        "icon": "snooze",
        "title": "SNOOZE",
        "callback": "snooze",
        "foreground": false
      }
    ]
  }
}

What code do you have already for your FCM push notification sending? What library are you using?

Upvotes: 1

Related Questions