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.
Base URL
https://cloud.appwrite.io/v1
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
Endpoint
POST /messaging/topics/{topicId}/subscribers
Web
import { Client, Messaging } from "appwrite";
const client = new Client()
.setEndpoint('https://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 application/json
Endpoint
DELETE /messaging/topics/{topicId}/subscribers/{subscriberId}
Web
import { Client, Messaging } from "appwrite";
const client = new Client()
.setEndpoint('https://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);