Send Single SMS
Sending a single SMS is very easy and should take just a few seconds to integrate.
POST /sms/send
POST
/sms/send
Request Data
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
required
string
The Content of the SMS to send.
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.
Response Data
JSON Data
id
string
format: long / int64 The SMS ID from Connect.
countryCode
string
Country code extracted from the phone number.
Integration Sample
Paste this in your favourite terminal to send your first SMS. Don’t forget to replace the things.
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 }"}'<?php$data = array( 'sender' => '{ SENDER_NAME }', 'recipient' => '{RECIPIENT_NUMBER}', 'content' => '{ CONTENT }');$api_key = '{ API_KEY }';$json_data = json_encode($data);$ch = curl_init('https://connect-api.divergent.cloud/sms/send');curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($json_data), 'X-API-Key: ' . $api_key));
$response = curl_exec($ch);if (curl_errno($ch)) { throw new Exception(curl_error($ch));}curl_close($ch);