appleboy / appleboy/gorush

Link token to user ids

Open
#760 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
8.8k
Forks
887
PR merge metrics
No merged PRs in 30d

Description

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

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

### POST /api/push/session

> sends notification to users

```json
{
"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 ?

Contributor guide

No contributing guide indexed for this repository

Research direction

No files or tests are identified. Start by reviewing GoRush's existing API and notification delivery paths, then clarify the user/token mapping, proposed endpoints, and invalid-token cleanup behavior. Done would require an agreed design and implementation scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.