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

Link token to user ids #760

Open
Chralu opened this issue Dec 20, 2023 · 1 comment
Open

Link token to user ids #760

Chralu opened this issue Dec 20, 2023 · 1 comment

Comments

@Chralu
Copy link

Chralu commented Dec 20, 2023

Hi @appleboy ,

here is a thought I would like to discuss...

In my experience, a recurring concern about push notifications is sending notifications to a particular user of your service.
To achieve that, you have to maintain the matching between user id and its push notification tokens.

So, to achieve that, I would need :

  • a microservice to maintain the user id/push token matching
  • an instance of GoRush to actually send the notifications

It would be really convenient to add that responsability to GoRush.

New API proposal

POST /api/session

creates a mapping between user id, and its tokens

{
   "user_id": "xxxxxx",
   "token": {
       "platform": 1,
       "token": "sdfsfdsf",
   } 
}

POST /api/push/session

sends notification to users

{
  "notifications": [
    {
      "user_ids": ["user_id_1", "user_id_2"],
      "message": "Hello World Users !",
      "title": "Gorush with HMS"
    },
  ]
}

Cleaning the mapping

In case of invalid tokens (expired, invalid...) we want to remove it from the session mapping.

Fortunately, when sending notifications with services like Firebase Cloud Messaging, it returns the list of invalid tokens used.

What do you think ?

@Chralu
Copy link
Author

Chralu commented Dec 21, 2023

might be related to #756

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

1 participant