Messaging

SERVER

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

List messages

Get a list of all messages from the current Appwrite project.

  • Request
    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType

    • search string

      Search term to filter your list results. Max length: 256 chars.

  • Response
Endpoint
GET /messaging/messages
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.listMessages(
    [], // queries (optional)
    '<SEARCH>' // search (optional)
);

Create email

Create a new email message.

  • Request
    • messageId string
      required

      Message 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.

    • subject string
      required

      Email Subject.

    • content string
      required

      Email Content.

    • topics array

      List of Topic IDs.

    • users array

      List of User IDs.

    • targets array

      List of Targets IDs.

    • cc array

      Array of target IDs to be added as CC.

    • bcc array

      Array of target IDs to be added as BCC.

    • attachments array

      Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>.

    • draft boolean

      Is message a draft

    • html boolean

      Is content of type HTML

    • scheduledAt string

      Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.

  • Response
Endpoint
POST /messaging/messages/email
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createEmail(
    '<MESSAGE_ID>', // messageId
    '<SUBJECT>', // subject
    '<CONTENT>', // content
    [], // topics (optional)
    [], // users (optional)
    [], // targets (optional)
    [], // cc (optional)
    [], // bcc (optional)
    [], // attachments (optional)
    false, // draft (optional)
    false, // html (optional)
    '' // scheduledAt (optional)
);

Update email

Update an email message by its unique ID.

  • Request
    • messageId string
      required

      Message ID.

    • topics array

      List of Topic IDs.

    • users array

      List of User IDs.

    • targets array

      List of Targets IDs.

    • subject string

      Email Subject.

    • content string

      Email Content.

    • draft boolean

      Is message a draft

    • html boolean

      Is content of type HTML

    • cc array

      Array of target IDs to be added as CC.

    • bcc array

      Array of target IDs to be added as BCC.

    • scheduledAt string

      Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.

    • attachments array

      Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>.

  • Response
Endpoint
PATCH /messaging/messages/email/{messageId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateEmail(
    '<MESSAGE_ID>', // messageId
    [], // topics (optional)
    [], // users (optional)
    [], // targets (optional)
    '<SUBJECT>', // subject (optional)
    '<CONTENT>', // content (optional)
    false, // draft (optional)
    false, // html (optional)
    [], // cc (optional)
    [], // bcc (optional)
    '', // scheduledAt (optional)
    [] // attachments (optional)
);

Create push notification

Create a new push notification.

  • Request
    • messageId string
      required

      Message 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.

    • title string
      required

      Title for push notification.

    • body string
      required

      Body for push notification.

    • topics array

      List of Topic IDs.

    • users array

      List of User IDs.

    • targets array

      List of Targets IDs.

    • data object

      Additional Data for push notification.

    • action string

      Action for push notification.

    • image string

      Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.

    • icon string

      Icon for push notification. Available only for Android and Web Platform.

    • sound string

      Sound for push notification. Available only for Android and IOS Platform.

    • color string

      Color for push notification. Available only for Android Platform.

    • tag string

      Tag for push notification. Available only for Android Platform.

    • badge string

      Badge for push notification. Available only for IOS Platform.

    • draft boolean

      Is message a draft

    • scheduledAt string

      Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.

  • Response
Endpoint
POST /messaging/messages/push
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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
    '<BODY>', // body
    [], // 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)
    '<BADGE>', // badge (optional)
    false, // draft (optional)
    '' // scheduledAt (optional)
);

Update push notification

Update a push notification by its unique ID.

  • Request
    • messageId string
      required

      Message ID.

    • topics array

      List of Topic IDs.

    • users array

      List of User IDs.

    • targets array

      List of Targets IDs.

    • title string

      Title for push notification.

    • body string

      Body for push notification.

    • data object

      Additional Data for push notification.

    • action string

      Action for push notification.

    • image string

      Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>.

    • icon string

      Icon for push notification. Available only for Android and Web platforms.

    • sound string

      Sound for push notification. Available only for Android and iOS platforms.

    • color string

      Color for push notification. Available only for Android platforms.

    • tag string

      Tag for push notification. Available only for Android platforms.

    • badge integer

      Badge for push notification. Available only for iOS platforms.

    • draft boolean

      Is message a draft

    • scheduledAt string

      Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.

  • Response
