Video:




To send an SMS through our API, you will need to make an HTTP POST request to 


https://<your_api_key>:<your_api_token><subdomain>/v1/Accounts/<your_sid>/Sms/send

 

  • Replace <your_api_key> and <your_api_token> with the API key and token created by you or use the default API and token.

  • Replace <your_sid> with your “Account sid”

  • Replace <subdomain> with the region of your account

    • <subdomain> of Singapore cluster is @api.exotel.com

    • <subdomain> of Mumbai cluster is @api.in.exotel.com

<your_api_key>, <your_api_token> and <your_sid> are available on the API settings page of your Exotel Dashboard  



The HTTP request, available parameters, and sample responses can be viewed on our developer channel.

Following are the mandatory parameters to be added along with the SMS API Request.

From:  Specify one of your ExoPhone or the Sender ID (header) linked to it.
- To: Mobile number to which SMS has to be sent.
- Body: Content (Template) of your SMS. 


 

Errors:


When there are errors with the SMS submission, the HTTP code will be not 200. Like any good REST API, we give appropriate HTTP codes which give you hints on what type of errors it is and how you can handle it. You can refer here for more details on HTTP codes.


In addition to the HTTP Status code, the body of the SMS contains an XML with the details of the error

The XML (in the HTTP body) is of this form:

 

<TwilioResponse>

<RestException>

         <Status>xxx</Status>

         <Message>Detailed error message</Message>

    </RestException>

</TwilioResponse>

 

The 'Status' is the HTTP code itself again

The 'Message' gives you more details on the error. 

 

Example Status and Messages are below.

 

Status

Message

400

 Invalid Parameters

400 

 Invalid Recipient [xxxx]

403 

 The account is not active

403

 Insufficient balance to send the SMS

403

 Account validity has expired 

429

 Too Many Requests 

500 

 Internal Server Error

 

NOTE: Do not rely on the "Message" while doing your integration. Always rely only on the HTTP 'Status' code. 

 

SMS Delivery Status:


Please refer here to how to monitor the delivery status of your SMS.

 

Sample PHP and Java code to send SMS is available on Github

 

Before you start sending transactional SMS through this API, Please test whether your content is matching a template. Otherwise, the SMS ends up becoming promotional and this causes a lot of confusion.

 

For a detailed description of these Statues, See Exotel SMS status codes


If you have any questions or concerns, please connect with us using the chat widget on your Exotel Dashboard or Whatsapp us on 08088919888.