How to add mutable_content in APNS payload using Firebase Notifications console?
Asked Answered
M

3

6

Not able to figure out how to send mutable_content=true in aps dictionary. This is the json payload which i recieve when i send notification from firebase messaging console

{
    aps =     {
        alert =         {
            body = "50% off on booking ";
            title = "CompanyName 50% coupon ABC50OFF";
        };
        sound = default;
    };
    "attachment-url" = "https://www.xxxxxxxxx.com/campaign/images_thumb/Toyota-Fortuner-AT.jpg";
    "click_action" = reminder;
    "content_available" = 1;
    "gcm.message_id" = "0:1491225835295720%a84b45aaa84b45aa";
    "gcm.n.e" = 1;
    "gcm.notification.sound2" = default;
    "google.c.a.c_id" = 3829383583613273032;
    "google.c.a.e" = 1;
    "google.c.a.ts" = 1491225835;
    "google.c.a.udt" = 0;
    "mutable_content" = 1;
}
Molar answered 5/4, 2017 at 6:36 Comment(0)
S
8

It it is currently not possible to set the value of mutable_content when using the Firebase Notifications Console. You'll have to build the payload yourself, something like this:

{
    "to": "<REGISTRATION_TOKEN_HERE>",
    "mutable-content" : true,
    "notification": {
        "body" : "Eureka!",
        "title": "Patient is not doing well",
        "click_action" : "provider-body-panel"
    }
}

Then send it from your own App Server. You could also do this by using Postman or cURL

Modified portion from my answer here.

Scifi answered 5/4, 2017 at 7:42 Comment(0)
B
8

Answers not correct, you should use "mutable_content" instead "mutable-content"

{
    "to": "Token",
    "mutable_content" : true,
    "notification" : {
    "body" : "great match!",
    "title": "check"
    }
}
Boccie answered 5/5, 2021 at 5:26 Comment(0)
A
4

Add Notification image while sending push notification from Firebase Notifications console. It will automatically add "mutable-content" : true inside the payload.

enter image description here

Alleged answered 22/4, 2020 at 12:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.