Send/Receive SMS using Java

In the last couple of months for some reason or the other I have faced a requirement to send/receive SMS for the applications that I have been working on. This post talks about how I achieved the same.

There are plenty of SMS vendors that provide simple APIs (typically HTTP based) that allow one to send an SMS. Once you register with any vendor (typically after paying), then all it takes to send an SMS is to invoke a URL programmatically. I have been using for my last project and have been pretty happy with their service. The service gives me 500 credits (500 SMS) for Rs 300/- (60 paisa an SMS – which I’m okay to spend). To know more about the API format, visit their website and click on Developer API Link.

If for any reason, you don’t like this option; There are other ways of sending an SMS. I had earlier written a simple application that could interact with a handset connected with the computer over serial cable through AT Commands and instruct it to send an SMS. It could also read the inbox in similar manner. Other options include professional services that provide interface with an SMSC over simpler APIs. Check out this product from Simple Wire. Though I haven’t really used it, but it looks fairly neat.

I’m pretty sure there are plenty of other options that exist and might probably be better for one reason or the other. If you know of some, please feel free to add a comment.

To receive an SMS, you would need to set up a short-code. There are plenty of vendors that allow one to do this. Searching Google with keywords like “SMS Shortcode India” for example will expose you a list of vendors. Once you get a short code registered for yourself (again by paying some amount), for a particular keyword, your vendor would allow you to configure handling of this keyword. If your application requirements are static in nature, it will provide tools to send you notifications (email or sms) on every sms that comes to your short-code. If your needs are dynamic, then you can set up the key-word so that it hits a URL (of your application) passing on the incoming sms along with the sender’s mobile number and whatever you return (in plain text) is sent back to the sender.

One thought on “Send/Receive SMS using Java

  1. We are from were are giving sms rate as cheap as 25 paisa per sms and planning to reduce still depending upon the minimum commitment. any one intrested in this can get back to us on our dedicated phone 91 97010 44333.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s