"Currently incoming SMS feature is not available"


Currently, only Outgoing SMS services are available. For Outgoing SMS services, TRAI has made it mandatory to register in the DLT portals. Here are the detailed information: TRAI Regulations on Commercial Communications (DLT portal) - SMS in India


To respond to an Incoming SMS: 


There are two use-cases

  1. UseCase-1: You receive an incoming SMS, and you want to send a dynamic reply to the sender.
  2. UseCase-2: You receive an incoming SMS and you just want to get details of an incoming SMS at your server - without having to send back a reply SMS.


How to?

  1. In the Installed apps page, corresponding to your app, click on "Edit SMS app" 
  2. Drag and drop the "Send a Reply" applet into the app you are building.
  3. In the text box, you can enter a URL (instead of static text). 
  4. When there is an incoming SMS, Exotel will make an HTTP GET request to your web app at the above URL.
  5. Your web app should respond with the SMS body to send as a reply (See Details Below)


Before the GET request, Exotel will make an HTTP HEAD request to make sure that the URL is indeed returning the correct 'ContentType' as mandated below. 


HTTP Request (from Exotel to your URL)

The GET request that Exotel makes to the URL will have the following query parameters:


PARAMETER NAMEVALUE
SmsSidstring, unique identifier of that SMS
Fromstring, the number of the sender
Tostring, your Exotel Company number where the SMS was received
Datestring, Time when the SMS reached Exotel's servers
Bodystring, the contents of the SMS


Sample HTTP request (if the URL you have entered is http://example.com/exotel.php)

GET /exotel.php?SmsSid=xxxxxx&From=9052161119&To=56070&Date=xxxxx&Body=Hello+World  HTTP/1.1



HTTP Response (from your Web Server to Exotel)

UseCase-1: If you want to send an SMS back to the SMS-er, your Web Server

  • MUST set the Content-Type HTTP header to 'text/plain' and nothing else
  • MUST support a HEAD request from Exotel and return the exact same headers that it would for a GET request.
  • MUST put the SMS to reply within the HTTP body of the response


Below is a sample HTTP response from your Web Server

HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 130

Thanks for your order inquiry through SMS. Your order #12345 has been shipped already and will reach you in the next 2 - 3 days.

 


UseCase-2: If you don't want to send an SMS response back to the sender, your webserver

  • MUST set the Content-Length header to 0
  • MUST leave the body of the HTTP response empty


Need a techie for this integration?
 Check our Phone a Friend App 
GET /path/file.html HTTP/1.0