Loader

C#

 
Overview

Use Clickatell’s C# script library with our HTTP or REST messaging APIs to interact with the Clickatell SMS Gateway. The C# script below allows you to send one- or two-way SMS messages using Clickatell’s SMS Platform.

View on Github


Requirements
  • This script is built with .NETFramework 4.5.2
  • Newtonsoft.JSON 9.0.1
 
Installation
  • Add Rest.cs and API.cs into your project from the Scripts folder
  • Add the Newtonsoft.JSON package to your project or the newtonsoft.json.dll file to your project

Using the class

You call the class by using:

private string response;
private string api;
Dictionary<stringstring> Params = new Dictionary<stringstring>();
response = Api.SendSMS(api, Params);

Where:

  • api is your API key given to you on the platform
  • Params is a dictionary of the parameters to send with the SMS

Required parameters
  • to: the telephone number you are sending the SMS to including the country code (must start with ‘+’)
  • content: the SMS message that must be sent

A full list of parameters can be found here.

You can add the parameters to the dictionary by using the following code:

Params.Add("content""this is a message");
Params.Add("to""+27745555555");
 

To add more than one number to send the message to multiple recipients, comma delimit the numbers:

Params.Add("to""+27745555555,+27748888888,+27835555555");
 

Once the SMS is sent, it will return a response in the form of a JSON array. The JSON array will include an array of messages that each in turn contains:

  • An API Message ID
  • Whether the message was accepted or not (true/false)
  • The number it was sent to
  • An error message if applicable (see link below to error messages)

Read more:

 

Did you find this information informative?

Other Resources

Ask the Community

Visit Stack Overflow to join our community of developers and find the answer you need

Contact Support

Contact our support team and one of our agents will be in touch with you to answer any questions you have