//Windows SMS API integration code try
{
string strResult = ""; //Prepare you post parameters
var postValues = new List<KeyValuePair<string, string>>(); //Your Apikey key
postValues.Add(new KeyValuePair<string, string>("apikey", "YourApikey")); //Approved sender id(6 characters string only).
postValues.Add(new KeyValuePair<string, string>("senderid", "TESTIN")); //Message channel Promotional=1 or Transactional=2.
postValues.Add(new KeyValuePair<string, string>("channel", "2")); //Default is 0 for normal message, Set 8 for unicode sms postValues.Add(new KeyValuePair<string, string>("DCS", "0")); //Default is 0 for normal sms, Set 1 for immediate display. postValues.Add(new KeyValuePair<string, string>("flashsms", "0")); //Recipient mobile number (pass with comma seprated if need to send on more then one number).
postValues.Add(new KeyValuePair<string, string>("mobile", "9999999")); //Your message to send.
string message = HttpUtility.UrlEncode("Test message");
postValues.Add(new KeyValuePair<string, string>("message", message)); //Select route
postValues.Add(new KeyValuePair<string, string>("route","default"));
//Prepare API to send SMS
Uri requesturl = new Uri("http://login.smsgatewayhub.com/api/mt/SendSMS?"); //create httpclient request
var httpClient = new HttpClient();
var httpContent = new HttpRequestMessage(HttpMethod.Post, requesturl); httpContent.Headers.ExpectContinue = false; httpContent.Content = new FormUrlEncodedContent(postValues); HttpResponseMessage response = await httpClient.SendAsync(httpContent);
//Get response
var result = await response.Content.ReadAsStringAsync(); strResult = result.ToString(); response.Dispose();
httpClient.Dispose();
httpContent.Dispose();
}
catch (Exception ex)
{
throw ex;
}