Endpoint
PATCH /messaging/messages/push/{messageId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updatePush(
    '<MESSAGE_ID>', // messageId
    [], // topics (optional)
    [], // users (optional)
    [], // targets (optional)
    '<TITLE>', // title (optional)
    '<BODY>', // body (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)
);

Create SMS

Create a new SMS message.

  • Request
    • messageId string
      required

      Message 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.

    • content string
      required

      SMS Content.

    • topics array

      List of Topic IDs.

    • users array

      List of User IDs.

    • targets array

      List of Targets IDs.

    • draft boolean

      Is message a draft

    • scheduledAt string

      Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.

  • Response
Endpoint
POST /messaging/messages/sms
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createSms(
    '<MESSAGE_ID>', // messageId
    '<CONTENT>', // content
    [], // topics (optional)
    [], // users (optional)
    [], // targets (optional)
    false, // draft (optional)
    '' // scheduledAt (optional)
);

Update SMS

Update an email message by its unique ID.

  • Request
    • messageId string
      required

      Message ID.

    • topics array

      List of Topic IDs.

    • users array

      List of User IDs.

    • targets array

      List of Targets IDs.

    • content string

      Email Content.

    • draft boolean

      Is message a draft

    • scheduledAt string

      Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.

  • Response
Endpoint
PATCH /messaging/messages/sms/{messageId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateSms(
    '<MESSAGE_ID>', // messageId
    [], // topics (optional)
    [], // users (optional)
    [], // targets (optional)
    '<CONTENT>', // content (optional)
    false, // draft (optional)
    '' // scheduledAt (optional)
);

Get message

Get a message by its unique ID.

  • Request
    • messageId string
      required

      Message ID.

  • Response
Endpoint
GET /messaging/messages/{messageId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.getMessage(
    '<MESSAGE_ID>' // messageId
);

Delete message

Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message.

  • Request
    • messageId string
      required

      Message ID.

  • Response
    • 204 application/json
Endpoint
DELETE /messaging/messages/{messageId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.delete(
    '<MESSAGE_ID>' // messageId
);

List message logs

Get the message activity logs listed by its unique ID.

  • Request
    • messageId string
      required

      Message ID.

    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Only supported methods are limit and offset

  • Response
Endpoint
GET /messaging/messages/{messageId}/logs
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.listMessageLogs(
    '<MESSAGE_ID>', // messageId
    [] // queries (optional)
);

List message targets

Get a list of the targets associated with a message.

  • Request
    • messageId string
      required

      Message ID.

    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, providerId, identifier, providerType

  • Response
Endpoint
GET /messaging/messages/{messageId}/targets
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.listTargets(
    '<MESSAGE_ID>', // messageId
    [] // queries (optional)
);

List providers

Get a list of all providers from the current Appwrite project.

  • Request
    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled

    • search string

      Search term to filter your list results. Max length: 256 chars.

  • Response
Endpoint
GET /messaging/providers
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.listProviders(
    [], // queries (optional)
    '<SEARCH>' // search (optional)
);

Create APNS provider

Create a new Apple Push Notification service provider.

  • Request
    • providerId string
      required

      Provider 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.

    • name string
      required

      Provider name.

    • authKey string

      APNS authentication key.

    • authKeyId string

      APNS authentication key ID.

    • teamId string

      APNS team ID.

    • bundleId string

      APNS bundle ID.

    • sandbox boolean

      Use APNS sandbox environment.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
POST /messaging/providers/apns
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createApnsProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name
    '<AUTH_KEY>', // authKey (optional)
    '<AUTH_KEY_ID>', // authKeyId (optional)
    '<TEAM_ID>', // teamId (optional)
    '<BUNDLE_ID>', // bundleId (optional)
    false, // sandbox (optional)
    false // enabled (optional)
);

Update APNS provider

Update a Apple Push Notification service provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • name string

      Provider name.

    • enabled boolean

      Set as enabled.

    • authKey string

      APNS authentication key.

    • authKeyId string

      APNS authentication key ID.

    • teamId string

      APNS team ID.

    • bundleId string

      APNS bundle ID.

    • sandbox boolean

      Use APNS sandbox environment.

  • Response
Endpoint
PATCH /messaging/providers/apns/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateApnsProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name (optional)
    false, // enabled (optional)
    '<AUTH_KEY>', // authKey (optional)
    '<AUTH_KEY_ID>', // authKeyId (optional)
    '<TEAM_ID>', // teamId (optional)
    '<BUNDLE_ID>', // bundleId (optional)
    false // sandbox (optional)
);

Create FCM provider

Create a new Firebase Cloud Messaging provider.

  • Request
    • providerId string
      required

      Provider 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.

    • name string
      required

      Provider name.

    • serviceAccountJSON object

      FCM service account JSON.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
POST /messaging/providers/fcm
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createFcmProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name
    {}, // serviceAccountJSON (optional)
    false // enabled (optional)
);

Update FCM provider

Update a Firebase Cloud Messaging provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • name string

      Provider name.

    • enabled boolean

      Set as enabled.

    • serviceAccountJSON object

      FCM service account JSON.

  • Response
Endpoint
PATCH /messaging/providers/fcm/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateFcmProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name (optional)
    false, // enabled (optional)
    {} // serviceAccountJSON (optional)
);

