Skip to content

Commit 9362e7c

Browse files
authored
docs: Fix readme style (#247)
1 parent 0facf30 commit 9362e7c

File tree

1 file changed

+65
-33
lines changed

1 file changed

+65
-33
lines changed

README.md

Lines changed: 65 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,18 @@ The official Push Notification adapter for Parse Server. See [Parse Server Push
1515

1616
---
1717

18-
- [Silent Notifications](#silent-notifications)
18+
- [Installation](#installation)
19+
- [Configure Parse Server](#configure-parse-server)
20+
- [Apple Push Options](#apple-push-options)
21+
- [Android Push Options](#android-push-options)
22+
- [Migration to FCM HTTP v1 API (June 2024)](#migration-to-fcm-http-v1-api-june-2024)
23+
- [Expo Push Options](#expo-push-options)
24+
- [Bundled with Parse Server](#bundled-with-parse-server)
1925
- [Logging](#logging)
20-
- [Using a Custom Version on Parse Server](#using-a-custom-version-on-parse-server)
21-
- [Install Push Adapter](#install-push-adapter)
22-
- [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)
26-
- [Expo Push Options](#expo-push-options)
2726

28-
# Silent Notifications
27+
## Installation
2928

30-
If you have migrated from parse.com and you are seeing situations where silent (newsstand-like presentless) notifications are failing to deliver please ensure that your payload is setting the content-available attribute to Int(1) and not "1" This value will be explicitly checked.
31-
32-
# Logging
33-
34-
You can enable verbose logging with environment variables:
35-
36-
```
37-
VERBOSE=1
38-
39-
or
40-
41-
VERBOSE_PARSE_SERVER_PUSH_ADAPTER=1
42-
```
43-
44-
This will produce a more verbose output for all the push sending attempts
45-
46-
# Using a Custom Version on Parse Server
47-
48-
## Install Push Adapter
49-
50-
```bash
29+
```shell
5130
npm install --save @parse/push-adapter@<VERSION>
5231
```
5332

@@ -142,11 +121,32 @@ const parseServerOptions = {
142121
}
143122
```
144123

145-
#### Migration from FCM legacy API to FCM HTTP v1 API (June 2024)
124+
Alternatively, instead of setting `firebaseServiceAccount` to the path of the JSON file, you can provide an object representing a Google Cloud service account key:
146125

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`.
126+
```js
127+
const parseServerOptions = {
128+
push: {
129+
adapter: new PushAdapter({
130+
android: {
131+
firebaseServiceAccount: {
132+
projectId: '<PROJECT_ID>',
133+
clientEmail: 'example@<PROJECT_ID>.iam.gserviceaccount.com',
134+
privateKey: '-----BEGIN PRIVATE KEY-----<KEY>-----END PRIVATE KEY-----\n'
135+
},
136+
},
137+
}),
138+
},
139+
// Other Parse Server options
140+
}
141+
```
148142

149-
Example options:
143+
This can be helpful if you are already managing credentials to Google Cloud APIs in other parts of your code and you want to reuse these credentials, or if you want to manage credentials on a more granular level directly via Google Cloud.
144+
145+
#### Migration 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 decommissioned 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 (deprecated):
150150

151151
```js
152152
const PushAdapter = require('@parse/push-adapter').default;
@@ -174,3 +174,35 @@ expo: {
174174
```
175175

176176
For more information see the [Expo docs](https://docs.expo.dev/push-notifications/overview/).
177+
178+
## Bundled with Parse Server
179+
180+
Parse Server already comes bundled with a specific version of the push adapter. This installation is only necessary when customizing the push adapter version that should be used by Parse Server. When using a customized version of the push adapter, ensure that it's compatible with the version of Parse Server you are using.
181+
182+
When using the bundled version, it is not necessary to initialize the push adapter in code and the push options are configured directly in the `push` key, without the nested `adapter` key:
183+
184+
```js
185+
const parseServerOptions = {
186+
push: {
187+
ios: {
188+
// Apple push options
189+
},
190+
// Other push options
191+
},
192+
// Other Parse Server options
193+
}
194+
```
195+
196+
## Logging
197+
198+
You can enable verbose logging to produce a more detailed output for all push sending attempts with the following environment variables:
199+
200+
```js
201+
VERBOSE=1
202+
```
203+
204+
or
205+
206+
```js
207+
VERBOSE_PARSE_SERVER_PUSH_ADAPTER=1
208+
```

0 commit comments

Comments
 (0)