Prerequisites
Before you begin:
- A SpringEdge account with an API key
- .NET 6 or higher (or .NET Framework 4.7.2+)
- No NuGet packages required — uses built-in
HttpClient - A DLT-registered sender ID and approved template (for India)
Zero NuGet Dependencies
Uses .NET's built-in HttpClient — no external packages
Async/Await
Non-blocking HTTP calls with C# async patterns
IHttpClientFactory
Production-ready with dependency injection and connection pooling
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
var apiKey = "YOUR_API_KEY";
var url = "https://api.springedge.com"
+ "/v1/sms/send";
var payload = new {
to = "+919876543210",
sender_id = "SPREDG",
message = "Your OTP is 482910",
type = "transactional"
};
using var client = new HttpClient();
client.DefaultRequestHeaders
.Authorization =
new AuthenticationHeaderValue(
"Bearer", apiKey);
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(
json, Encoding.UTF8,
"application/json");
var response = await client
.PostAsync(url, content);
var body = await response.Content
.ReadAsStringAsync();
Console.WriteLine($"Status: "
+ $"{response.StatusCode}");
Console.WriteLine($"Response: {body}");
// Response:
// {
// "status": "success",
// "message_id": "msg_a1b2c3d4",
// "credits_used": 1
// }
C# HttpClient
Basic C# Example
This example uses .NET's built-in HttpClient to send an SMS through the SpringEdge API. No NuGet packages needed — works in any .NET 6+ project.
For .NET Framework (4.7.2+), the same code works — just add System.Net.Http and System.Text.Json NuGet packages.
Quick Start:
dotnet new console -n SendSms- Replace
YOUR_API_KEYwith your SpringEdge key - Run:
dotnet run
ASP.NET CORE
ASP.NET Core Service
For production ASP.NET Core apps, register a typed HttpClient via IHttpClientFactory for proper connection pooling and lifecycle management.
Register in Program.cs:
builder.Services.AddHttpClient<SmsService>();
Inject and use in any controller: await _sms.SendAsync(phone, message);
// Services/SmsService.cs
public class SmsService
{
private readonly HttpClient _http;
private readonly string _apiKey;
public SmsService(
HttpClient http,
IConfiguration config)
{
_http = http;
_apiKey = config["SpringEdge:ApiKey"];
_http.BaseAddress = new Uri(
"https://api.springedge.com");
_http.DefaultRequestHeaders
.Authorization =
new AuthenticationHeaderValue(
"Bearer", _apiKey);
}
public async Task<string> SendAsync(
string phone, string message)
{
var payload = new {
to = phone,
sender_id = "SPREDG",
message,
type = "transactional"
};
var resp = await _http.PostAsJsonAsync(
"/v1/sms/send", payload);
return await resp.Content
.ReadAsStringAsync();
}
}
What You Can Build
OTP Verification
Add phone verification to ASP.NET Core Identity login and registration flows with one-time passwords.
Windows Service Alerts
Build a Windows Service that monitors systems and sends SMS alerts when thresholds are breached.
Azure Functions
Create serverless SMS functions on Azure that trigger on queue messages, HTTP calls, or timer schedules.
ERP Integration
Connect your .NET-based ERP or accounting software to send automated SMS for invoices, receipts, and reminders.
