Edujugon / PushNotification

PHP and Laravel Package to send push notifications to Android and IOS devices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migrating from legacy FCM to HTTP v1

shaffe-fr opened this issue · comments

Hi,

The FCM implementation of this package was deprecated in June 2023 and will be removed in June 2024. We must now use the HTTP v1 API.

https://firebase.google.com/docs/cloud-messaging/migrate-v1

Here are the main changes I identified:

  • We must authenticate using Oauth v2 using credentials stored in a JSON file
  • The endpoint has changed to https://fcm.googleapis.com/v1/projects/<PROJECT_ID>/messages:send
  • It's no longer possible to target multiple devices in the same request, we must send multiple request ourselves.
  • The payload format has changed.
    before:
// Android
{
  "to": "/topics/news",
  "notification": {
    "title": "Breaking News",
    "body": "New news story available.",
    "click_action": "TOP_STORY_ACTIVITY"
  },
  "data": {
    "story_id": "story_12345"
  }
}
// Apple
{
  "to": "/topics/news",
  "notification": {
    "title": "Breaking News",
    "body": "New news story available.",
    "click_action": "HANDLE_BREAKING_NEWS"
  },
  "data": {
    "story_id": "story_12345"
  }
}

after:

{
  "message": {
    "topic": "news",
    "notification": {
      "title": "Breaking News",
      "body": "New news story available."
    },
    "data": {
      "story_id": "story_12345"
    },
    "android": {
      "notification": {
        "click_action": "TOP_STORY_ACTIVITY"
      }
    },
    "apns": {
      "payload": {
        "aps": {
          "category" : "NEW_MESSAGE_CATEGORY"
        }
      }
    }
  }
}

Are you planning to work on this @Edujugon?

Thanks

Is there any action on this ticket? Obviously this will be a pretty critical issue for a lot of people if the library is not updated before the cut-off date. Also, is there any suggestion from Google about how aggressively they will turn off the legacy features they have flagged. I feel like their might be other library maintainers who have let this one slip and so I do wonder if Firebase will really precipitously pull the pin?