Sending SMS via C#.Net

This guide will explain in a few steps how to make your first call to the C#.Net API for sending SMS.


1 - The API key

Authentication requires an API key. This key is indispensable because it identifies you to carry out all your requests via our SMS API.

  1. Log in to your iSendPro Telecom account here
  2. Then click on the tab "My account" then on the sub-heading "My API"
  3. Note your API key "xxxxxxxxxxxxxxxxxxxxxxxxxx"

2 - Allow access

IP control improves security by limiting access to your API key. You can either populate a list of allowed IPs, or completely disable IP control.

  1. Click on the tab "My account" then on the sub-heading "My API"
  2. In the "Manage IP addresses" section, add the calling IP address or simply disable the IP control.
Be careful ! The IP control is activated by default !

3 - Make your first call to the API

  1. Install the isendpro package from the Manager Nuget linked package : C#.Net-client-examples

Sample script for sending a simple SMS :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
	    ApiClient apiclient = new ApiClient();
            SmsApi smsapi = new SmsApi(apiclient);
            SmsUniqueRequest susreq = new SmsUniqueRequest();
            susreq.Keyid = "API_KEY_HERE";
            susreq.Num = "PHONE_NUMBER_HERE";
            susreq.Sms = "This is a one-time test!";
            Console.WriteLine(susreq.ToJson());
            try
            {
                SMSReponse smsreponse = smsapi.SendSms(susreq);
                Console.WriteLine(smsreponse.ToJson());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception! " + e.StackTrace + " " + e.Message);
            }
            Console.WriteLine("Enter 'Y' and Enter...");
            Console.ReadLine();
        }

    }
}

Here is the expected response after executing this script :

{  
   "etat":{  
      "etat":[  
         {  
            "code":0,
            "tel":"06xxxxxxxx",
            "message":"Your message has been sent"
         }
      ]
   }
}

4 - Parameters

It is possible to specify different parameters (optional) :

date_envoi Date in YYYY-MM-DD format hh: mm. Use only in case of delayed sending
sender The Sender must be an alphanumeric string between 4 and 11 characters. Accepted characters are numbers between 0 and 9, letters between A and Z and space. It can not consist only of numbers.
tracker The tracker must be an alphanumeric string of less than 50 characters. This tracker will then be returned as a urls parameter for return receipts.
smslong The maximum number of concatenated SMS you authorize for sending this SMS. The long SMS allows to exceed the limit of 160 characters by sending a message consisting of several SMS. To obtain a dynamic calculation of the number of SMS then you have to fill in smslong = 999
ucs2 It is also possible to send SMS in non-Latin alphabet (Russian, Chinese, Arabic, etc.) on numbers outside mainland France. To do this, the request should be encoded in UTF-8 format and contain the following argument ucs2 = 1 Due to technical constraints, a single SMS can not exceed 70 characters (instead of the usual 160) and in the case of SMS long, each SMS can not exceed 67 characters.

Example to define the sender in a message : susreq.Emetteur = "iSendPro"

5 - Technical support

If you have technical questions, please contact support at support@isendpro.com. The support is available every day of the week from 9am to 1pm and from 2pm to 5pm (GMT+1).