Tutorial section - SMS
Send SMS with REST using C#
Sending SMS with the REST API using the C# programming languageRelated
SMPP Load BalancerSMPP Load Test tool
SMSC Simulator
SMPP SMS Gateway platform
Tyr SMS Gateway
SMS Code Bench
The RestSharp
library can be used to make REST requests using C# to send SMS.
REST requirements and resources
REST (REpresentational State Transfer) uses the HTTP protocol (HTTPS) for conveying SMS operations. A REST account can easily be obtained for using the Tyr SMS Gateway. REST uses JSON to carry the parameters that relate to the REST operation that you are performing. The following are required to send SMS with REST:
- REST API Key
API key for the REST SMS API of the Melrose Labs Tyr SMS Gateway
C# requirements and resources
C# is a programming language and can be used to quickly and easily add SMS support for programmatically sending and receiving SMS messages. Use it for transactional messaging and notifications between your application and mobiles. The following are required to send SMS using C#:
- C#
C# programming language for the .NET platform
Requirements and resources
The following are required to send SMS with REST using C#:
- RestSharp
REST API client library for .NET
Code
The following example C# code makes a REST HTTPS call to the Melrose Labs SMS API endpoint to send the message Hello World €£$
to mobile number 447712345678
from MelroseLabs
. The transaction ID for the message is returned by the endpoint after a successful submission.
using RestSharp;
var client = new RestClient("https://api.melroselabs.com/sms/message");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "[API_KEY]");
request.AddHeader("Content-Type", "application/json");
request.RequestFormat = DataFormat.Json;
request.AddBody(new Item
{
destination = "447712345678",
message = "Hello World #$£",
source = "MelroseLabs"
});
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
Using in production
Whatever the language or API, you can send SMS and receive SMS between applications and mobiles for a wide range of uses with any of the trusted and reliable CPaaS services from Melrose Labs. Take a look at our Messaging, SMS gateway and Bulk SMS solutions, and sign-up for a Developer account on our Tyr SMS Gateway service to try us out.
We provide a wide range of CPaaS services and infrastructure to organisations, including cloud platforms that enable you to run your own SMS gateway.
Get in contact with us to find out more about CPaaS voice, messaging, video and identity from Melrose Labs.
Testing
For testing your application's SMS support when using the SMPP protocol, we recommend starting with the Melrose Labs SMSC Simulator service to simulate SMS message delivery to mobiles (MT SMS) and simulate SMS messages from mobiles (MO SMS). The SMSC Simulator supports SMPP v3.3, v3.4 and v5.
SMSC SimulatorFor live testing and delivery to mobiles, use the reliable and dependable Melrose Labs Tyr SMS Gateway for A2P, P2A, bulk, wholesale and business SMS, text marketing and other uses. The Melrose Labs Tyr SMS Gateway supports REST and SMPP APIs.
Tyr SMS GatewayAlternative APIs and languages
Other APIs covered in our tutorials that can be used for sending and receiving SMS using C# include: SMPP
Other languages covered in our tutorials that can be used for sending and receiving SMS with REST include: Python, PHP, Java, C++, Perl, Go, Node.js, Ruby