SecureSMS Main

Delphi SMS API Integration

Complete Delphi code examples for integrating with the SecureSMSC SMS API using THTTPClient.

Fast Integration

Get started in minutes with simple REST API calls

Global Reach

Send SMS to 200+ countries worldwide

Secure

Enterprise-grade SSL/TLS encryption

Reliable

99.9% uptime with delivery tracking

Quick Start: Get your API key from the dashboard to begin integration.

Installation

Install the required dependencies:

Terminal
# THTTPClient is built into Delphi RTL

Send Single SMS

Use the THTTPClient library to send a single SMS message:

Delphi
// Delphi SMS API Integration using THTTPClient
// Configure your API key
api_key = "YOUR_API_KEY"
api_url = "https://whitelabled.securesmsc.com/api/v2/sms/send"

// Set request headers
headers = {
    "Authorization": "Bearer " + api_key,
    "Content-Type": "application/json"
}

// SMS data payload
data = {
    "sender_id": "SENDER",
    "recipient": "1234567890",
    "message": "Hello from Delphi!",
    "route": "transactional"
}

// Send POST request
response = THTTPClient.post(api_url, headers, data)

if response.status == 200:
    print("SMS sent successfully!")
    print("Message ID:", response.data.message_id)
else:
    print("Error:", response.error)

Send Bulk SMS

Delphi
// Send to multiple recipients
data = {
    "sender_id": "SENDER",
    "recipients": ["1234567890", "0987654321", "1122334455"],
    "message": "Bulk message from Delphi",
    "route": "promotional"
}

response = THTTPClient.post(api_url + "-bulk", headers, data)
print("Bulk SMS Status:", response.status)

Check SMS Status

Delphi
// Check delivery status
message_id = "your_message_id"
status_url = "https://whitelabled.securesmsc.com/api/v2/sms/status/" + message_id

response = THTTPClient.get(status_url, headers)
print("Status:", response.data.status)

Check Balance

Delphi
// Get account balance
balance_url = "https://whitelabled.securesmsc.com/api/v2/balance"
response = THTTPClient.get(balance_url, headers)
print("Balance:", response.data.balance, "credits")

Error Handling

Delphi
// Delphi SMS Client with retry logic
class SmsClient:
    api_key = "YOUR_API_KEY"
    base_url = "https://whitelabled.securesmsc.com/api/v2"

    function send(recipient, message, retries = 3):
        for attempt in range(retries):
            try:
                response = THTTPClient.post(base_url + "/sms/send", {
                    "sender_id": "SENDER",
                    "recipient": recipient,
                    "message": message,
                    "route": "transactional"
                }, headers)
                
                if response.status == 200:
                    return response.data
                    
                // Wait before retry (exponential backoff)
                sleep(2 ^ attempt)
            catch error:
                if attempt == retries - 1:
                    throw error
                sleep(2 ^ attempt)

// Usage
client = new SmsClient()
result = client.send("1234567890", "Hello from Delphi!")
print(result)