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://cloud.appwrite.io/v1
List messages
Get a list of all messages from the current Appwrite project.
Request
queries 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 Search term to filter your list results. Max length: 256 chars.
Response
200
GET /messaging/messages
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let messageList = try await messaging.listMessages(
queries: [], // optional
search: "<SEARCH>" // optional
)
Create email
Create a new email message.
Request
messageId requiredMessage 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 requiredEmail Subject.
content requiredEmail Content.
topics List of Topic IDs.
users List of User IDs.
targets List of Targets IDs.
cc Array of target IDs to be added as CC.
bcc Array of target IDs to be added as BCC.
attachments 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 Is message a draft
html Is content of type HTML
scheduledAt Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.
Response
201
POST /messaging/messages/email
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let message = try await messaging.createEmail(
messageId: "<MESSAGE_ID>",
subject: "<SUBJECT>",
content: "<CONTENT>",
topics: [], // optional
users: [], // optional
targets: [], // optional
cc: [], // optional
bcc: [], // optional
attachments: [], // optional
draft: false, // optional
html: false, // optional
scheduledAt: "" // optional
)
Update email
Update an email message by its unique ID.
Request
messageId requiredMessage ID.
topics List of Topic IDs.
users List of User IDs.
targets List of Targets IDs.
subject Email Subject.
content Email Content.
draft Is message a draft
html Is content of type HTML
cc Array of target IDs to be added as CC.
bcc Array of target IDs to be added as BCC.
scheduledAt Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.
attachments 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
200
PATCH /messaging/messages/email/{messageId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let message = try await messaging.updateEmail(
messageId: "<MESSAGE_ID>",
topics: [], // optional
users: [], // optional
targets: [], // optional
subject: "<SUBJECT>", // optional
content: "<CONTENT>", // optional
draft: false, // optional
html: false, // optional
cc: [], // optional
bcc: [], // optional
scheduledAt: "", // optional
attachments: [] // optional
)
Create push notification
Create a new push notification.
Request
messageId requiredMessage 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 requiredTitle for push notification.
body requiredBody for push notification.
topics List of Topic IDs.
users List of User IDs.
targets List of Targets IDs.
data Additional Data for push notification.
action Action for push notification.
image 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 Icon for push notification. Available only for Android and Web Platform.
sound Sound for push notification. Available only for Android and IOS Platform.
color Color for push notification. Available only for Android Platform.
tag Tag for push notification. Available only for Android Platform.
badge Badge for push notification. Available only for IOS Platform.
draft Is message a draft
scheduledAt Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.
Response
201
POST /messaging/messages/push
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let message = try await messaging.createPush(
messageId: "<MESSAGE_ID>",
title: "<TITLE>",
body: "<BODY>",
topics: [], // optional
users: [], // optional
targets: [], // optional
data: [:], // optional
action: "<ACTION>", // optional
image: "[ID1:ID2]", // optional
icon: "<ICON>", // optional
sound: "<SOUND>", // optional
color: "<COLOR>", // optional
tag: "<TAG>", // optional
badge: "<BADGE>", // optional
draft: false, // optional
scheduledAt: "" // optional
)
Update push notification
Update a push notification by its unique ID.
Request
messageId requiredMessage ID.
topics List of Topic IDs.
users List of User IDs.
targets List of Targets IDs.
title Title for push notification.
body Body for push notification.
data Additional Data for push notification.
action Action for push notification.
image 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 Icon for push notification. Available only for Android and Web platforms.
sound Sound for push notification. Available only for Android and iOS platforms.
color Color for push notification. Available only for Android platforms.
tag Tag for push notification. Available only for Android platforms.
badge Badge for push notification. Available only for iOS platforms.
draft Is message a draft
scheduledAt Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.
Response
200
PATCH /messaging/messages/push/{messageId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let message = try await messaging.updatePush(
messageId: "<MESSAGE_ID>",
topics: [], // optional
users: [], // optional
targets: [], // optional
title: "<TITLE>", // optional
body: "<BODY>", // optional
data: [:], // optional
action: "<ACTION>", // optional
image: "[ID1:ID2]", // optional
icon: "<ICON>", // optional
sound: "<SOUND>", // optional
color: "<COLOR>", // optional
tag: "<TAG>", // optional
badge: 0, // optional
draft: false, // optional
scheduledAt: "" // optional
)
Create SMS
Create a new SMS message.
Request
messageId requiredMessage 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 requiredSMS Content.
topics List of Topic IDs.
users List of User IDs.
targets List of Targets IDs.
draft Is message a draft
scheduledAt Scheduled delivery time for message in ISO 8601 format. DateTime value must be in future.
Response
201
POST /messaging/messages/sms
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let message = try await messaging.createSms(
messageId: "<MESSAGE_ID>",
content: "<CONTENT>",
topics: [], // optional
users: [], // optional
targets: [], // optional
draft: false, // optional
scheduledAt: "" // optional
)
Update SMS
Update an email message by its unique ID.
PATCH /messaging/messages/sms/{messageId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let message = try await messaging.updateSms(
messageId: "<MESSAGE_ID>",
topics: [], // optional
users: [], // optional
targets: [], // optional
content: "<CONTENT>", // optional
draft: false, // optional
scheduledAt: "" // optional
)
GET /messaging/messages/{messageId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let message = try await messaging.getMessage(
messageId: "<MESSAGE_ID>"
)
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 requiredMessage ID.
Response
204
DELETE /messaging/messages/{messageId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let result = try await messaging.delete(
messageId: "<MESSAGE_ID>"
)
List message logs
Get the message activity logs listed by its unique ID.
Request
messageId requiredMessage ID.
queries 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
200
GET /messaging/messages/{messageId}/logs
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let logList = try await messaging.listMessageLogs(
messageId: "<MESSAGE_ID>",
queries: [] // optional
)
List message targets
Get a list of the targets associated with a message.
Request
messageId requiredMessage ID.
queries 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
200
GET /messaging/messages/{messageId}/targets
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let targetList = try await messaging.listTargets(
messageId: "<MESSAGE_ID>",
queries: [] // optional
)
List providers
Get a list of all providers from the current Appwrite project.
Request
queries 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 Search term to filter your list results. Max length: 256 chars.
Response
200
GET /messaging/providers
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let providerList = try await messaging.listProviders(
queries: [], // optional
search: "<SEARCH>" // optional
)
Create APNS provider
Create a new Apple Push Notification service provider.
Request
providerId requiredProvider 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 requiredProvider name.
authKey APNS authentication key.
authKeyId APNS authentication key ID.
teamId APNS team ID.
bundleId APNS bundle ID.
sandbox Use APNS sandbox environment.
enabled Set as enabled.
Response
201
POST /messaging/providers/apns
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.createApnsProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>",
authKey: "<AUTH_KEY>", // optional
authKeyId: "<AUTH_KEY_ID>", // optional
teamId: "<TEAM_ID>", // optional
bundleId: "<BUNDLE_ID>", // optional
sandbox: false, // optional
enabled: false // optional
)
Update APNS provider
Update a Apple Push Notification service provider by its unique ID.
Request
providerId requiredProvider ID.
name Provider name.
enabled Set as enabled.
authKey APNS authentication key.
authKeyId APNS authentication key ID.
teamId APNS team ID.
bundleId APNS bundle ID.
sandbox Use APNS sandbox environment.
Response
200
PATCH /messaging/providers/apns/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.updateApnsProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>", // optional
enabled: false, // optional
authKey: "<AUTH_KEY>", // optional
authKeyId: "<AUTH_KEY_ID>", // optional
teamId: "<TEAM_ID>", // optional
bundleId: "<BUNDLE_ID>", // optional
sandbox: false // optional
)
Create FCM provider
Create a new Firebase Cloud Messaging provider.
Request
providerId requiredProvider 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 requiredProvider name.
serviceAccountJSON FCM service account JSON.
enabled Set as enabled.
Response
201
POST /messaging/providers/fcm
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.createFcmProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>",
serviceAccountJSON: [:], // optional
enabled: false // optional
)
Update FCM provider
Update a Firebase Cloud Messaging provider by its unique ID.
Request
providerId requiredProvider ID.
name Provider name.
enabled Set as enabled.
serviceAccountJSON FCM service account JSON.
Response
200
PATCH /messaging/providers/fcm/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.updateFcmProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>", // optional
enabled: false, // optional
serviceAccountJSON: [:] // optional
)
Create Mailgun provider
Create a new Mailgun provider.
Request
providerId requiredProvider 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 requiredProvider name.
apiKey Mailgun API Key.
domain Mailgun Domain.
isEuRegion Set as EU region.
fromName Sender Name.
fromEmail Sender email address.
replyToName 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 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 Set as enabled.
Response
201
POST /messaging/providers/mailgun
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.createMailgunProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>",
apiKey: "<API_KEY>", // optional
domain: "<DOMAIN>", // optional
isEuRegion: false, // optional
fromName: "<FROM_NAME>", // optional
fromEmail: "email@example.com", // optional
replyToName: "<REPLY_TO_NAME>", // optional
replyToEmail: "email@example.com", // optional
enabled: false // optional
)
Update Mailgun provider
Update a Mailgun provider by its unique ID.
Request
providerId requiredProvider ID.
name Provider name.
apiKey Mailgun API Key.
domain Mailgun Domain.
isEuRegion Set as EU region.
enabled Set as enabled.
fromName Sender Name.
fromEmail Sender email address.
replyToName Name set in the reply to field for the mail. Default value is sender name.
replyToEmail Email set in the reply to field for the mail. Default value is sender email.
Response
200
PATCH /messaging/providers/mailgun/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.updateMailgunProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>", // optional
apiKey: "<API_KEY>", // optional
domain: "<DOMAIN>", // optional
isEuRegion: false, // optional
enabled: false, // optional
fromName: "<FROM_NAME>", // optional
fromEmail: "email@example.com", // optional
replyToName: "<REPLY_TO_NAME>", // optional
replyToEmail: "<REPLY_TO_EMAIL>" // optional
)
Create Msg91 provider
Create a new MSG91 provider.
Request
providerId requiredProvider 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 requiredProvider name.
templateId Msg91 template ID
senderId Msg91 sender ID.
authKey Msg91 auth key.
enabled Set as enabled.
Response
201
POST /messaging/providers/msg91
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.createMsg91Provider(
providerId: "<PROVIDER_ID>",
name: "<NAME>",
templateId: "<TEMPLATE_ID>", // optional
senderId: "<SENDER_ID>", // optional
authKey: "<AUTH_KEY>", // optional
enabled: false // optional
)
Update Msg91 provider
Update a MSG91 provider by its unique ID.
Request
providerId requiredProvider ID.
name Provider name.
enabled Set as enabled.
templateId Msg91 template ID.
senderId Msg91 sender ID.
authKey Msg91 auth key.
Response
200
PATCH /messaging/providers/msg91/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.updateMsg91Provider(
providerId: "<PROVIDER_ID>",
name: "<NAME>", // optional
enabled: false, // optional
templateId: "<TEMPLATE_ID>", // optional
senderId: "<SENDER_ID>", // optional
authKey: "<AUTH_KEY>" // optional
)
Create Sendgrid provider
Create a new Sendgrid provider.
Request
providerId requiredProvider 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 requiredProvider name.
apiKey Sendgrid API key.
fromName Sender Name.
fromEmail Sender email address.
replyToName Name set in the reply to field for the mail. Default value is sender name.
replyToEmail Email set in the reply to field for the mail. Default value is sender email.
enabled Set as enabled.
Response
201
POST /messaging/providers/sendgrid
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.createSendgridProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>",
apiKey: "<API_KEY>", // optional
fromName: "<FROM_NAME>", // optional
fromEmail: "email@example.com", // optional
replyToName: "<REPLY_TO_NAME>", // optional
replyToEmail: "email@example.com", // optional
enabled: false // optional
)
Update Sendgrid provider
Update a Sendgrid provider by its unique ID.
Request
providerId requiredProvider ID.
name Provider name.
enabled Set as enabled.
apiKey Sendgrid API key.
fromName Sender Name.
fromEmail Sender email address.
replyToName Name set in the Reply To field for the mail. Default value is Sender Name.
replyToEmail Email set in the Reply To field for the mail. Default value is Sender Email.
Response
200
PATCH /messaging/providers/sendgrid/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.updateSendgridProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>", // optional
enabled: false, // optional
apiKey: "<API_KEY>", // optional
fromName: "<FROM_NAME>", // optional
fromEmail: "email@example.com", // optional
replyToName: "<REPLY_TO_NAME>", // optional
replyToEmail: "<REPLY_TO_EMAIL>" // optional
)
Create SMTP provider
Create a new SMTP provider.
Request
providerId requiredProvider 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 requiredProvider name.
host requiredSMTP 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 The default SMTP server port.
username Authentication username.
password Authentication password.
encryption Encryption type. Can be omitted, 'ssl', or 'tls'
autoTLS Enable SMTP AutoTLS feature.
mailer The value to use for the X-Mailer header.
fromName Sender Name.
fromEmail Sender email address.
replyToName Name set in the reply to field for the mail. Default value is sender name.
replyToEmail Email set in the reply to field for the mail. Default value is sender email.
enabled Set as enabled.
Response
201
POST /messaging/providers/smtp
import Appwrite
import AppwriteEnums
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.createSmtpProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>",
host: "<HOST>",
port: 1, // optional
username: "<USERNAME>", // optional
password: "<PASSWORD>", // optional
encryption: .none, // optional
autoTLS: false, // optional
mailer: "<MAILER>", // optional
fromName: "<FROM_NAME>", // optional
fromEmail: "email@example.com", // optional
replyToName: "<REPLY_TO_NAME>", // optional
replyToEmail: "email@example.com", // optional
enabled: false // optional
)
Update SMTP provider
Update a SMTP provider by its unique ID.
Request
providerId requiredProvider ID.
name Provider name.
host 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 SMTP port.
username Authentication username.
password Authentication password.
encryption Encryption type. Can be 'ssl' or 'tls'
autoTLS Enable SMTP AutoTLS feature.
mailer The value to use for the X-Mailer header.
fromName Sender Name.
fromEmail Sender email address.
replyToName Name set in the Reply To field for the mail. Default value is Sender Name.
replyToEmail Email set in the Reply To field for the mail. Default value is Sender Email.
enabled Set as enabled.
Response
200
PATCH /messaging/providers/smtp/{providerId}
import Appwrite
import AppwriteEnums
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.updateSmtpProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>", // optional
host: "<HOST>", // optional
port: 1, // optional
username: "<USERNAME>", // optional
password: "<PASSWORD>", // optional
encryption: .none, // optional
autoTLS: false, // optional
mailer: "<MAILER>", // optional
fromName: "<FROM_NAME>", // optional
fromEmail: "email@example.com", // optional
replyToName: "<REPLY_TO_NAME>", // optional
replyToEmail: "<REPLY_TO_EMAIL>", // optional
enabled: false // optional
)
Create Telesign provider
Create a new Telesign provider.
Request
providerId requiredProvider 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 requiredProvider name.
from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
customerId Telesign customer ID.
apiKey Telesign API key.
enabled Set as enabled.
Response
201
POST /messaging/providers/telesign
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.createTelesignProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>",
from: "+12065550100", // optional
customerId: "<CUSTOMER_ID>", // optional
apiKey: "<API_KEY>", // optional
enabled: false // optional
)
Update Telesign provider
Update a Telesign provider by its unique ID.
Request
providerId requiredProvider ID.
name Provider name.
enabled Set as enabled.
customerId Telesign customer ID.
apiKey Telesign API key.
from Sender number.
Response
200
PATCH /messaging/providers/telesign/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.updateTelesignProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>", // optional
enabled: false, // optional
customerId: "<CUSTOMER_ID>", // optional
apiKey: "<API_KEY>", // optional
from: "<FROM>" // optional
)
Create Textmagic provider
Create a new Textmagic provider.
Request
providerId requiredProvider 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 requiredProvider name.
from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
username Textmagic username.
apiKey Textmagic apiKey.
enabled Set as enabled.
Response
201
POST /messaging/providers/textmagic
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.createTextmagicProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>",
from: "+12065550100", // optional
username: "<USERNAME>", // optional
apiKey: "<API_KEY>", // optional
enabled: false // optional
)
Update Textmagic provider
Update a Textmagic provider by its unique ID.
Request
providerId requiredProvider ID.
name Provider name.
enabled Set as enabled.
username Textmagic username.
apiKey Textmagic apiKey.
from Sender number.
Response
200
PATCH /messaging/providers/textmagic/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.updateTextmagicProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>", // optional
enabled: false, // optional
username: "<USERNAME>", // optional
apiKey: "<API_KEY>", // optional
from: "<FROM>" // optional
)
Create Twilio provider
Create a new Twilio provider.
Request
providerId requiredProvider 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 requiredProvider name.
from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
accountSid Twilio account secret ID.
authToken Twilio authentication token.
enabled Set as enabled.
Response
201
POST /messaging/providers/twilio
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.createTwilioProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>",
from: "+12065550100", // optional
accountSid: "<ACCOUNT_SID>", // optional
authToken: "<AUTH_TOKEN>", // optional
enabled: false // optional
)
Update Twilio provider
Update a Twilio provider by its unique ID.
Request
providerId requiredProvider ID.
name Provider name.
enabled Set as enabled.
accountSid Twilio account secret ID.
authToken Twilio authentication token.
from Sender number.
Response
200
PATCH /messaging/providers/twilio/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.updateTwilioProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>", // optional
enabled: false, // optional
accountSid: "<ACCOUNT_SID>", // optional
authToken: "<AUTH_TOKEN>", // optional
from: "<FROM>" // optional
)
Create Vonage provider
Create a new Vonage provider.
Request
providerId requiredProvider 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 requiredProvider name.
from Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
apiKey Vonage API key.
apiSecret Vonage API secret.
enabled Set as enabled.
Response
201
POST /messaging/providers/vonage
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.createVonageProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>",
from: "+12065550100", // optional
apiKey: "<API_KEY>", // optional
apiSecret: "<API_SECRET>", // optional
enabled: false // optional
)
Update Vonage provider
Update a Vonage provider by its unique ID.
Request
providerId requiredProvider ID.
name Provider name.
enabled Set as enabled.
apiKey Vonage API key.
apiSecret Vonage API secret.
from Sender number.
Response
200
PATCH /messaging/providers/vonage/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.updateVonageProvider(
providerId: "<PROVIDER_ID>",
name: "<NAME>", // optional
enabled: false, // optional
apiKey: "<API_KEY>", // optional
apiSecret: "<API_SECRET>", // optional
from: "<FROM>" // optional
)
GET /messaging/providers/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let provider = try await messaging.getProvider(
providerId: "<PROVIDER_ID>"
)
Delete provider
Delete a provider by its unique ID.
Request
providerId requiredProvider ID.
Response
204
DELETE /messaging/providers/{providerId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let result = try await messaging.deleteProvider(
providerId: "<PROVIDER_ID>"
)
List provider logs
Get the provider activity logs listed by its unique ID.
Request
providerId requiredProvider ID.
queries 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
200
GET /messaging/providers/{providerId}/logs
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let logList = try await messaging.listProviderLogs(
providerId: "<PROVIDER_ID>",
queries: [] // optional
)
List subscriber logs
Get the subscriber activity logs listed by its unique ID.
Request
subscriberId requiredSubscriber ID.
queries 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
200
GET /messaging/subscribers/{subscriberId}/logs
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let logList = try await messaging.listSubscriberLogs(
subscriberId: "<SUBSCRIBER_ID>",
queries: [] // optional
)
List topics
Get a list of all topics from the current Appwrite project.
Request
queries 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 Search term to filter your list results. Max length: 256 chars.
Response
200
GET /messaging/topics
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let topicList = try await messaging.listTopics(
queries: [], // optional
search: "<SEARCH>" // optional
)
Create topic
Create a new topic.
Request
topicId requiredTopic ID. Choose a custom Topic ID or a new Topic ID.
name requiredTopic Name.
subscribe 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
POST /messaging/topics
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let topic = try await messaging.createTopic(
topicId: "<TOPIC_ID>",
name: "<NAME>",
subscribe: ["any"] // optional
)
GET /messaging/topics/{topicId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let topic = try await messaging.getTopic(
topicId: "<TOPIC_ID>"
)
Update topic
Update a topic by its unique ID.
Request
topicId requiredTopic ID.
name Topic Name.
subscribe 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
PATCH /messaging/topics/{topicId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let topic = try await messaging.updateTopic(
topicId: "<TOPIC_ID>",
name: "<NAME>", // optional
subscribe: ["any"] // optional
)
DELETE /messaging/topics/{topicId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let result = try await messaging.deleteTopic(
topicId: "<TOPIC_ID>"
)
List topic logs
Get the topic activity logs listed by its unique ID.
Request
topicId requiredTopic ID.
queries 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
200
GET /messaging/topics/{topicId}/logs
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let logList = try await messaging.listTopicLogs(
topicId: "<TOPIC_ID>",
queries: [] // optional
)
List subscribers
Get a list of all subscribers from the current Appwrite project.
Request
topicId requiredTopic ID. The topic ID subscribed to.
queries 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 Search term to filter your list results. Max length: 256 chars.
Response
200
GET /messaging/topics/{topicId}/subscribers
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let subscriberList = try await messaging.listSubscribers(
topicId: "<TOPIC_ID>",
queries: [], // optional
search: "<SEARCH>" // optional
)
Create subscriber
Create a new subscriber.
Request
topicId requiredTopic ID. The topic ID to subscribe to.
subscriberId requiredSubscriber ID. Choose a custom Subscriber ID or a new Subscriber ID.
targetId requiredTarget ID. The target ID to link to the specified Topic ID.
Response
201
POST /messaging/topics/{topicId}/subscribers
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
let messaging = Messaging(client)
let subscriber = try await messaging.createSubscriber(
topicId: "<TOPIC_ID>",
subscriberId: "<SUBSCRIBER_ID>",
targetId: "<TARGET_ID>"
)
Get subscriber
Get a subscriber by its unique ID.
Request
topicId requiredTopic ID. The topic ID subscribed to.
subscriberId requiredSubscriber ID.
Response
200
GET /messaging/topics/{topicId}/subscribers/{subscriberId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
let messaging = Messaging(client)
let subscriber = try await messaging.getSubscriber(
topicId: "<TOPIC_ID>",
subscriberId: "<SUBSCRIBER_ID>"
)
Delete subscriber
Delete a subscriber by its unique ID.
Request
topicId requiredTopic ID. The topic ID subscribed to.
subscriberId requiredSubscriber ID.
Response
204
DELETE /messaging/topics/{topicId}/subscribers/{subscriberId}
import Appwrite
let client = Client()
.setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
.setJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...") // Your secret JSON Web Token
let messaging = Messaging(client)
let result = try await messaging.deleteSubscriber(
topicId: "<TOPIC_ID>",
subscriberId: "<SUBSCRIBER_ID>"
)