Appwrite Messaging helps you communicate with your users through push notifications, emails, and SMS text messages. Sending personalized communication for marketing, updates, and realtime alerts can increase user engagement and retention. You can also use Appwrite Messaging to implement security checks and custom authentication flows.
You can find guides and examples on using the Messaging API in the Appwrite Messaging product pages.
https://<REGION>.cloud.appwrite.io/v1
Create document
Create a new Document. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration. Make sure to define attributes before creating documents.
documentId string Document ID. Choose a custom ID or generate a random ID with
ID.unique()
. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.data object Document data as JSON object.
permissions array An array of permissions strings. By default, only the current user is granted all permissions. Learn more about permissions.
Response
201 application/json
Rate limits
This endpoint is rate limited. You can only make a limited number of request to his endpoint within a specific time frame.
The limit is applied for each unique limit key.
Time frameAttemptsKey1 minutes 120 requests IP + METHOD + URL + USER ID
POST /databases/{databaseId}/collections/{collectionId}/documents
import { Client, Databases } from "appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const databases = new Databases(client);
const result = await databases.createDocument(
'<DATABASE_ID>', // databaseId
'<COLLECTION_ID>', // collectionId
'<DOCUMENT_ID>', // documentId
{}, // data
["read("any")"] // permissions (optional)
);
console.log(result);
Create subscriber
Create a new subscriber.
Request
topicId string requiredTopic ID. The topic ID to subscribe to.
subscriberId string requiredSubscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
targetId string requiredTarget ID. The target ID to link to the specified Topic ID.
Response
201 application/json
POST /messaging/topics/{topicId}/subscribers
import { Client, Messaging } from "appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const messaging = new Messaging(client);
const result = await messaging.createSubscriber(
'<TOPIC_ID>', // topicId
'<SUBSCRIBER_ID>', // subscriberId
'<TARGET_ID>' // targetId
);
console.log(result);
Delete subscriber
Delete a subscriber by its unique ID.
Request
topicId string requiredTopic ID. The topic ID subscribed to.
subscriberId string requiredSubscriber ID.
Response
204 no content
DELETE /messaging/topics/{topicId}/subscribers/{subscriberId}
import { Client, Messaging } from "appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const messaging = new Messaging(client);
const result = await messaging.deleteSubscriber(
'<TOPIC_ID>', // topicId
'<SUBSCRIBER_ID>' // subscriberId
);
console.log(result);