Friday 28 March 2014

Bulk SMS Gateway C# Code for HTTP API

Today , I am going to show you how to send BULK SMS from any Website or Software. Every Bulk SMS provides uses SMS Gateway that are of two types :
1. Promotional
2. Transactional
First one is used to broadcast SMS to multiple users at a time which take minimum 5-10 minutes of time to deliver SMS. Messages are sent through low priority gateways. You won't get unique Sender ID.
On the other hands , Transactional type SMS uses high priority network and also allow use of unique Sender ID.
Many Bulk SMS provider companies gives API to intregate with custom web and software application. Though implemention of SMS gateway API is simple but its quite tricky.
Checkout below code which demonstrate send multiple SMS on one click:


protected void Button5_Click(object sender, EventArgs e)
    {
       
        string[] strArray = sms.Split(new char[1]
      {
        ','
      });

        int count = strArray.Count();
        
        try
        {
           WebClient client = new WebClient();
            // Add a user agent header in case the requested URI contains a query.
            for (int i = 0; i < count; i++)
            {
                client.Headers.Add("user-agent", "Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
              baseurl = "http://login.redseo.in/API/SendMessage.ashx?user=test&password=0123&phone="+strArray[i]+"&text="+TextBox5.Text+"&type=t&senderid=TESTIN";
               
                 data = client.OpenRead(baseurl);
                 reader = new StreamReader(data);
                string s = reader.ReadToEnd();
            }
            data.Close();
            reader.Close();
           
            //return (s);
        }
        catch (Exception exc)
        {
            Label128.Text = "Failed.";
            
        }
    }

5 comments:

  1. Bulk SMS service provides a unique opportunity to e-commerce website where they can bridge the gap for customer service
    by offering SMS Service Technology. It is very helpful to communicate new customer. Thanks for Sharing this article.

    ReplyDelete
  2. Also advise to connect API SMS through the service http://www.intistele.com/ . The ideal solution for your business to increase brand awareness and increase sales.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Thanks for sharing this blog and code for sending multiple sms in single click. Especialy in India mobile users are increasing more and more.So bulk sms is right way to communicate in large number.Bulk SMS API

    ReplyDelete

Blogger