Create Mailgun provider

Create a new Mailgun provider.

  • Request
    • providerId string
      required

      Provider 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.

    • name string
      required

      Provider name.

    • apiKey string

      Mailgun API Key.

    • domain string

      Mailgun Domain.

    • isEuRegion boolean

      Set as EU region.

    • fromName string

      Sender Name.

    • fromEmail string

      Sender email address.

    • replyToName string

      Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well.

    • replyToEmail string

      Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
POST /messaging/providers/mailgun
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createMailgunProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name
    '<API_KEY>', // apiKey (optional)
    '<DOMAIN>', // domain (optional)
    false, // isEuRegion (optional)
    '<FROM_NAME>', // fromName (optional)
    'email@example.com', // fromEmail (optional)
    '<REPLY_TO_NAME>', // replyToName (optional)
    'email@example.com', // replyToEmail (optional)
    false // enabled (optional)
);

Update Mailgun provider

Update a Mailgun provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • name string

      Provider name.

    • apiKey string

      Mailgun API Key.

    • domain string

      Mailgun Domain.

    • isEuRegion boolean

      Set as EU region.

    • enabled boolean

      Set as enabled.

    • fromName string

      Sender Name.

    • fromEmail string

      Sender email address.

    • replyToName string

      Name set in the reply to field for the mail. Default value is sender name.

    • replyToEmail string

      Email set in the reply to field for the mail. Default value is sender email.

  • Response
Endpoint
PATCH /messaging/providers/mailgun/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateMailgunProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name (optional)
    '<API_KEY>', // apiKey (optional)
    '<DOMAIN>', // domain (optional)
    false, // isEuRegion (optional)
    false, // enabled (optional)
    '<FROM_NAME>', // fromName (optional)
    'email@example.com', // fromEmail (optional)
    '<REPLY_TO_NAME>', // replyToName (optional)
    '<REPLY_TO_EMAIL>' // replyToEmail (optional)
);

Create Msg91 provider

Create a new MSG91 provider.

  • Request
    • providerId string
      required

      Provider 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.

    • name string
      required

      Provider name.

    • templateId string

      Msg91 template ID

    • senderId string

      Msg91 sender ID.

    • authKey string

      Msg91 auth key.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
