Sending SMS

This section covers configuring Hasura notify microservice to send SMS. Notify currently supports sending SMS via Twilio and MSG91.

Sending an SMS

POST /v1/send/sms

Example request:

POST https://notify.<cluster-name>.hasura-app.io/v1/send/sms HTTP/1.1
Content-Type: application/json
Authorization: Bearer <auth-token> # optional if cookie is set
X-Hasura-Role: <role>  # optional. Pass if only specific user role has access

{
  "to": "9876543210",
  "countryCode": "91",
  "message": "This is the body of SMS"
}

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": "<provider-reference-id>",
  "detail": "<details>"
}

Authorization header is not required if the request is being made from a browser, since Cookie will be set.

Note

If you are writing backed code and want to send SMS, you can directly contact the Notify microservice using the URL http://notify.hasura/v1/send/sms. You will also need to set headers X-Hasura-User-Id: 1 and X-Hasura-User-Role: admin to make the request as admin.

SMS Providers: