Example code for SMS integration in language C#

Send SMS - REST API - JSON

            
var client = new RestClient("https://api.labsmobile.com/json/send");
client.Authenticator = new SimpleAuthenticator("username", "myusername", "password", "mypassword");
var request = new RestRequest(Method.POST);
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\"message\":\"Text of the SMS message\", \"tpoa\":\"Sender\",\"recipient\":[{\"msisdn\":\"12015550123\"},{\"msisdn\":\"447400123456\"},{\"msisdn\":\"5212221234567\"}]}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Credit inquiry - REST API - JSON

            
var client = new RestClient("https://api.labsmobile.com/json/balance");
client.Authenticator = new SimpleAuthenticator("username", "myusername", "password", "mypassword");
var request = new RestRequest(Method.GET);
request.AddHeader("Cache-Control", "no-cache");
IRestResponse response = client.Execute(request);

Send SMS - HTTP/GET

                
using System.Net;
using System.IO;

WebClient client = new WebClient();
client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
client.QueryString.Add("username", "xx@xx.xx");
client.QueryString.Add("password", "xxxxxxxx");
client.QueryString.Add("msisdn", "xxxx");
client.QueryString.Add("message", "This is an example message");
string baseurl ="http://api.labsmobile.com/get/send.php";
Stream data = client.OpenRead(baseurl);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();

Credit inquiry - HTTP/GET

                
using System.Net;
using System.IO;

WebClient client = new WebClient();
client.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
client.QueryString.Add("username", "xx@xx.xx");
client.QueryString.Add("password", "xxxxxxxx");
string baseurl ="http://api.labsmobile.com/get/balance.php";
Stream data = client.OpenRead(baseurl);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();

Send SMS - WebService

Within the VisualStudio.net program, in section Solution Explorer click on Add Service Reference. Copy the following URL: http://api.labsmobile.com/ws/services/LabsMobileWsdl.php?wsdl. Create a name for the Namespace for example"LabsMobileAPI".

                
 string resultado = new Client.LabsMobileAPI.SendSMS(
    "priv00x",
    "xx@xx.xxx",
    "xxxxxxxx",
    "<sms>
        <recipient>
            <msisdn>34609827393</msisdn>
        </recipient>
        <message><![CDATA[This is an example message]]></message>
    </sms>")

Credit inquiry - WebService

Within the VisualStudio.net program, in section Solution Explorer click on Add Service Reference. Copy the following URL: http://api.labsmobile.com/ws/services/LabsMobileWsdl.php?wsdl. Create a name for the Namespace for example"LabsMobileAPI".

                
 string resultado = new Client.LabsMobileAPI.GetCredit(
    "xx@xx.xxx",
    "xxxxxxxx")
  • contact form support

    Sign up!

    Create a user account and send your SMS messages in seconds. You will have all the functionalities and benefits in the same platform.

    Send from API and manage your account with our online application WebSMS.

    Create new account
  • IT consultant, Computer security and processes recommends LabsMobile

    Sending access codes, authentication, user identification and validation processes with SMS messages.

    Watch more reviews
  • dashboard aplicación online

    Maximum reliability at the best price

    At LabsMobile we only offer direct routes of maximum reliability and quality. Enjoy our platform and all our services for the price of an SMS.

    Pay ONLY for sent messages.

    Check our rates
  • dashboard aplicación online

    Need more info? Contact us!

    Our technical department has professionals with years of experience and we have made multiple integrations.

    We guide and help you through the process.

    Request technical support
  • Import your database of telephone numbers

    This tutorial explains how to import your database of telephones to the LabsMobile WebSMS platform.

    Ir al tutorial
loader