https://github.com/matthewhartstonge/iid
Bulk import existing iOS APNs tokens to Firebase Cloud
https://github.com/matthewhartstonge/iid
apns fcm google iid push-notifications
Last synced: 4 months ago
JSON representation
Bulk import existing iOS APNs tokens to Firebase Cloud
- Host: GitHub
- URL: https://github.com/matthewhartstonge/iid
- Owner: matthewhartstonge
- License: mit
- Created: 2024-06-14T03:45:54.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-09T21:33:29.000Z (over 1 year ago)
- Last Synced: 2025-04-05T13:42:52.797Z (about 1 year ago)
- Topics: apns, fcm, google, iid, push-notifications
- Language: Go
- Homepage:
- Size: 31.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Google Instance ID (FCM Batch APNs Token Import)
Provides a client to bulk import existing iOS APNs tokens to Firebase Cloud
Messaging using Google's [Instance ID batch import endpoint.](https://developers.google.com/instance-id/reference/server#create_registration_tokens_for_apns_tokens)
Note, this is a deprecated Google API, so there is no guarantee this will work in the future.
If I get a report it's no longer working, I'll archive the project. ✌️
## Installation
```shell
go get github.com/matthewhartstonge/iid
```
## Usage
```go
package main
import (
"context"
"fmt"
"os"
"github.com/matthewhartstonge/iid"
)
func main() {
jsonCreds, err := os.ReadFile("path-to-firebase-service-account-json.credentials")
if err != nil {
panic(err)
}
client, err := iid.New("com.example.app", jsonCreds, iid.WithSandbox())
if err != nil {
panic(err)
}
res, err := client.BatchImport(context.Background(), []string{"MY_APNS_TOKEN"})
if err != nil {
panic(err)
}
for _, item := range res {
fmt.Println(item)
}
}
```
## Firebase Credentials
You will require using Firebase service account credentials which can be
downloaded from the Google Cloud Console as a JSON encoded file.
You will need to:
- Choose your Firebase Project from the Project dropdown selector (top left).
- Select and click on `IAM & Admin` > `Service accounts` from the side menu.
- Click on your `Firebase Admin SDK Service Agent` account within the presented table.
- Click on the 'keys' tab.
- Click 'Add Key' > 'Create New Key'.
- Choose key type `JSON`, and click 'create'.
- Download and use the JSON file as your service account credentials.