Skip to content

docs: Update adapter options in README #240

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

Merged
merged 8 commits into from
May 15, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 97 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

---

The official Push Notification adapter for Parse Server. See [Parse Server Push Configuration](http://docs.parseplatform.org/parse-server/guide/#push-notifications) for more details.
The official Push Notification adapter for Parse Server. See [Parse Server Push Configuration](http://docs.parseplatform.org/parse-server/guide/#push-notifications) for more details.

---

Expand All @@ -32,7 +32,7 @@ You can enable verbose logging with environment variables:
```
VERBOSE=1

or
or

VERBOSE_PARSE_SERVER_PUSH_ADAPTER=1
```
Expand All @@ -57,10 +57,10 @@ const parseServerOptions = {
push: {
adapter: new PushAdapter({
ios: {
/* Apple push notification options */
/* Apple push notification options, see below for more info */
},
android: {
/* Android push options */
/* Android push options, see below for more info */
}
web: {
/* Web push options */
Expand All @@ -70,3 +70,96 @@ const parseServerOptions = {
/* Other Parse Server options */
}
```

### Apple configuration

Delivering push notifications to Apple devices can be done either via Apple APNS (Apple Push Notification Service), or via FCM (Firebase Cloud Messaging) service. Note that each category of Apple devices require their own configuration section. Parse Server Push Adapter currently supports these types of Apple devices:

- `ios` -> iPhone, iPad, and iPod touch apps
- `osx` -> macOS, and macCatalyst apps
- `tvos` -> tvOS apps


Apple Push Notification Service requires a p8 encoded private key that can be generated and downloaded in the Apple Developer Center under Certificates > Identifiers & Profiles.

Google Firebase Cloud Messaging requires a Firebase Service Account JSON encoded private key that can be downloaded in the Firebase Console under your project's Settings > Cloud Messaging tab.

Here is an example configuration for both methods:

```js
const PushAdapter = require('@parse/push-adapter').default;
const parseServerOptions = {
push: {
adapter: new PushAdapter({
ios: {
/* Deliver push notifications to iOS devices via Apple APNS */
/* You will need app id, team id, and auth key available on developer.apple.com/account */
token: {
key: __dirname + '/AuthKey_XXXXXXXXXX.p8',
keyId: "XXXXXXXXXX",
teamId: "AAAAAAAAAA"
},
topic: 'com.example.yourawesomeapp',
production: true
},
osx: {
/* Deliver push notifications to macOS devices via Google FCM */
/* You will need admin key available on console.firebase.google.com */
firebaseServiceAccount: __dirname + "/your-awesome-app-firebase-adminsdk-abcd-efgh.json"
}
})
},
/* Other Parse Server options */
}
```

### Android configuration

Delivering push notifications to Android devices can be done via FCM (Firebase Cloud Messaging) service.

Google Firebase Cloud Messaging requires Firebase Service Account json encoded private key that can be downloaded in Firebase Console under your project Settings, and Cloud Messaging tab.

Here is an example configuration:

```js
const PushAdapter = require('@parse/push-adapter').default;
const parseServerOptions = {
push: {
adapter: new PushAdapter({
android: {
/* Deliver push notifications to Android devices via Google FCM */
/* You will need admin key available on console.firebase.google.com */
firebaseServiceAccount: __dirname + "/your-awesome-app-firebase-adminsdk-abcd-efgh.json"
}
})
},
/* Other Parse Server options */
}
```

#### Migration from GCM to FCM (June 2024)

Sending push notifications to Android devices was originally implemented using GCM (Google Cloud Messaging) API. GCM API was deprecated on June 20 2023 and will stop working after June 20 2024.

You will need to update your existing push configuration for Android to remove GCM `apiKey` and add FCM `firebaseServiceAccount` key.

Here is an example configuration:

```js
const PushAdapter = require('@parse/push-adapter').default;
const parseServerOptions = {
push: {
adapter: new PushAdapter({
android: {
/* The legacy GCM `apiKey`, remove once you add `firebaseServiceAccount` */
apiKey: "AAABBBCCCDDD....YYYZZZ"

/* Deliver push notifications to Android devices via Google FCM */
/* You will need admin key available on console.firebase.google.com */
firebaseServiceAccount: __dirname + "/your-awesome-app-firebase-adminsdk-abcd-efgh.json"
}
})
},
/* Other Parse Server options */
}
```