Integrate SMS Into Your C# Based Web Applications Or Systems
The code sample below shows you how to send SMS messages quickly using a simple C# snippet based on the HTTP API. The script sends a single 1-way SMS message that will appear to come from "XYZCorp".
Send a 1-Way SMS Using C#
// Import the required libraries using System.Net; using System.IO; // Create a new web client to send the request WebClient client = New WebClient(); // Add the various parameters that need to go out // with the HTTP request client.QueryString.Add("username", "my_username"); client.QueryString.Add("password", "SecrEt12345"); client.QueryString.Add("message", "Hello World"); client.QueryString.Add("type", "1-way"); client.QueryString.Add("senderid", "XYZCorp"); client.QueryString.Add("to", "61400000000"); // Set the URL to send the request to. Please note, // you can use HTTP or HTTPS string url = "http://api.directsms.com.au/s3/http /send_message" // Send the request and read the response Stream stream = client.OpenRead(url); StreamReader reader = New StreamReader(stream); string response = reader.ReadToEnd(); // Close the data stream and HTTP connection stream.Close(); reader.Close(); // The response from the gateway is going to look like // this: // id: a4c5ad77ad6faf5aa55f66a // // In the event of an error, it will look like this: // err: invalid login credentials
The full HTTP/S API documentation details all available features of directSMS' Bulk SMS Gateway. For additional help or if you have any questions, please contact our helpful support team.
How To Get Started
- Register online through our website and you can be sending SMS messages within minutes. The system will give you some free credits to use during your free trial.
- Notify the support team that you would like to enable API access on your new account.
- Create your client application using your chosen interface.
- Integrate your solution and start sending some test messages.
- Purchase more credits when you run out by clicking the Purchase Credits button once you log in.
- Talk to us about our bulk rates. Post-paid monthly accounts are available to corporate or government customers.
Get Started Now
FREE Business SMS Trial