POST /messaging/providers/msg91
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createMsg91Provider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name
    '<TEMPLATE_ID>', // templateId (optional)
    '<SENDER_ID>', // senderId (optional)
    '<AUTH_KEY>', // authKey (optional)
    false // enabled (optional)
);

Update Msg91 provider

Update a MSG91 provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • name string

      Provider name.

    • enabled boolean

      Set as enabled.

    • templateId string

      Msg91 template ID.

    • senderId string

      Msg91 sender ID.

    • authKey string

      Msg91 auth key.

  • Response
Endpoint
PATCH /messaging/providers/msg91/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateMsg91Provider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name (optional)
    false, // enabled (optional)
    '<TEMPLATE_ID>', // templateId (optional)
    '<SENDER_ID>', // senderId (optional)
    '<AUTH_KEY>' // authKey (optional)
);

Create Sendgrid provider

Create a new Sendgrid provider.

  • Request
    • providerId string
      required

      Provider 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.

    • name string
      required

      Provider name.

    • apiKey string

      Sendgrid API key.

    • fromName string

      Sender Name.

    • fromEmail string

      Sender email address.

    • replyToName string

      Name set in the reply to field for the mail. Default value is sender name.

    • replyToEmail string

      Email set in the reply to field for the mail. Default value is sender email.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
POST /messaging/providers/sendgrid
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createSendgridProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name
    '<API_KEY>', // apiKey (optional)
    '<FROM_NAME>', // fromName (optional)
    'email@example.com', // fromEmail (optional)
    '<REPLY_TO_NAME>', // replyToName (optional)
    'email@example.com', // replyToEmail (optional)
    false // enabled (optional)
);

Update Sendgrid provider

Update a Sendgrid provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • name string

      Provider name.

    • enabled boolean

      Set as enabled.

    • apiKey string

      Sendgrid API key.

    • fromName string

      Sender Name.

    • fromEmail string

      Sender email address.

    • replyToName string

      Name set in the Reply To field for the mail. Default value is Sender Name.

    • replyToEmail string

      Email set in the Reply To field for the mail. Default value is Sender Email.

  • Response
Endpoint
PATCH /messaging/providers/sendgrid/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateSendgridProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name (optional)
    false, // enabled (optional)
    '<API_KEY>', // apiKey (optional)
    '<FROM_NAME>', // fromName (optional)
    'email@example.com', // fromEmail (optional)
    '<REPLY_TO_NAME>', // replyToName (optional)
    '<REPLY_TO_EMAIL>' // replyToEmail (optional)
);

Create SMTP provider

Create a new SMTP provider.

  • Request
    • providerId string
      required

      Provider 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.

    • name string
      required

      Provider name.

    • host string
      required

      SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as smtp1.example.com:25;smtp2.example.com. You can also specify encryption type, for example: tls://smtp1.example.com:587;ssl://smtp2.example.com:465". Hosts will be tried in order.

    • port integer

      The default SMTP server port.

    • username string

      Authentication username.

    • password string

      Authentication password.

    • encryption string

      Encryption type. Can be omitted, 'ssl', or 'tls'

    • autoTLS boolean

      Enable SMTP AutoTLS feature.

    • mailer string

      The value to use for the X-Mailer header.

    • fromName string

      Sender Name.

    • fromEmail string

      Sender email address.

    • replyToName string

      Name set in the reply to field for the mail. Default value is sender name.

    • replyToEmail string

      Email set in the reply to field for the mail. Default value is sender email.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
