Skip to content

Send Single SMS

This content is not available in your language yet.

Sending a single SMS is very easy and should take just a few seconds to integrate.

The easiest way to send SMS is using our official client libraries.

// Inject IConnectSms via dependency injection, or build manually:
// var smsClient = new ConnectClientBuilder()
// .WithApiKey("your-api-key")
// .BuildSmsClient();
await smsClient.SendSmsAsync(new ConnectSmsMessage
{
To = "+447700900123", // Required: E.164 format
From = "YourSender", // Optional if DefaultSmsSender is configured
Content = "Your verification code is 123456"
});
await smsClient.SendSmsAsync(new ConnectSmsMessage
{
To = "+447700900123",
Content = "Your appointment is tomorrow at 10am",
// Schedule for later (optional)
DateSendAtUtc = DateTime.UtcNow.AddHours(1),
// Track an individual message for delivery receipts (optional)
ClientReference = "appointment-reminder-123",
// Group sends together for usage reporting (optional)
ClientTag = "acme-corp",
// Automatically shorten links in the message (optional)
EnableLinkShortening = true,
// Control unicode handling (optional, defaults to Allow)
Unicode = UnicodeMode.Allow // Allow, Deny, or Strip
});
await smsClient.SendSmsAsync(new ConnectSmsMessage
{
To = "+447700900123",
TemplateName = "verification-code",
TemplateData = new Dictionary<string, object>
{
["code"] = "123456",
["expiresIn"] = "10 minutes"
}
});

POST
/sms/send

Headers

X-Api-Key
required
string
The API Key for your Workspace.

JSON Data

sender
required
string
Sender Name for the SMS.
recipient
required
string
format: E.164
Recipient Number (E.164 format) for the SMS.
content
string
The Content of the SMS to send. Required unless templateName is provided.
templateName
string
format: max 64 chars
The name of an approved template to use instead of providing content directly. Cannot be combined with content.
templateData
object
A JSON object of values to render into the template (or into ad-hoc content). Keys are referenced from within the template.
clientReference
string
Your own reference for this message. Returned on delivery receipt webhooks so you can correlate events.
clientTag
string
A grouping tag used for usage reporting — typically a reseller's end client. Normalized to lowercase a–z, 0–9 and hyphens (max 64 chars).
enableLinkShortening
boolean
Automatically shorten links in the message body. Defaults to the Workspace setting if omitted.
unicode
string
format: Allow | Deny | Strip
How to handle unicode characters: Allow (default), Deny (reject the request) or Strip (remove unsupported characters).
sendAtUtc
string
format: date-time (ISO 8601)
The date (UTC) in ISO 8601 format for when the SMS should be scheduled. If not specified, the SMS will be sent immediately.

JSON Data

id
string
format: long / int64
The SMS ID from Connect.
countryCode
string
Country code extracted from the phone number.

Paste this in your favourite terminal to send your first SMS. Don’t forget to replace the things.

Sending with cURL
curl -X POST https://connect-api.divergent.cloud/sms/send \
-H "X-Api-Key: { API_KEY }" \
--json '{
"sender": "{ SENDER_NAME }",
"recipient": "{ RECIPIENT_NUMBER }",
"content": "{ CONTENT }",
"clientTag": "{ CLIENT_TAG }"
}'