0

I am trying to send push notification from firebase to iOS device but not successful. Following is the payload I tried:

var message = {
  notification: {
    title: '$GOOG up 1.43% on the day',
    body: '$GOOG gained 11.80 points to close at 835.67, up 1.43% on the day.',
  },
  apns: {
    headers: {
      "apns-priority": '10'
    },
    payload: {
      aps: {
        alert: {
          title: '$GOOG up 1.43% on the day',
          body: '$GOOG gained 11.80 points to close at 835.67, up 1.43% on the day.',
        },
        "content-available": true
      }
    }
  },
  token: "adacxxxxxx 152 string"
};

When I try to trigger fbAdmin.messaging().send(message), I receive {"code":"messaging/internal-error","message":"Internal error encountered."}.

I have another format for Android and it was working fine. So, I am trying to understand why iOS is not working. Any suggestions or help is appreciated as I have spent a few days on this.

Frank van Puffelen
  • 418,229
  • 62
  • 649
  • 645
Aung Myint Thein
  • 295
  • 3
  • 12

1 Answers1

0

I have managed to make this working myself by trying following.

How can I send a Firebase Cloud Messaging notification without use the Firebase Console?

After I tried to call fcm api, I get the error "InvalidAPNsCredentials". Then I realized my APN Auth Key is something wrong. Then, I had to redownload the APN auth key, corrected the Team ID and run the app again and now it is working!

Aung Myint Thein
  • 295
  • 3
  • 12