appwrite/docs/examples/1.7.x/server-nodejs/examples/messaging/create-push.md

31 lines
1,001 B
Markdown
Raw Normal View History

2025-05-17 14:28:12 +00:00
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)
);