Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating from legacy FCM to HTTP v1 #173

Open
shaffe-fr opened this issue Apr 12, 2024 · 2 comments
Open

Migrating from legacy FCM to HTTP v1 #173

shaffe-fr opened this issue Apr 12, 2024 · 2 comments

Comments

@shaffe-fr
Copy link

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

@PetrahHarslett
Copy link

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?

@shaffe-fr
Copy link
Author

Hi, the PR #171 should solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants