mirror of
https://github.com/appwrite/appwrite
synced 2026-05-11 19:18:28 +00:00
31 lines
1,001 B
Markdown
31 lines
1,001 B
Markdown
|
|
const sdk = require('node-appwrite');
|
||
|
|
|
||
|
|
const client = new sdk.Client()
|
||
|
|
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
||
|
|
.setProject('<YOUR_PROJECT_ID>') // Your project ID
|
||
|
|
.setKey('<YOUR_API_KEY>'); // Your secret API key
|
||
|
|
|
||
|
|
const messaging = new sdk.Messaging(client);
|
||
|
|
|
||
|
|
const result = await messaging.createPush(
|
||
|
|
'<MESSAGE_ID>', // messageId
|
||
|
|
'<TITLE>', // title (optional)
|
||
|
|
'<BODY>', // body (optional)
|
||
|
|
[], // topics (optional)
|
||
|
|
[], // users (optional)
|
||
|
|
[], // targets (optional)
|
||
|
|
{}, // data (optional)
|
||
|
|
'<ACTION>', // action (optional)
|
||
|
|
'[ID1:ID2]', // image (optional)
|
||
|
|
'<ICON>', // icon (optional)
|
||
|
|
'<SOUND>', // sound (optional)
|
||
|
|
'<COLOR>', // color (optional)
|
||
|
|
'<TAG>', // tag (optional)
|
||
|
|
null, // badge (optional)
|
||
|
|
false, // draft (optional)
|
||
|
|
'', // scheduledAt (optional)
|
||
|
|
false, // contentAvailable (optional)
|
||
|
|
false, // critical (optional)
|
||
|
|
sdk.MessagePriority.Normal // priority (optional)
|
||
|
|
);
|