POST /messaging/providers/smtp
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createSmtpProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name
    '<HOST>', // host
    1, // port (optional)
    '<USERNAME>', // username (optional)
    '<PASSWORD>', // password (optional)
    sdk.SmtpEncryption.None, // encryption (optional)
    false, // autoTLS (optional)
    '<MAILER>', // mailer (optional)
    '<FROM_NAME>', // fromName (optional)
    'email@example.com', // fromEmail (optional)
    '<REPLY_TO_NAME>', // replyToName (optional)
    'email@example.com', // replyToEmail (optional)
    false // enabled (optional)
);

Update SMTP provider

Update a SMTP provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • name string

      Provider name.

    • host string

      SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as smtp1.example.com:25;smtp2.example.com. You can also specify encryption type, for example: tls://smtp1.example.com:587;ssl://smtp2.example.com:465". Hosts will be tried in order.

    • port integer

      SMTP port.

    • username string

      Authentication username.

    • password string

      Authentication password.

    • encryption string

      Encryption type. Can be 'ssl' or 'tls'

    • autoTLS boolean

      Enable SMTP AutoTLS feature.

    • mailer string

      The value to use for the X-Mailer header.

    • fromName string

      Sender Name.

    • fromEmail string

      Sender email address.

    • replyToName string

      Name set in the Reply To field for the mail. Default value is Sender Name.

    • replyToEmail string

      Email set in the Reply To field for the mail. Default value is Sender Email.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
PATCH /messaging/providers/smtp/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateSmtpProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name (optional)
    '<HOST>', // host (optional)
    1, // port (optional)
    '<USERNAME>', // username (optional)
    '<PASSWORD>', // password (optional)
    sdk.SmtpEncryption.None, // encryption (optional)
    false, // autoTLS (optional)
    '<MAILER>', // mailer (optional)
    '<FROM_NAME>', // fromName (optional)
    'email@example.com', // fromEmail (optional)
    '<REPLY_TO_NAME>', // replyToName (optional)
    '<REPLY_TO_EMAIL>', // replyToEmail (optional)
    false // enabled (optional)
);

Create Telesign provider

Create a new Telesign provider.

  • Request
    • providerId string
      required

      Provider 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.

    • name string
      required

      Provider name.

    • from string

      Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.

    • customerId string

      Telesign customer ID.

    • apiKey string

      Telesign API key.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
POST /messaging/providers/telesign
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createTelesignProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name
    '+12065550100', // from (optional)
    '<CUSTOMER_ID>', // customerId (optional)
    '<API_KEY>', // apiKey (optional)
    false // enabled (optional)
);

Update Telesign provider

Update a Telesign provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • name string

      Provider name.

    • enabled boolean

      Set as enabled.

    • customerId string

      Telesign customer ID.

    • apiKey string

      Telesign API key.

    • from string

      Sender number.

  • Response
Endpoint
PATCH /messaging/providers/telesign/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateTelesignProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name (optional)
    false, // enabled (optional)
    '<CUSTOMER_ID>', // customerId (optional)
    '<API_KEY>', // apiKey (optional)
    '<FROM>' // from (optional)
);

Create Textmagic provider

Create a new Textmagic provider.

  • Request
    • providerId string
      required

      Provider 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.

    • name string
      required

      Provider name.

    • from string

      Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.

    • username string

      Textmagic username.

    • apiKey string

      Textmagic apiKey.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
POST /messaging/providers/textmagic
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createTextmagicProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name
    '+12065550100', // from (optional)
    '<USERNAME>', // username (optional)
    '<API_KEY>', // apiKey (optional)
    false // enabled (optional)
);

Update Textmagic provider

Update a Textmagic provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • name string

      Provider name.

    • enabled boolean

      Set as enabled.

    • username string

      Textmagic username.

    • apiKey string

      Textmagic apiKey.

    • from string

      Sender number.

  • Response
Endpoint
PATCH /messaging/providers/textmagic/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateTextmagicProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name (optional)
    false, // enabled (optional)
    '<USERNAME>', // username (optional)
    '<API_KEY>', // apiKey (optional)
    '<FROM>' // from (optional)
);

