Skip to content

Commit 0facf30

Browse files
authored
docs: Update adapter options in README (#240)
1 parent 920ae17 commit 0facf30

File tree

1 file changed

+96
-9
lines changed

1 file changed

+96
-9
lines changed

README.md

Lines changed: 96 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
---
1313

14-
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.
14+
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.
1515

1616
---
1717

@@ -20,6 +20,9 @@ The official Push Notification adapter for Parse Server. See [Parse Server Push
2020
- [Using a Custom Version on Parse Server](#using-a-custom-version-on-parse-server)
2121
- [Install Push Adapter](#install-push-adapter)
2222
- [Configure Parse Server](#configure-parse-server)
23+
- [Apple Push Options](#apple-push-options)
24+
- [Android Push Options](#android-push-options)
25+
- [Migration from FCM legacy API to FCM HTTP v1 API (June 2024)](#migration-from-fcm-legacy-api-to-fcm-http-v1-api-june-2024)
2326
- [Expo Push Options](#expo-push-options)
2427

2528
# Silent Notifications
@@ -33,7 +36,7 @@ You can enable verbose logging with environment variables:
3336
```
3437
VERBOSE=1
3538
36-
or
39+
or
3740
3841
VERBOSE_PARSE_SERVER_PUSH_ADAPTER=1
3942
```
@@ -44,7 +47,7 @@ This will produce a more verbose output for all the push sending attempts
4447

4548
## Install Push Adapter
4649

47-
```
50+
```bash
4851
npm install --save @parse/push-adapter@<VERSION>
4952
```
5053

@@ -58,20 +61,105 @@ const parseServerOptions = {
5861
push: {
5962
adapter: new PushAdapter({
6063
ios: {
61-
/* Apple push options */
64+
// Apple push options
6265
},
6366
android: {
64-
/* Android push options */
67+
// Android push options
6568
},
6669
web: {
67-
/* Web push options */
70+
// Web push options
6871
},
6972
expo: {
70-
/* Expo push options */
73+
// Expo push options
74+
},
75+
}),
76+
},
77+
// Other Parse Server options
78+
}
79+
```
80+
81+
### Apple Push Options
82+
83+
Parse Server Push Adapter currently supports these types of Apple ecosystems:
84+
85+
- `ios`: iPhone, iPad, and iPod touch apps
86+
- `osx`: macOS, and macCatalyst apps
87+
- `tvos`: tvOS apps
88+
89+
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:
90+
91+
- 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.
92+
- 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._
93+
94+
Example options:
95+
96+
Both services (APNS, FCM) can be used in combination for different Apple ecosystems.
97+
98+
```js
99+
const PushAdapter = require('@parse/push-adapter').default;
100+
const parseServerOptions = {
101+
push: {
102+
adapter: new PushAdapter({
103+
ios: {
104+
// Deliver push notifications to iOS devices via APNS
105+
token: {
106+
key: __dirname + '/apns.p8',
107+
keyId: '<APNS_KEY_ID>',
108+
teamId: '<APNS_TEAM_ID>',
109+
},
110+
topic: '<BUNDLE_IDENTIFIER>',
111+
production: true
112+
},
113+
osx: {
114+
// Deliver push notifications to macOS devices via FCM
115+
firebaseServiceAccount: __dirname + '/firebase.json'
116+
},
117+
}),
118+
},
119+
// Other Parse Server options
120+
}
121+
```
122+
123+
### Android Push Options
124+
125+
Delivering push notifications to Android devices can be done via Firebase Cloud Messaging (FCM):
126+
127+
- 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._
128+
129+
Example options:
130+
131+
```js
132+
const PushAdapter = require('@parse/push-adapter').default;
133+
const parseServerOptions = {
134+
push: {
135+
adapter: new PushAdapter({
136+
android: {
137+
firebaseServiceAccount: __dirname + '/firebase.json'
138+
},
139+
}),
140+
},
141+
// Other Parse Server options
142+
}
143+
```
144+
145+
#### Migration from FCM legacy API to FCM HTTP v1 API (June 2024)
146+
147+
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`.
148+
149+
Example options:
150+
151+
```js
152+
const PushAdapter = require('@parse/push-adapter').default;
153+
const parseServerOptions = {
154+
push: {
155+
adapter: new PushAdapter({
156+
android: {
157+
// Deliver push notifications via FCM legacy API (deprecated)
158+
apiKey: '<API_KEY>'
71159
},
72160
}),
73161
},
74-
/* Other Parse Server options */
162+
// Other Parse Server options
75163
}
76164
```
77165

@@ -86,4 +174,3 @@ expo: {
86174
```
87175

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

0 commit comments

Comments
 (0)