Tips and Tricks from my Experience

Sending SMS from .NET Application

Posted in 14, 2010, Application Architecture, December, Tuesday by Chakravarthy on December 14, 2010

Today, when visiting the MSDN forums, came across of a request about the subject of this post. While replying, thought of writing a post with visual aids. So that it would be more meaningful. But unfortunate that doesn’t support to upload the Images. Hence is the blog post.

Before we talk about .NET application, it is required to understand how SMS works and the integration with some application. Thus, let’s see what happens when some one sends SMS. Am not going to talk about SMS sent to any phone with 10 digits unique number, but am talking about sending SMS sent to less than 10 digits number, sent on some reserved interfaces (or) mass SMS receiving mechanism. Mostly these kind of requirements come into action when polling is required or a kind of reality shows like in USA and Sa Re Ga Ma Pa from Zee Tv in India.

Let’s start with how this kind of polling is offered by the Providers, called as SCS Providers ie., Short Code Service Providers. Any business person who is interested to utilize the services of such SCS first has to register with these SCSProviders. The SCSProviders charge according to their business plans. Here is a simple example about the pricing by one of the Indian SCS Provider

Short Code Number: 53426
    Short Code: <KEYWORD> As per request *(subject to availability)
    Sub Keyword: Multiple ( e.g. <ShortCode Keyword> <sub-keyword>)
    Control Panel: Web Based
    Auto-Welcome: An SMS will be send to the customer who will send your short code. This message can be customized from control panel. You can create different Welcome message for sub-keywords also.

  Reports: Daily Keyword/Sub Keyword based
    Database: Database of received SMS will be available in your account with us. (Web Based)
    Auto-Forward:To SMS (An SMS will be sent to desired number with Sender’s Mobile Number SMS Forwarding Cost: 25 P/SMS)

  • To Email (An Email will be sent to desired mail id with Sender’s Mobile Number, Keyword)
  • Web URL (This will submit the sender’s mobile number and keyword to desired web-page and the result of the page will used as Reply Back SMS. This web page could be dynamic in nature to give any user specific reply back. e.g. Result of Exam through SMS Request)

  Network Support: All India
    Setup Time: 48 Hrs. after approval of Keyword availability
    Setup Fee: NIL
    Monthly Rental: 4,500/- [4500 + 556 (Service Tax): Rs.5056]
    Quarterly Rental: 4,000/- [12000 + 1483 (Service Tax): Rs.13,483]
    Half Yearly Rental: 3,500/- [21,000 + 2596 (Service Tax): Rs.23,596]
    Yearly Rental: 3,000/- [36,000 + 4450 (Service Tax): Rs.40,450]                                  
Rs. 4,450/- Off on Yearly subscription.
One Year Pricing (after discount): Rs.36,000/-

Hope you are now clear about the pricing details of any SCS Provider. Let me show you how the SCS provider works with some visual representation. The infrastructure and the working model would be some thing similar to that of the below mentioned


Now that you understand how your SMS communication is implemented in real world, let’s see how this can be extended so that any application can handle the situation when SMS received as well as sent.

Most of the SCS Providers do the URL Forwarding, which means they invoke any of the given URL when they get an SMS. Thus, it is the responsibility of the business application to provide any URL to receive the information about the SMS. The URL would be some thing like,

Which means that the business owner should expose some interface by means of a WebPage (or) WebService (or) what ever is feasible for the business. Once the business application gets the information, it is all within the workflow of the rules that is orchestrated by the business owners. The entire crux of this post remains in this last paragraph. Well, for a web developer, I don’t think it is required to explain how to collect the query parameters as well as send any query parameters. This is all fine to collect the SMS sent by the users on a reserved number like 53426. But now, how about sending back some information to the phones via SMS?

As you see in the diagram that every SCSProviders have a feature called as URL Forwarding, they would also be having a web page where you can send some data that would be passed onto the SMS sender. The page that is provided by the SCSProvider would be some thing like  .. Hope now you are totally aware of how to send SMS with the help of SCS Providers as well as receive SMS in a web application.

What do you say?