Send an SMS Using C#
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 GitHubInstallation Instructions
Visual Studio
- Open your project or create a new one.
- Right click on the References in Solution Explorer window and select Manage NuGet Packages.
- When the package manager dialog appears, type TextmagicRest in the search window.
- Click Install.
SharpDevelop
- Open your project or create a new one.
- Click Project, choose Manage packages.
- When the package manager dialog appears, type TextmagicRest in the search window.
- Click Install.
Manual installation via the Package Manager Console
- Open your project or create a new one.
- Open the NuGet Package Manager Console from the Tools menu.
- 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 [email protected].