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 all 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
105 changes: 96 additions & 9 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 @@ -20,6 +20,9 @@ The official Push Notification adapter for Parse Server. See [Parse Server Push
- [Using a Custom Version on Parse Server](#using-a-custom-version-on-parse-server)
- [Install Push Adapter](#install-push-adapter)
- [Configure Parse Server](#configure-parse-server)
- [Apple Push Options](#apple-push-options)
- [Android Push Options](#android-push-options)
- [Migration from FCM legacy API to FCM HTTP v1 API (June 2024)](#migration-from-fcm-legacy-api-to-fcm-http-v1-api-june-2024)
- [Expo Push Options](#expo-push-options)

# Silent Notifications
Expand All @@ -33,7 +36,7 @@ You can enable verbose logging with environment variables:
```
VERBOSE=1

or
or

VERBOSE_PARSE_SERVER_PUSH_ADAPTER=1
```
Expand All @@ -44,7 +47,7 @@ This will produce a more verbose output for all the push sending attempts

## Install Push Adapter

```
```bash
npm install --save @parse/push-adapter@<VERSION>
```

Expand All @@ -58,20 +61,105 @@ const parseServerOptions = {
push: {
adapter: new PushAdapter({
ios: {
/* Apple push options */
// Apple push options
},
android: {
/* Android push options */
// Android push options
},
web: {
/* Web push options */
// Web push options
},
expo: {
/* Expo push options */
// Expo push options
},
}),
},
// Other Parse Server options
}
```

### Apple Push Options

Parse Server Push Adapter currently supports these types of Apple ecosystems:

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

Delivering push notifications to Apple devices can be done either via Apple Push Notification Service (APNS), or via Firebase Cloud Messaging (FMC). Note that each category of Apple devices require their own configuration section:

- APNS requires a private key that can be downloaded from the Apple Developer Center at https://developer.apple.com/account under _Certificates > Identifiers & Profiles._ The adapter options also require the app ID and team ID which can be found there.
- FCM requires a private key that can be downloaded from the Firebase Console at https://console.firebase.google.com in your project under _Settings > Cloud Messaging._

Example options:

Both services (APNS, FCM) can be used in combination for different Apple ecosystems.

```js
const PushAdapter = require('@parse/push-adapter').default;
const parseServerOptions = {
push: {
adapter: new PushAdapter({
ios: {
// Deliver push notifications to iOS devices via APNS
token: {
key: __dirname + '/apns.p8',
keyId: '<APNS_KEY_ID>',
teamId: '<APNS_TEAM_ID>',
},
topic: '<BUNDLE_IDENTIFIER>',
production: true
},
osx: {
// Deliver push notifications to macOS devices via FCM
firebaseServiceAccount: __dirname + '/firebase.json'
},
}),
},
// Other Parse Server options
}
```

### Android Push Options

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

- FCM requires a private key that can be downloaded from the Firebase Console at https://console.firebase.google.com in your project under _Settings > Cloud Messaging._

Example options:

```js
const PushAdapter = require('@parse/push-adapter').default;
const parseServerOptions = {
push: {
adapter: new PushAdapter({
android: {
firebaseServiceAccount: __dirname + '/firebase.json'
},
}),
},
// Other Parse Server options
}
```

#### Migration from FCM legacy API to FCM HTTP v1 API (June 2024)

Sending push notifications to Android devices via the FCM legacy API was deprecated on June 20 2023 and was announced to be decomissioned in June 2024. See [Google docs](https://firebase.google.com/docs/cloud-messaging/migrate-v1). To send push notifications to the newer FCM HTTP v1 API you need to update your existing push configuration for Android by replacing the key `apiKey` with `firebaseServiceAccount`.

Example options:

```js
const PushAdapter = require('@parse/push-adapter').default;
const parseServerOptions = {
push: {
adapter: new PushAdapter({
android: {
// Deliver push notifications via FCM legacy API (deprecated)
apiKey: '<API_KEY>'
},
}),
},
/* Other Parse Server options */
// Other Parse Server options
}
```

Expand All @@ -86,4 +174,3 @@ expo: {
```

For more information see the [Expo docs](https://docs.expo.dev/push-notifications/overview/).

Loading