Skip to content

Commit

Permalink
Merge pull request #1674 from appwrite/doc-push-notification-update
Browse files Browse the repository at this point in the history
Doc: Add new push message parameters
  • Loading branch information
ebenezerdon authored Jan 21, 2025
2 parents 6e0d0d3 + 240fe0f commit eea4fe4
Showing 1 changed file with 76 additions and 39 deletions.
115 changes: 76 additions & 39 deletions src/routes/docs/products/messaging/messages/+page.markdoc
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ Here are the different components that make up a message.
* The title of the push notification. This is the headline text that recipients see first.
---
* `title`
* required
* The title of the push notification. This is the headline text that recipients see first.
* optional
* The title of the push notification. This is the headline text that recipients see first. Can be omitted for background notifications.
---
* `body`
* required
* The main content or body of the push notification. Provides the details or message you want to convey.
* optional
* The main content or body of the push notification. Provides the details or message you want to convey. Can be omitted for background notifications.
---
* `data`
* optional
Expand Down Expand Up @@ -150,7 +150,19 @@ Here are the different components that make up a message.
---
* `badge`
* optional
* 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.
* 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.
---
* `contentAvailable`
* optional
* 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.
---
* `critical`
* optional
* 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.
---
* `priority`
* optional
* 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.
---
* `draft`
* optional
Expand Down Expand Up @@ -250,7 +262,10 @@ const message = await messaging.createPush(
'[SOUND]', // sound (optional)
'[COLOR]', // color (optional)
'[TAG]', // tag (optional)
'[BADGE]', // badge (optional)
1, // badge (optional)
false, // contentAvailable (optional)
false, // critical (optional)
'normal', // priority (optional)
true, // draft (optional)
'' // scheduledAt (optional)
);
Expand Down Expand Up @@ -282,7 +297,10 @@ const message = await messaging.createPush(
'[SOUND]', // sound (optional)
'[COLOR]', // color (optional)
'[TAG]', // tag (optional)
'[BADGE]', // badge (optional)
1, // badge (optional)
false, // contentAvailable (optional)
false, // critical (optional)
'normal', // priority (optional)
true, // draft (optional)
'' // scheduledAt (optional)
);
Expand Down Expand Up @@ -316,7 +334,10 @@ $result = $messaging->createPush(
sound: '[SOUND]', // optional
color: '[COLOR]', // optional
tag: '[TAG]', // optional
badge: '[BADGE]', // optional
badge: 1, // optional
contentAvailable: false, // optional
critical: false, // optional
priority: 'normal', // optional
draft: true, // optional
scheduledAt: '' // optional
);
Expand Down Expand Up @@ -348,7 +369,10 @@ result = messaging.create_push(
sound = '[SOUND]', # optional
color = '[COLOR]', # optional
tag = '[TAG]', # optional
badge = '[BADGE]', # optional
badge = 1, # optional
content_available = False, # optional
critical = False, # optional
priority = 'normal', # optional
draft = True, # optional
scheduled_at = '' # optional
)
Expand Down Expand Up @@ -379,6 +403,9 @@ response = messaging.create_push(
color: '[COLOR]', # optional
tag: '[TAG]', # optional
badge: '[BADGE]', # optional
content_available: false, # optional
critical: false, # optional
priority: 'normal', # optional
draft: true, # optional
scheduled_at: '' # optional
)
Expand All @@ -400,19 +427,23 @@ var messaging = new Messaging(client);
Message result = await messaging.CreatePush(
messageId: "[MESSAGE_ID]",
title: "[TITLE]",
body: "[BODY]"
topics: new List<string> {} // optional
users: new List<string> {} // optional
targets: new List<string> {} // optional
data: [object] // optional
action: "[ACTION]" // optional
icon: "[ICON]" // optional
sound: "[SOUND]" // optional
color: "[COLOR]" // optional
tag: "[TAG]" // optional
badge: "[BADGE]" // optional
draft: true // optional
scheduledAt: ""); // optional
body: "[BODY]"
topics: new List<string> {}, // optional
users: new List<string> {}, // optional
targets: new List<string> {}, // optional
data: [object] // optional
action: "[ACTION]", // optional
icon: "[ICON]", // optional
sound: "[SOUND]", // optional
color: "[COLOR]", // optional
tag: "[TAG]", // optional
badge: 1, // optional
contentAvailable: false, // optional
critical: false, // optional
priority: "normal", // optional
draft: true, // optional
scheduledAt: "" // optional
);
```
```dart
import 'package:dart_appwrite/dart_appwrite.dart';
Expand Down Expand Up @@ -442,7 +473,10 @@ void main() async { // Init SDK
sound: '[SOUND]', // optional
color: '[COLOR]', // optional
tag: '[TAG]', // optional
badge: '[BADGE]', // optional
badge: 1, // optional
content_available: false, // optional
critical: false, // optional
priority: 'normal', // optional
draft: true, // optional
scheduledAt: '', // optional
);
Expand Down Expand Up @@ -480,7 +514,7 @@ messaging.createPush(
"[SOUND]", // sound (optional)
"[COLOR]", // color (optional)
"[TAG]", // tag (optional)
"[BADGE]", // badge (optional)
1, // badge (optional)
true, // draft (optional)
"" // scheduledAt (optional)
new CoroutineCallback<>((result, error) -> {
Expand Down Expand Up @@ -518,7 +552,7 @@ messaging.createPush(
"[SOUND]", // sound (optional)
"[COLOR]", // color (optional)
"[TAG]", // tag (optional)
"[BADGE]", // badge (optional)
1, // badge (optional)
true, // draft (optional)
"" // scheduledAt (optional)
new CoroutineCallback<>((result, error) -> {
Expand Down Expand Up @@ -554,7 +588,10 @@ let message = try await messaging.createPush(
sound: "[SOUND]", // optional
color: "[COLOR]", // optional
tag: "[TAG]", // optional
badge: "[BADGE]", // optional
badge: 1, // optional
content_available: false, // optional
critical: false, // optional
priority: "normal", // optional
draft: true, // optional
scheduledAt: "" // optional
)
Expand Down Expand Up @@ -725,14 +762,14 @@ var messaging = new Messaging(client);
Message result = await messaging.CreateEmail(
messageId: "[MESSAGE_ID]",
subject: "[SUBJECT]",
content: "[CONTENT]"
topics: new List<string> {} // optional
users: new List<string> {} // optional
targets: new List<string> {} // optional
cc: new List<string> {} // optional
bcc: new List<string> {} // optional
draft: true // optional
html: false // optional
content: "[CONTENT]"
topics: new List<string> {} // optional
users: new List<string> {} // optional
targets: new List<string> {} // optional
cc: new List<string> {} // optional
bcc: new List<string> {} // optional
draft: true // optional
html: false // optional
scheduledAt: ""); // optional
```
```dart
Expand Down Expand Up @@ -1009,11 +1046,11 @@ var messaging = new Messaging(client);

Message result = await messaging.CreateSMS(
messageId: "[MESSAGE_ID]",
content: "[CONTENT]"
topics: new List<string> {} // optional
users: new List<string> {} // optional
targets: new List<string> {} // optional
draft: true // optional
content: "[CONTENT]"
topics: new List<string> {} // optional
users: new List<string> {} // optional
targets: new List<string> {} // optional
draft: true // optional
scheduledAt: ""); // optional
```
```dart
Expand Down

0 comments on commit eea4fe4

Please sign in to comment.