Send an SMS Using C#

Share on Facebook0Tweet about this on TwitterShare on LinkedIn0Share on Google+0

The TextMagic C# wrapper can save you a lot of time, as it includes all the necessary API commands and tests. It only takes a few seconds to download it from GitHub and to install it into your own app or software. After installation, you’ll then be able to send text messages.

Get it now on GitHub

Installation Instructions

Visual Studio

  1. Open your project or create a new one.
  2. Right click on the References in Solution Explorer window and select Manage NuGet Packages.
  3. When the package manager dialog appears, type TextmagicRest in the search window.
  4. Click Install.

SharpDevelop

  1. Open your project or create a new one.
  2. Click Project, choose Manage packages.
  3. When the package manager dialog appears, type TextmagicRest in the search window.
  4. Click Install.

Manual installation via the Package Manager Console

  1. Open your project or create a new one.
  2. Open the NuGet Package Manager Console from the Tools menu.
  3. Type the following command in the console:
Install-Package TextmagicRest 

Requirements

The C# wrapper for the TextMagic API has the following requirements:

  • NET 4.0 or higher
  • RestSharp (= 105.1.0)

Send an SMS using C# (an example)

Below is an example of how to send text messages using C#.

using TextmagicRest;
using TextmagicRest.Model;
 
...
 
public void sendMessage() {
    var client = new Client("test", "my-api-key");
    var link = client.SendMessage("Hello from TextMagic API", "447860021130");
    if (link.Success) {
        Console.WriteLine("Message ID {0} has been successfully sent", link.Id);
    } else {
        Console.WriteLine("Message was not sent due to following exception: {0}", link.ClientException.Message)
    }
}

Support

If you need help with the wrapper or if you have any suggestions for improvements, please contact us by emailing support@textmagic.com.