MSG91 is a cloud communication platform from India that provides APIs for SMS, WhatsApp, voice, and email. It sends every SMS through a template that you create in the MSG91 dashboard.
How does the integration work?
You can use the MSG91 provider in Appwrite Messaging to send customized SMS messages to your users, such as reminders, promotions, announcements, and custom authentication flows. Messages can be sent immediately or scheduled, to topics, users, or individual targets.
Appwrite sends each message through MSG91's flow API with the sender ID and template you configure. For every recipient, it passes your message text as the value of the content and otp variables, so your template must use one of those variables where the text should appear.
How to implement
To implement the MSG91 provider in Appwrite Messaging, there are several steps you must complete:
Step 1: Set up MSG91
First, sign up for an MSG91 account and collect the following details from the MSG91 dashboard:
| Field name | |
|---|---|
| Auth key | Open the username menu, select Authkey, verify your mobile number, and click Create Authkey. |
| Sender ID | Head to SMS > Sender ID and click Create sender ID. |
| Template ID | Create an SMS template that uses a content or otp variable where your message text should appear, then copy its template ID. |
Messages to Indian numbers also need a sender ID and template approved under India's DLT regulations.
Step 2: Add the MSG91 provider to your Appwrite project
For this step, you must create an account on Appwrite Cloud or self-host Appwrite if you haven't already. In your Appwrite project, head to Messaging > Providers, click Add provider, and choose SMS. Give your provider a name, choose MSG91, and click Save and continue.
In the Configure step, add the Auth key, Sender ID, and Template ID you saved from the MSG91 dashboard, then click Save and continue to enable the provider.
Step 3: Test the MSG91 provider
Before you proceed, you must already have at least one topic or target set up.
Go to Messaging > Messages, click Create message, and choose SMS. Write a test message, select one of your test targets, set the schedule to Now, and click Send. Check that the SMS arrives on your phone. If it doesn't, check the logs in the Appwrite Console and in your MSG91 dashboard.
To send SMS messages from your backend instead, follow the Send SMS messages guide with an Appwrite Server SDK.
Read more about MSG91 and Appwrite Messaging
If you would like to learn more about MSG91 and Appwrite Messaging, we have some resources that you should visit:
