2024-07-03 15:25:40 +00:00
|
|
|
import io.appwrite.Client
|
|
|
|
|
import io.appwrite.coroutines.CoroutineCallback
|
|
|
|
|
import io.appwrite.services.Messaging
|
|
|
|
|
|
|
|
|
|
val client = Client()
|
|
|
|
|
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
|
2024-08-21 09:16:51 +00:00
|
|
|
.setProject("<YOUR_PROJECT_ID>") // Your project ID
|
|
|
|
|
.setKey("<YOUR_API_KEY>") // Your secret API key
|
2024-07-03 15:25:40 +00:00
|
|
|
|
|
|
|
|
val messaging = Messaging(client)
|
|
|
|
|
|
|
|
|
|
val response = messaging.createPush(
|
|
|
|
|
messageId = "<MESSAGE_ID>",
|
2024-12-11 06:15:29 +00:00
|
|
|
title = "<TITLE>", // optional
|
|
|
|
|
body = "<BODY>", // optional
|
2024-07-03 15:25:40 +00:00
|
|
|
topics = listOf(), // optional
|
|
|
|
|
users = listOf(), // optional
|
|
|
|
|
targets = listOf(), // optional
|
|
|
|
|
data = mapOf( "a" to "b" ), // optional
|
|
|
|
|
action = "<ACTION>", // optional
|
|
|
|
|
image = "[ID1:ID2]", // optional
|
|
|
|
|
icon = "<ICON>", // optional
|
|
|
|
|
sound = "<SOUND>", // optional
|
|
|
|
|
color = "<COLOR>", // optional
|
|
|
|
|
tag = "<TAG>", // optional
|
2024-12-11 06:15:29 +00:00
|
|
|
badge = 0, // optional
|
2024-07-03 15:25:40 +00:00
|
|
|
draft = false, // optional
|
2024-12-11 06:15:29 +00:00
|
|
|
scheduledAt = "", // optional
|
|
|
|
|
contentAvailable = false, // optional
|
|
|
|
|
critical = false, // optional
|
|
|
|
|
priority = "normal" // optional
|
2024-07-03 15:25:40 +00:00
|
|
|
)
|