Skip to content

Commit eea4fe4

Browse files
authored
Merge pull request #1674 from appwrite/doc-push-notification-update
Doc: Add new push message parameters
2 parents 6e0d0d3 + 240fe0f commit eea4fe4

File tree

1 file changed

+76
-39
lines changed

1 file changed

+76
-39
lines changed

src/routes/docs/products/messaging/messages/+page.markdoc

Lines changed: 76 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ Here are the different components that make up a message.
117117
* The title of the push notification. This is the headline text that recipients see first.
118118
---
119119
* `title`
120-
* required
121-
* The title of the push notification. This is the headline text that recipients see first.
120+
* optional
121+
* The title of the push notification. This is the headline text that recipients see first. Can be omitted for background notifications.
122122
---
123123
* `body`
124-
* required
125-
* The main content or body of the push notification. Provides the details or message you want to convey.
124+
* optional
125+
* The main content or body of the push notification. Provides the details or message you want to convey. Can be omitted for background notifications.
126126
---
127127
* `data`
128128
* optional
@@ -150,7 +150,19 @@ Here are the different components that make up a message.
150150
---
151151
* `badge`
152152
* optional
153-
* Sets the number to display next to the app's icon, indicating the number of notifications or updates. Setting to 0 removes any existing badge. This is for Apple devices only.
153+
* Sets the number to display next to the app's icon, indicating the number of notifications or updates. Setting to 0 removes any existing badge. Must be an integer. For Apple devices only.
154+
---
155+
* `contentAvailable`
156+
* optional
157+
* For iOS devices only. When set, wakes up the app in the background without showing a notification. Used to update app data remotely. Requires priority to be set to normal. **Note:** APNS may throttle if sending more than 2-3 background notifications per hour. For Android, similar functionality can be achieved by sending a data-only notification without title and body.
158+
---
159+
* `critical`
160+
* optional
161+
* For iOS devices only. Marks the notification as critical to bypass silent and do not disturb settings. Requires the app to have the critical notification entitlement from Apple.
162+
---
163+
* `priority`
164+
* optional
165+
* Sets notification priority to normal or high. Normal priority delivers at the most convenient time based on battery life and may group notifications. High priority delivers immediately.
154166
---
155167
* `draft`
156168
* optional
@@ -250,7 +262,10 @@ const message = await messaging.createPush(
250262
'[SOUND]', // sound (optional)
251263
'[COLOR]', // color (optional)
252264
'[TAG]', // tag (optional)
253-
'[BADGE]', // badge (optional)
265+
1, // badge (optional)
266+
false, // contentAvailable (optional)
267+
false, // critical (optional)
268+
'normal', // priority (optional)
254269
true, // draft (optional)
255270
'' // scheduledAt (optional)
256271
);
@@ -282,7 +297,10 @@ const message = await messaging.createPush(
282297
'[SOUND]', // sound (optional)
283298
'[COLOR]', // color (optional)
284299
'[TAG]', // tag (optional)
285-
'[BADGE]', // badge (optional)
300+
1, // badge (optional)
301+
false, // contentAvailable (optional)
302+
false, // critical (optional)
303+
'normal', // priority (optional)
286304
true, // draft (optional)
287305
'' // scheduledAt (optional)
288306
);
@@ -316,7 +334,10 @@ $result = $messaging->createPush(
316334
sound: '[SOUND]', // optional
317335
color: '[COLOR]', // optional
318336
tag: '[TAG]', // optional
319-
badge: '[BADGE]', // optional
337+
badge: 1, // optional
338+
contentAvailable: false, // optional
339+
critical: false, // optional
340+
priority: 'normal', // optional
320341
draft: true, // optional
321342
scheduledAt: '' // optional
322343
);
@@ -348,7 +369,10 @@ result = messaging.create_push(
348369
sound = '[SOUND]', # optional
349370
color = '[COLOR]', # optional
350371
tag = '[TAG]', # optional
351-
badge = '[BADGE]', # optional
372+
badge = 1, # optional
373+
content_available = False, # optional
374+
critical = False, # optional
375+
priority = 'normal', # optional
352376
draft = True, # optional
353377
scheduled_at = '' # optional
354378
)
@@ -379,6 +403,9 @@ response = messaging.create_push(
379403
color: '[COLOR]', # optional
380404
tag: '[TAG]', # optional
381405
badge: '[BADGE]', # optional
406+
content_available: false, # optional
407+
critical: false, # optional
408+
priority: 'normal', # optional
382409
draft: true, # optional
383410
scheduled_at: '' # optional
384411
)
@@ -400,19 +427,23 @@ var messaging = new Messaging(client);
400427
Message result = await messaging.CreatePush(
401428
messageId: "[MESSAGE_ID]",
402429
title: "[TITLE]",
403-
body: "[BODY]"
404-
topics: new List<string> {} // optional
405-
users: new List<string> {} // optional
406-
targets: new List<string> {} // optional
407-
data: [object] // optional
408-
action: "[ACTION]" // optional
409-
icon: "[ICON]" // optional
410-
sound: "[SOUND]" // optional
411-
color: "[COLOR]" // optional
412-
tag: "[TAG]" // optional
413-
badge: "[BADGE]" // optional
414-
draft: true // optional
415-
scheduledAt: ""); // optional
430+
body: "[BODY]"
431+
topics: new List<string> {}, // optional
432+
users: new List<string> {}, // optional
433+
targets: new List<string> {}, // optional
434+
data: [object] // optional
435+
action: "[ACTION]", // optional
436+
icon: "[ICON]", // optional
437+
sound: "[SOUND]", // optional
438+
color: "[COLOR]", // optional
439+
tag: "[TAG]", // optional
440+
badge: 1, // optional
441+
contentAvailable: false, // optional
442+
critical: false, // optional
443+
priority: "normal", // optional
444+
draft: true, // optional
445+
scheduledAt: "" // optional
446+
);
416447
```
417448
```dart
418449
import 'package:dart_appwrite/dart_appwrite.dart';
@@ -442,7 +473,10 @@ void main() async { // Init SDK
442473
sound: '[SOUND]', // optional
443474
color: '[COLOR]', // optional
444475
tag: '[TAG]', // optional
445-
badge: '[BADGE]', // optional
476+
badge: 1, // optional
477+
content_available: false, // optional
478+
critical: false, // optional
479+
priority: 'normal', // optional
446480
draft: true, // optional
447481
scheduledAt: '', // optional
448482
);
@@ -480,7 +514,7 @@ messaging.createPush(
480514
"[SOUND]", // sound (optional)
481515
"[COLOR]", // color (optional)
482516
"[TAG]", // tag (optional)
483-
"[BADGE]", // badge (optional)
517+
1, // badge (optional)
484518
true, // draft (optional)
485519
"" // scheduledAt (optional)
486520
new CoroutineCallback<>((result, error) -> {
@@ -518,7 +552,7 @@ messaging.createPush(
518552
"[SOUND]", // sound (optional)
519553
"[COLOR]", // color (optional)
520554
"[TAG]", // tag (optional)
521-
"[BADGE]", // badge (optional)
555+
1, // badge (optional)
522556
true, // draft (optional)
523557
"" // scheduledAt (optional)
524558
new CoroutineCallback<>((result, error) -> {
@@ -554,7 +588,10 @@ let message = try await messaging.createPush(
554588
sound: "[SOUND]", // optional
555589
color: "[COLOR]", // optional
556590
tag: "[TAG]", // optional
557-
badge: "[BADGE]", // optional
591+
badge: 1, // optional
592+
content_available: false, // optional
593+
critical: false, // optional
594+
priority: "normal", // optional
558595
draft: true, // optional
559596
scheduledAt: "" // optional
560597
)
@@ -725,14 +762,14 @@ var messaging = new Messaging(client);
725762
Message result = await messaging.CreateEmail(
726763
messageId: "[MESSAGE_ID]",
727764
subject: "[SUBJECT]",
728-
content: "[CONTENT]"
729-
topics: new List<string> {} // optional
730-
users: new List<string> {} // optional
731-
targets: new List<string> {} // optional
732-
cc: new List<string> {} // optional
733-
bcc: new List<string> {} // optional
734-
draft: true // optional
735-
html: false // optional
765+
content: "[CONTENT]"
766+
topics: new List<string> {} // optional
767+
users: new List<string> {} // optional
768+
targets: new List<string> {} // optional
769+
cc: new List<string> {} // optional
770+
bcc: new List<string> {} // optional
771+
draft: true // optional
772+
html: false // optional
736773
scheduledAt: ""); // optional
737774
```
738775
```dart
@@ -1009,11 +1046,11 @@ var messaging = new Messaging(client);
10091046

10101047
Message result = await messaging.CreateSMS(
10111048
messageId: "[MESSAGE_ID]",
1012-
content: "[CONTENT]"
1013-
topics: new List<string> {} // optional
1014-
users: new List<string> {} // optional
1015-
targets: new List<string> {} // optional
1016-
draft: true // optional
1049+
content: "[CONTENT]"
1050+
topics: new List<string> {} // optional
1051+
users: new List<string> {} // optional
1052+
targets: new List<string> {} // optional
1053+
draft: true // optional
10171054
scheduledAt: ""); // optional
10181055
```
10191056
```dart

0 commit comments

Comments
 (0)