Create Twilio provider

Create a new Twilio provider.

  • Request
    • providerId string
      required

      Provider 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.

    • name string
      required

      Provider name.

    • from string

      Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.

    • accountSid string

      Twilio account secret ID.

    • authToken string

      Twilio authentication token.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
POST /messaging/providers/twilio
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createTwilioProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name
    '+12065550100', // from (optional)
    '<ACCOUNT_SID>', // accountSid (optional)
    '<AUTH_TOKEN>', // authToken (optional)
    false // enabled (optional)
);

Update Twilio provider

Update a Twilio provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • name string

      Provider name.

    • enabled boolean

      Set as enabled.

    • accountSid string

      Twilio account secret ID.

    • authToken string

      Twilio authentication token.

    • from string

      Sender number.

  • Response
Endpoint
PATCH /messaging/providers/twilio/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateTwilioProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name (optional)
    false, // enabled (optional)
    '<ACCOUNT_SID>', // accountSid (optional)
    '<AUTH_TOKEN>', // authToken (optional)
    '<FROM>' // from (optional)
);

Create Vonage provider

Create a new Vonage provider.

  • Request
    • providerId string
      required

      Provider 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.

    • name string
      required

      Provider name.

    • from string

      Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.

    • apiKey string

      Vonage API key.

    • apiSecret string

      Vonage API secret.

    • enabled boolean

      Set as enabled.

  • Response
Endpoint
POST /messaging/providers/vonage
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createVonageProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name
    '+12065550100', // from (optional)
    '<API_KEY>', // apiKey (optional)
    '<API_SECRET>', // apiSecret (optional)
    false // enabled (optional)
);

Update Vonage provider

Update a Vonage provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • name string

      Provider name.

    • enabled boolean

      Set as enabled.

    • apiKey string

      Vonage API key.

    • apiSecret string

      Vonage API secret.

    • from string

      Sender number.

  • Response
Endpoint
PATCH /messaging/providers/vonage/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateVonageProvider(
    '<PROVIDER_ID>', // providerId
    '<NAME>', // name (optional)
    false, // enabled (optional)
    '<API_KEY>', // apiKey (optional)
    '<API_SECRET>', // apiSecret (optional)
    '<FROM>' // from (optional)
);

Get provider

Get a provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

  • Response
Endpoint
GET /messaging/providers/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.getProvider(
    '<PROVIDER_ID>' // providerId
);

Delete provider

Delete a provider by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

  • Response
    • 204 application/json
