Appwrite is a opensource backend-as-a-service. I was doing lot of testing for long time and they released phone authentication which actually missed Indian based service provider. So I contributed MSG91 Adaptor for phone authentication. Since their exposed environment variable is not flexible enough, I created the adaptor with some workaround. Lets start configuring it
- Msg91 Account
- Approved Header & Template(For India based on TRAI Requirements)
- Self Hosted Appwrite Instance
- Login to MSG91
- Click On Flow
3. Add Flow
4. You can give flow name as you wish. Important part is in receiver value should be ##mobiles## and also for OTP in template is ##otp##
For Indian users Approved template ID should be mentioned. For Sender ID selecet "FromAPI", we are going to send from APPWRITE itself.
On Save Flow ID will be generated.
5. Next need to generate API key. For which navigate to API in menu and then click create New to genearte key for appwrite with reference name as appwrite.
6. Need to update Appwrite Environment Value as per pattern given below
_APP_PHONE_PROVIDER = phone://[senderID]:[authKey]@msg91 _APP_PHONE_FROM = [FlowId]
_APP_PHONE_PROVIDER = phone://DINESH:5e1e93cad6fc054d8e759a5b@msg91 _APP_PHONE_FROM = 3968636f704b303135323339
In Above example DINESH is sender ID, 5e1e93cad6fc054d8e759a5b is authKey which is generated in previous step, 3968636f704b303135323339 is flow ID.
Hope this help in configuring msg91 with appwrite. Since appwrite official document is not clear with this workaround, shared this.