Official .NET client for the ClickSend API β send SMS, MMS, voice and email messages, run SMS and MMS campaigns, manage numbers, contacts and subaccounts, and pull delivery receipts and reporting through a single authenticated HTTPS client.
This library is generated from ClickSend's official OpenAPI v3 specification and is maintained by ClickSend. It covers every endpoint of the ClickSend REST API.
- π API reference: https://developers.clicksend.com/docs/rest/v3/
- π Dashboard & API credentials: https://dashboard.clicksend.com
- π Source & issues: https://github.com/ClickSend/clicksend-csharp-v2
- π¬ Support: https://help.clicksend.com
- Messaging β SMS, MMS, voice / text-to-speech, transactional email, email-to-SMS
- Campaigns β SMS and MMS campaigns
- Numbers & sender IDs β dedicated numbers, own numbers, alpha tags, default senders
- Contacts β contact lists, contacts and the address book
- Account & billing β account details, transactions, subaccounts, referrals, reseller accounts
- Delivery & reporting β delivery receipts, inbound messages, statistics
- Extras β URL shortening, file uploads, number verification, international messaging
- Typed models for every request and response, with async methods throughout
- HTTP Basic auth with your ClickSend username and API key
- Identifiable traffic β requests are sent with a
ClickSend-SDK/<version>/csharpUser-Agentby default - MIT licensed
- .NET 10.0 or newer
dotnet add package ClickSendEvery API class authenticates with HTTP Basic auth using your ClickSend username and API key, both available from the ClickSend Dashboard. Supply them through environment variables rather than hard-coding them:
export CLICKSEND_USERNAME="your-username"
export CLICKSEND_API_KEY="your-api-key"using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using ClickSend.Api;
using ClickSend.Client;
using ClickSend.Extensions;
using ClickSend.Model;
var host = Host.CreateDefaultBuilder(args)
.ConfigureApi((context, services, options) =>
{
BasicToken token = new(
Environment.GetEnvironmentVariable("CLICKSEND_USERNAME"),
Environment.GetEnvironmentVariable("CLICKSEND_API_KEY"));
options.AddTokens(token);
})
.Build();
var smsApi = host.Services.GetRequiredService<ISmsApi>();
var sendSmsRequest = new SendSmsRequest(
messages: new List<SendSmsRequestMessagesInner>
{
new(body: "Hello from ClickSend!", to: "+61411111111", source: "sdk")
});
ISendSmsApiResponse response = await smsApi.SendSmsAsync(sendSmsRequest: sendSmsRequest);
SendSms? result = response.Ok();var managementApi = host.Services.GetRequiredService<IManagementApi>();
IViewAccountDetailsApiResponse response = await managementApi.ViewAccountDetailsAsync();
ViewAccountDetails? account = response.Ok();var mmsApi = host.Services.GetRequiredService<IMmsApi>();
var sendMmsRequest = new SendMmsRequest(
mediaFile: "https://clicksend.com/logo.png",
messages: new List<SendMmsRequestMessagesInner>
{
new(to: "+61411111111", from: "sdk", subject: "Hello", body: "Hello from ClickSend!", source: "sdk")
});
ISendMmsApiResponse response = await mmsApi.SendMmsAsync(sendMmsRequest: sendMmsRequest);
SendMms? result = response.Ok();The base URL defaults to https://rest.clicksend.com. Override it, along with the HttpClient and its
handlers, from the ConfigureApi builder:
.ConfigureApi((context, services, options) =>
{
options.AddTokens(new BasicToken(username, apiKey));
})
.ConfigureHttpClients((context, services, builder) =>
{
builder.ConfigureHttpClient(client =>
{
client.BaseAddress = new Uri("https://rest.clicksend.com");
client.Timeout = TimeSpan.FromSeconds(30);
});
});Call response.Ok() for the deserialized success payload, or inspect the response for failures:
ISendSmsApiResponse response = await smsApi.SendSmsAsync(sendSmsRequest: sendSmsRequest);
if (response.IsSuccessStatusCode)
{
SendSms? result = response.Ok();
}
else
{
// response.StatusCode β HTTP status code
// response.RawContent β raw error payload from the API
}- Full REST API reference: https://developers.clicksend.com/docs/rest/v3/
- Per-endpoint SDK docs: the
docs/directory in this repository - Source code: https://github.com/ClickSend/clicksend-csharp-v2
This package follows semantic versioning. Breaking changes are released as major versions.
- Help Centre: https://help.clicksend.com
- Contact support: https://clicksend.com/contact
- SDK bugs and feature requests: https://github.com/ClickSend/clicksend-csharp-v2/issues
Released under the MIT License.
Keywords: clicksend, sms, sms api, send sms, bulk sms, text message, texting, mms, mms api, voice, voice call, text to speech, tts, ivr, email to sms, sms campaign, mms campaign, url shortening, number verification, messaging, notifications, otp, 2fa, two factor authentication, transactional sms, marketing sms, appointment reminders, alerts, csharp, dotnet, netstandard, rest api, clicksend sdk