Endpoint
DELETE /messaging/providers/{providerId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.deleteProvider(
    '<PROVIDER_ID>' // providerId
);

List provider logs

Get the provider activity logs listed by its unique ID.

  • Request
    • providerId string
      required

      Provider ID.

    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Only supported methods are limit and offset

  • Response
Endpoint
GET /messaging/providers/{providerId}/logs
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.listProviderLogs(
    '<PROVIDER_ID>', // providerId
    [] // queries (optional)
);

List subscriber logs

Get the subscriber activity logs listed by its unique ID.

  • Request
    • subscriberId string
      required

      Subscriber ID.

    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Only supported methods are limit and offset

  • Response
Endpoint
GET /messaging/subscribers/{subscriberId}/logs
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.listSubscriberLogs(
    '<SUBSCRIBER_ID>', // subscriberId
    [] // queries (optional)
);

List topics

Get a list of all topics from the current Appwrite project.

  • Request
    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, description, emailTotal, smsTotal, pushTotal

    • search string

      Search term to filter your list results. Max length: 256 chars.

  • Response
Endpoint
GET /messaging/topics
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.listTopics(
    [], // queries (optional)
    '<SEARCH>' // search (optional)
);

Create topic

Create a new topic.

  • Request
    • topicId string
      required

      Topic ID. Choose a custom Topic ID or a new Topic ID.

    • name string
      required

      Topic Name.

    • subscribe array

      An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. learn more about roles. Maximum of 100 roles are allowed, each 64 characters long.

  • Response
    • 201 application/json
Endpoint
POST /messaging/topics
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.createTopic(
    '<TOPIC_ID>', // topicId
    '<NAME>', // name
    ["any"] // subscribe (optional)
);

Get topic

Get a topic by its unique ID.

  • Request
    • topicId string
      required

      Topic ID.

  • Response
    • 200 application/json
Endpoint
GET /messaging/topics/{topicId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.getTopic(
    '<TOPIC_ID>' // topicId
);

Update topic

Update a topic by its unique ID.

  • Request
    • topicId string
      required

      Topic ID.

    • name string

      Topic Name.

    • subscribe array

      An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. learn more about roles. Maximum of 100 roles are allowed, each 64 characters long.

  • Response
    • 200 application/json
Endpoint
PATCH /messaging/topics/{topicId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.updateTopic(
    '<TOPIC_ID>', // topicId
    '<NAME>', // name (optional)
    ["any"] // subscribe (optional)
);

Delete topic

Delete a topic by its unique ID.

  • Request
    • topicId string
      required

      Topic ID.

  • Response
    • 204 application/json
Endpoint
DELETE /messaging/topics/{topicId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.deleteTopic(
    '<TOPIC_ID>' // topicId
);

List topic logs

Get the topic activity logs listed by its unique ID.

  • Request
    • topicId string
      required

      Topic ID.

    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Only supported methods are limit and offset

  • Response
Endpoint
GET /messaging/topics/{topicId}/logs
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.listTopicLogs(
    '<TOPIC_ID>', // topicId
    [] // queries (optional)
);

List subscribers

Get a list of all subscribers from the current Appwrite project.

  • Request
    • topicId string
      required

      Topic ID. The topic ID subscribed to.

    • queries array

      Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, provider, type, enabled

    • search string

      Search term to filter your list results. Max length: 256 chars.

  • Response
Endpoint
GET /messaging/topics/{topicId}/subscribers
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.listSubscribers(
    '<TOPIC_ID>', // topicId
    [], // queries (optional)
    '<SEARCH>' // search (optional)
);

Create subscriber

Create a new subscriber.

  • Request
    • topicId string
      required

      Topic ID. The topic ID to subscribe to.

    • subscriberId string
      required

      Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.

    • targetId string
      required

      Target ID. The target ID to link to the specified Topic ID.

  • Response
Endpoint
POST /messaging/topics/{topicId}/subscribers
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
    .setProject('<YOUR_PROJECT_ID>') // Your project ID
    .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token

const messaging = new sdk.Messaging(client);

const result = await messaging.createSubscriber(
    '<TOPIC_ID>', // topicId
    '<SUBSCRIBER_ID>', // subscriberId
    '<TARGET_ID>' // targetId
);

Get subscriber

Get a subscriber by its unique ID.

  • Request
    • topicId string
      required

      Topic ID. The topic ID subscribed to.

    • subscriberId string
      required

      Subscriber ID.

  • Response
Endpoint
GET /messaging/topics/{topicId}/subscribers/{subscriberId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://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.getSubscriber(
    '<TOPIC_ID>', // topicId
    '<SUBSCRIBER_ID>' // subscriberId
);

Delete subscriber

Delete a subscriber by its unique ID.

  • Request
    • topicId string
      required

      Topic ID. The topic ID subscribed to.

    • subscriberId string
      required

      Subscriber ID.

  • Response
    • 204 application/json
Endpoint
DELETE /messaging/topics/{topicId}/subscribers/{subscriberId}
Node.js
const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
    .setProject('<YOUR_PROJECT_ID>') // Your project ID
    .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token

const messaging = new sdk.Messaging(client);

const result = await messaging.deleteSubscriber(
    '<TOPIC_ID>', // topicId
    '<SUBSCRIBER_ID>' // subscriberId
);