Tuesday, July 21, 2009

API for Receiving an SMS

Both our services, Interlinked & SMS Gateway, have the ability to push text messages to other third party systems. This is great for integrating a website, CRM system, feedback service or anything else! Messages are simply forwarded to your site after we receive them, using a simple set of parameters.

HTTP Posts
Messages are sent via an HTTP Post. This is a super complicated, highly sophisticated way of saying that a message is sent across the internet! For the non-techies, a message is sent almost exactly the same way you would type a URL to visit a website.

There is no black art to it, it really is as simple as typing a URL in. Our server mimics this in a programming way, but the end result is the same.

A standard URL is made up of these parts and the message notifications take the same format:

http://www.mywebsite.com/sms.asp?parameter=setting

This is broken down to:
http://www.mywebsite.com - Domain name
/sms.asp - Page to handle the messages
?parameter=setting - Query string that contains the message

When setting up a URL, you would specify the domain and page. We would then append the text message info to the query string part run the full URL to send the message over to your server.

For the techies, I know this is not quite accurate, but I’m keeping it simple!

The Message
The message is contained in the query string part of the URL. This follows a standard set of parameters to pass the message across. Each parameter is lowercase, and will be URL Encoded to prevent the message breaking the URL.

SMSFrom: Telephone number of the person texting
SMSTo: Shortcode that message was sent to
SMSDate: Time of the notification: (yyyy-mm-dd hh:mm:ss)
Network: Carrier/ network, if known
SMSID: Unique ID for this message request
SMSMSG: The actual text message being sent

Each parameter is simply appended to the URL using an & sign. All programmers can then use this to dissect the query string and pick out the message details.

Status Codes & Retries
We capture the status code from your site when we send a message on. This allows us see if the message was delivered to you successfully and provide feedback if it did not make it. These status codes are the same 404 page not found code you see when you miss-type a URL.

SMS Gateway allows you to view these directly (as it’s a developer orientated resource) by viewing the inbound message page. For more info on all the status codes, check out: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes

Currently we don’t retry the messages. So if your system is not working, the message won’t make it. However, we’re hoping to change that in the near future.

Setting up a Keyword URL
This is really easy. In Interlinked, just set the keyword up as normal, then in the developer options enter the URL & page (eg http://www.mywebsite.com/sms.asp) in the “URL Alert To” box and click save.



For SMS Gateway, just click the account tab and set up a keyword. After it is added, click the “Click to configure a route” and enter the URL in!

0 comments:

Post a Comment

Power your business with our robust, scalable and simple to use SMS platform. Learn more about our Partner Network at:

www.interlinked.mobi

Our simple to use, dedicated API service, leveraging our relations with leading UK aggregators to keep your costs down.

www.smsgatewayhq.com

Older Posts