Topics

Before proceeding

Ensure you install the CLI, log in to your Appwrite account, and initialize your Appwrite project.

The Appwrite CLI can create, update, delete, and get topics, as well as configure the provider and the subscribers.

Initialize topic

Create a new topic using the following command:

appwrite init topics

Pull topics

You can also pull your existing Appwrite topics from the Appwrite Console using the pull command in the folder containing your appwrite.json file.

Shell
appwrite pull topics

appwrite.json

After initializing your Appwrite project and pulling your existing topics, your appwrite.json file should look similar to the following:

JSON
{
    "projectId": "<PROJECT_ID>",
    "topics": [
        {
            "$id": "N1IzUIJiOicGbhJye",
            "$createdAt": "2024-07-01T14:40:43.381+00:00",
            "$updatedAt": "2024-07-01T14:40:43.381+00:00",
            "name": "Anime",
            "emailTotal": 3,
            "smsTotal": 0,
            "pushTotal": 0,
            "subscribe": [
                "users"
            ]
        },
        {
            "$id": "eyJhbGciOiJIUzI1N",
            "$createdAt": "2024-07-01T14:41:19.029+00:00",
            "$updatedAt": "2024-07-01T14:41:28.751+00:00",
            "name": "Music",
            "emailTotal": 2,
            "smsTotal": 0,
            "pushTotal": 0,
            "subscribe": [
                "users",
                "any"
            ]
        }
    ]
}

Push topics

Use the push command in the folder containing your appwrite.json file to push the changes you made.

Shell
appwrite push topics

Commands

The messaging command allows you to send, get, update, and delete push notifications, SMS text messages, and emails. You can create a new provider like Mailgun and SendGrid and create, update, get, and delete topics and subscribers. Appwrite messaging CLI commands generally follow the following syntax:

Shell
appwrite messaging [COMMAND] [OPTIONS]
CommandDescription
list-messages [options]Get a list of all messages from the current Appwrite project.
create-email [options]Create a new email message.
update-email [options]Update an email message by its unique ID.
create-push [options]Create a new push notification.
update-push [options]Update a push notification by its unique ID.
create-sms [options]Create a new SMS message.
updateSms [options]Update an email message by its unique ID.
get-message [options]Get a message by its unique ID.
delete [options]Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message.
list-message-logs [options]Get the message activity logs listed by its unique ID.
list-targets [options]Get a list of the targets associated with a message.
list-providers [options]Get a list of all providers from the current Appwrite project.
create-apns-provider [options]Create a new Apple Push Notification service provider.
update-apns-provider [options]Update an Apple Push Notification service provider by its unique ID.
create-fcm-provider [options]Create a new Firebase Cloud Messaging provider.
update-fcm-provider [options]Update a Firebase Cloud Messaging provider by its unique ID.
create-mailgun-provider [options]Create a new Mailgun provider.
update-mailgun-provider [options]Update a Mailgun provider by its unique ID.
create-msg91-provider [options]Create a new MSG91 provider.
update-msg91-provider [options]Update a MSG91 provider by its unique ID.
create-sendgrid-provider [options]Create a new Sendgrid provider.
update-sendgrid-provider [options]Update a Sendgrid provider by its unique ID.
create-smtp-provider [options]Create a new SMTP provider.
update-smtp-provider [options]Update a SMTP provider by its unique ID.
create-telesign-provider [options]Create a new Telesign provider.
update-telesign-provider [options]Update a Telesign provider by its unique ID.
create-textmagic-provider [options]Create a new Textmagic provider.
update-textmagic-provider [options]Update a Textmagic provider by its unique ID.
create-twilio-provider [options]Create a new Twilio provider.
update-twilio-provider [options]Update a Twilio provider by its unique ID.
create-vonage-provider [options]Create a new Vonage provider.
update-vonage-provider [options]Update a Vonage provider by its unique ID.
get-provider [options]Get a provider by its unique ID.
delete-provider [options]Delete a provider by its unique ID.
list-provider-logs [options]Get the provider activity logs listed by its unique ID.
list-subscriber-logs [options]Get the subscriber activity logs listed by its unique ID.
list-topics [options]Get a list of all topics from the current Appwrite project.
create-topic [options]Create a new topic.
get-topic [options]Get a topic by its unique ID.
update-topic [options]Update a topic by its unique ID.
delete-topic [options]Delete a topic by its unique ID.
list-topic-logs [options]Get the topic activity logs listed by its unique ID.
list-subscribers [options]Get a list of all subscribers from the current Appwrite project.
create-subscriber [options]Create a new subscriber.
get-subscriber [options]Get a subscriber by its unique ID.
delete-subscriber [options]Delete a subscriber by its unique ID.