Docs
Skip to content
post

Create subscriber

Endpoint

posthttps://<REGION>.cloud.appwrite.io...saging/topics/{topicId}/subscribers

Description

Required scopes

subscribers.write

Authentication

Initialize the Appwrite client with setProject() and ensure the user is signed in. The SDK sends the session header automatically after login.

Path

string
Required

Body

string
Required
string
Required
Status
Content type
201
application/json

Subscriber

Name
Type
Description
string
string
string
string
object
string
string
string
string
JavaScript
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({
topicId: '<TOPIC_ID>',
subscriberId: '<SUBSCRIBER_ID>',
targetId: '<TARGET_ID>'
});
console.log(result);