Skip to main content

API Request Examples

This page demonstrates common API requests you can make with the LightSMS API across different programming languages.

Sending a Single SMS​

Send a simple SMS message to a single recipient.

PHP​

<?php
$login = 'YourLogin';
$apiKey = 'your_api_key_here';

function getTimestamp() {
return trim(file_get_contents('https://www.lightsms.com/external/get/timestamp.php'));
}

function createSignature($params, $apiKey) {
ksort($params);
reset($params);
return md5(implode($params) . $apiKey);
}

function sendSMS($login, $apiKey, $phone, $text, $sender) {
$timestamp = getTimestamp();

$params = [
'login' => $login,
'phone' => $phone,
'text' => $text,
'sender' => $sender,
'timestamp' => $timestamp,
'return' => 'json'
];

$signature = createSignature($params, $apiKey);
$params['signature'] = $signature;

$url = 'https://www.lightsms.com/external/get/send.php?' . http_build_query($params);
$response = file_get_contents($url);

return json_decode($response, true);
}

// Send SMS
$result = sendSMS(
$login,
$apiKey,
'37060012345',
'Your verification code is: 123456',
'YourBrand'
);

print_r($result);
?>

JavaScript (Node.js)​

const crypto = require('crypto');
const axios = require('axios');

const login = 'YourLogin';
const apiKey = 'your_api_key_here';

async function getTimestamp() {
const response = await axios.get('https://www.lightsms.com/external/get/timestamp.php');
return response.data.trim();
}

function createSignature(params, apiKey) {
const sortedKeys = Object.keys(params).sort();
const paramString = sortedKeys.map(key => params[key]).join('');
return crypto.createHash('md5').update(paramString + apiKey).digest('hex');
}

async function sendSMS(phone, text, sender) {
const timestamp = await getTimestamp();

const params = {
login: login,
phone: phone,
text: text,
sender: sender,
timestamp: timestamp,
return: 'json'
};

const signature = createSignature(params, apiKey);
params.signature = signature;

const queryString = new URLSearchParams(params).toString();
const url = `https://www.lightsms.com/external/get/send.php?${queryString}`;
const response = await axios.get(url);

return response.data;
}

// Send SMS
sendSMS(
'37060012345',
'Your verification code is: 123456',
'YourBrand'
).then(result => {
console.log(result);
});

Python​

import requests
import hashlib
from urllib.parse import urlencode

login = 'YourLogin'
apiKey = 'your_api_key_here'

def get_timestamp():
response = requests.get('https://www.lightsms.com/external/get/timestamp.php')
return response.text.strip()

def create_signature(params, api_key):
sorted_params = sorted(params.items())
param_string = ''.join([str(value) for key, value in sorted_params])
return hashlib.md5((param_string + api_key).encode()).hexdigest()

def send_sms(phone, text, sender):
timestamp = get_timestamp()

params = {
'login': login,
'phone': phone,
'text': text,
'sender': sender,
'timestamp': timestamp,
'return': 'json'
}

signature = create_signature(params, apiKey)
params['signature'] = signature

url = f'https://www.lightsms.com/external/get/send.php?{urlencode(params)}'
response = requests.get(url)

return response.json()

# Send SMS
result = send_sms(
'37060012345',
'Your verification code is: 123456',
'YourBrand'
)

print(result)

cURL​

# First, get a timestamp
TIMESTAMP=$(curl -s https://www.lightsms.com/external/get/timestamp.php)

# Then, prepare parameters and calculate signature (replace with your actual login and API key)
# Assuming:
# LOGIN="YourLogin"
# API_KEY="your_api_key_here"
# PHONE="37060012345"
# TEXT="Your verification code is: 123456"
# SENDER="YourBrand"
# RETURN_FORMAT="json"

# Example of how signature is generated:
# echo -n "${LOGIN}${PHONE}${RETURN_FORMAT}${SENDER}${TEXT}${TIMESTAMP}${API_KEY}" | md5
# The order of parameters for signature generation is crucial: login, phone, return, sender, text, timestamp

# For this example, let's manually construct the sorted values string:
# Param order: login, phone, return, sender, text, timestamp
# Values: YourLogin, 37060012345, json, YourBrand, Your verification code is: 123456, $TIMESTAMP
# Signature string = "YourLogin37060012345jsonYourBrandYour verification code is: 123456${TIMESTAMP}your_api_key_here"
# SIGNATURE=$(echo -n "YourLogin37060012345jsonYourBrandYour verification code is: 123456${TIMESTAMP}your_api_key_here" | md5)

# Replace generated_signature with your actual generated signature
curl "https://www.lightsms.com/external/get/send.php?login=YourLogin&phone=37060012345&text=Your%20verification%20code%20is%3A%20123456&sender=YourBrand&timestamp=${TIMESTAMP}&signature=generated_signature&return=json"

Sending Bulk SMS​

Send the same message to multiple recipients.

PHP​

<?php
$login = 'YourLogin';
$apiKey = 'your_api_key_here';

function getTimestamp() {
return trim(file_get_contents('https://www.lightsms.com/external/get/timestamp.php'));
}

function createSignature($params, $apiKey) {
ksort($params);
reset($params);
return md5(implode($params) . $apiKey);
}

function sendBulkSMS($login, $apiKey, $recipients, $message, $sender) {
$timestamp = getTimestamp();

$params = [
'login' => $login,
'phone' => implode(',', $recipients), // Comma-separated phone numbers
'text' => $message,
'sender' => $sender,
'timestamp' => $timestamp,
'return' => 'json'
];

$signature = createSignature($params, $apiKey);
$params['signature'] = $signature;

$url = 'https://www.lightsms.com/external/get/send.php?' . http_build_query($params);
$response = file_get_contents($url);

return json_decode($response, true);
}

// Send to multiple recipients
$recipients = [
'37060012345',
'37060098765',
'37060055555'
];

$result = sendBulkSMS(
$login,
$apiKey,
$recipients,
'Flash sale! 50% off all items. Shop now at yourstore.com',
'YourStore'
);

print_r($result);
?>

JavaScript (Node.js)​

const crypto = require('crypto');
const axios = require('axios');

const login = 'YourLogin';
const apiKey = 'your_api_key_here';

async function getTimestamp() {
const response = await axios.get('https://www.lightsms.com/external/get/timestamp.php');
return response.data.trim();
}

function createSignature(params, apiKey) {
const sortedKeys = Object.keys(params).sort();
const paramString = sortedKeys.map(key => params[key]).join('');
return crypto.createHash('md5').update(paramString + apiKey).digest('hex');
}

async function sendBulkSMS(recipients, message, sender) {
const timestamp = await getTimestamp();

const params = {
login: login,
phone: recipients.join(','), // Comma-separated phone numbers
text: message,
sender: sender,
timestamp: timestamp,
return: 'json'
};

const signature = createSignature(params, apiKey);
params.signature = signature;

const queryString = new URLSearchParams(params).toString();
const url = `https://www.lightsms.com/external/get/send.php?${queryString}`;
const response = await axios.get(url);

return response.data;
}

// Send to multiple recipients
const recipients = [
'37060012345',
'37060098765',
'37060055555'
];

sendBulkSMS(
recipients,
'Flash sale! 50% off all items. Shop now at yourstore.com',
'YourStore'
).then(result => {
console.log(result);
});

Python​

import requests
import hashlib
from urllib.parse import urlencode

login = 'YourLogin'
apiKey = 'your_api_key_here'

def get_timestamp():
response = requests.get('https://www.lightsms.com/external/get/timestamp.php')
return response.text.strip()

def create_signature(params, api_key):
sorted_params = sorted(params.items())
param_string = ''.join([str(value) for key, value in sorted_params])
return hashlib.md5((param_string + api_key).encode()).hexdigest()

def send_bulk_sms(recipients, message, sender):
timestamp = get_timestamp()

params = {
'login': login,
'phone': ','.join(recipients), # Comma-separated phone numbers
'text': message,
'sender': sender,
'timestamp': timestamp,
'return': 'json'
}

signature = create_signature(params, apiKey)
params['signature'] = signature

url = f'https://www.lightsms.com/external/get/send.php?{urlencode(params)}'
response = requests.get(url)

return response.json()

# Send to multiple recipients
recipients = [
'37060012345',
'37060098765',
'37060055555'
]

result = send_bulk_sms(
recipients,
'Flash sale! 50% off all items. Shop now at yourstore.com',
'YourStore'
)

print(result)

Scheduling SMS for Later​

Schedule an SMS to be sent at a specific time.

PHP​

<?php
$login = 'YourLogin';
$apiKey = 'your_api_key_here';

function getTimestamp() {
return trim(file_get_contents('https://www.lightsms.com/external/get/timestamp.php'));
}

function createSignature($params, $apiKey) {
ksort($params);
reset($params);
return md5(implode($params) . $apiKey);
}

function scheduleSMS($login, $apiKey, $phone, $text, $sender, $sendingTime) {
$timestamp = getTimestamp();

$params = [
'login' => $login,
'phone' => $phone,
'text' => $text,
'sender' => $sender,
'timestamp' => $timestamp,
'sendingTime' => $sendingTime, // YYYY-MM-DD HH:MM
'return' => 'json'
];

$signature = createSignature($params, $apiKey);
$params['signature'] = $signature;

$url = 'https://www.lightsms.com/external/get/send.php?' . http_build_query($params);
$response = file_get_contents($url);

return json_decode($response, true);
}

// Schedule SMS for tomorrow at 10 AM
$tomorrow10am = date('Y-m-d H:i', strtotime('tomorrow 10:00'));

$result = scheduleSMS(
$login,
$apiKey,
'37060012345',
'Reminder: Your appointment is tomorrow at 2 PM',
'ClinicName',
$tomorrow10am
);

print_r($result);
?>

JavaScript (Node.js)​

const crypto = require('crypto');
const axios = require('axios');

const login = 'YourLogin';
const apiKey = 'your_api_key_here';

async function getTimestamp() {
const response = await axios.get('https://www.lightsms.com/external/get/timestamp.php');
return response.data.trim();
}

function createSignature(params, apiKey) {
const sortedKeys = Object.keys(params).sort();
const paramString = sortedKeys.map(key => params[key]).join('');
return crypto.createHash('md5').update(paramString + apiKey).digest('hex');
}

async function scheduleSMS(phone, text, sender, sendingTime) {
const timestamp = await getTimestamp();

const params = {
login: login,
phone: phone,
text: text,
sender: sender,
timestamp: timestamp,
sendingTime: sendingTime, // YYYY-MM-DD HH:MM
return: 'json'
};

const signature = createSignature(params, apiKey);
params.signature = signature;

const queryString = new URLSearchParams(params).toString();
const url = `https://www.lightsms.com/external/get/send.php?${queryString}`;
const response = await axios.get(url);

return response.data;
}

// Schedule SMS for tomorrow at 10 AM
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
const year = tomorrow.getFullYear();
const month = String(tomorrow.getMonth() + 1).padStart(2, '0');
const day = String(tomorrow.getDate()).padStart(2, '0');
const hours = '10';
const minutes = '00';
const tomorrow10am = `${year}-${month}-${day} ${hours}:${minutes}`;


scheduleSMS(
'37060012345',
'Reminder: Your appointment is tomorrow at 2 PM',
'ClinicName',
tomorrow10am
).then(result => {
console.log(result);
});

Python​

import requests
import hashlib
from urllib.parse import urlencode
from datetime import datetime, timedelta

login = 'YourLogin'
apiKey = 'your_api_key_here'

def get_timestamp():
response = requests.get('https://www.lightsms.com/external/get/timestamp.php')
return response.text.strip()

def create_signature(params, api_key):
sorted_params = sorted(params.items())
param_string = ''.join([str(value) for key, value in sorted_params])
return hashlib.md5((param_string + api_key).encode()).hexdigest()

def schedule_sms(phone, text, sender, sending_time):
timestamp = get_timestamp()

params = {
'login': login,
'phone': phone,
'text': text,
'sender': sender,
'timestamp': timestamp,
'sendingTime': sending_time, # YYYY-MM-DD HH:MM
'return': 'json'
}

signature = create_signature(params, apiKey)
params['signature'] = signature

url = f'https://www.lightsms.com/external/get/send.php?{urlencode(params)}'
response = requests.get(url)

return response.json()

# Schedule SMS for tomorrow at 10 AM
tomorrow_10am = (datetime.now() + timedelta(days=1)).replace(
hour=10, minute=0, second=0, microsecond=0
).strftime('%Y-%m-%d %H:%M')


result = schedule_sms(
'37060012345',
'Reminder: Your appointment is tomorrow at 2 PM',
'ClinicName',
tomorrow_10am
)

print(result)

Checking Message Status​

Check the delivery status of a sent message.

PHP​

<?php
$login = 'YourLogin';
$apiKey = 'your_api_key_here';

function getTimestamp() {
return trim(file_get_contents('https://www.lightsms.com/external/get/timestamp.php'));
}

function createSignature($params, $apiKey) {
ksort($params);
reset($params);
return md5(implode($params) . $apiKey);
}

function getMessageStatus($login, $apiKey, $messageId) {
$timestamp = getTimestamp();

$params = [
'login' => $login,
'state' => $messageId,
'timestamp' => $timestamp,
'return' => 'json'
];

$signature = createSignature($params, $apiKey);
$params['signature'] = $signature;

$url = 'https://www.lightsms.com/external/get/status.php?' . http_build_query($params);
$response = file_get_contents($url);

return json_decode($response, true);
}

$message = getMessageStatus($login, $apiKey, '4091297100348873330001'); // Replace with a real SMS ID

if (!empty($message)) {
$smsId = array_keys($message)[0]; // Get the SMS ID key
echo "Message ID: {$smsId}\n";
echo "Status: {$message[$smsId]}\n";
} else {
echo "Could not retrieve status or invalid message ID.\n";
}
?>

JavaScript (Node.js)​

const crypto = require('crypto');
const axios = require('axios');

const login = 'YourLogin';
const apiKey = 'your_api_key_here';

async function getTimestamp() {
const response = await axios.get('https://www.lightsms.com/external/get/timestamp.php');
return response.data.trim();
}

function createSignature(params, apiKey) {
const sortedKeys = Object.keys(params).sort();
const paramString = sortedKeys.map(key => params[key]).join('');
return crypto.createHash('md5').update(paramString + apiKey).digest('hex');
}

async function getMessageStatus(messageId) {
const timestamp = await getTimestamp();

const params = {
login: login,
state: messageId,
timestamp: timestamp,
return: 'json'
};

const signature = createSignature(params, apiKey);
params.signature = signature;

const queryString = new URLSearchParams(params).toString();
const url = `https://www.lightsms.com/external/get/status.php?${queryString}`;
const response = await axios.get(url);

return response.data;
}

getMessageStatus('4091297100348873330001').then(message => { // Replace with a real SMS ID
if (Object.keys(message).length > 0) {
const smsId = Object.keys(message)[0];
console.log(`Message ID: ${smsId}`);
console.log(`Status: ${message[smsId]}`);
} else {
console.log('Could not retrieve status or invalid message ID.');
}
});

Python​

import requests
import hashlib
from urllib.parse import urlencode

login = 'YourLogin'
apiKey = 'your_api_key_here'

def get_timestamp():
response = requests.get('https://www.lightsms.com/external/get/timestamp.php')
return response.text.strip()

def create_signature(params, api_key):
sorted_params = sorted(params.items())
param_string = ''.join([str(value) for key, value in sorted_params])
return hashlib.md5((param_string + api_key).encode()).hexdigest()

def get_message_status(message_id):
timestamp = get_timestamp()

params = {
'login': login,
'state': message_id,
'timestamp': timestamp,
'return': 'json'
}

signature = create_signature(params, apiKey)
params['signature'] = signature

url = f'https://www.lightsms.com/external/get/status.php?{urlencode(params)}'
response = requests.get(url)

return response.json()

message = get_message_status('4091297100348873330001') # Replace with a real SMS ID

if message:
sms_id = list(message.keys())[0] # Get the SMS ID key
print(f"Message ID: {sms_id}")
print(f"Status: {message[sms_id]}")
else:
print("Could not retrieve status or invalid message ID.")

Checking Account Balance​

Check your current SMS account balance.

PHP​

<?php
$login = 'YourLogin';
$apiKey = 'your_api_key_here';

function getTimestamp() {
return trim(file_get_contents('https://www.lightsms.com/external/get/timestamp.php'));
}

function createSignature($params, $apiKey) {
ksort($params);
reset($params);
return md5(implode($params) . $apiKey);
}

function getBalance($login, $apiKey) {
$timestamp = getTimestamp();

$params = [
'login' => $login,
'timestamp' => $timestamp,
'return' => 'json'
];

$signature = createSignature($params, $apiKey);
$params['signature'] = $signature;

$url = 'https://www.lightsms.com/external/get/balance.php?' . http_build_query($params);
$response = file_get_contents($url);

return json_decode($response, true);
}

$balance = getBalance($login, $apiKey);

echo "Account balance: {$balance['money']} {$balance['currency']}\n";
?>

JavaScript (Node.js)​

const crypto = require('crypto');
const axios = require('axios');

const login = 'YourLogin';
const apiKey = 'your_api_key_here';

async function getTimestamp() {
const response = await axios.get('https://www.lightsms.com/external/get/timestamp.php');
return response.data.trim();
}

function createSignature(params, apiKey) {
const sortedKeys = Object.keys(params).sort();
const paramString = sortedKeys.map(key => params[key]).join('');
return crypto.createHash('md5').update(paramString + apiKey).digest('hex');
}

async function getBalance() {
const timestamp = await getTimestamp();

const params = {
login: login,
timestamp: timestamp,
return: 'json'
};

const signature = createSignature(params, apiKey);
params.signature = signature;

const queryString = new URLSearchParams(params).toString();
const url = `https://www.lightsms.com/external/get/balance.php?${queryString}`;
const response = await axios.get(url);

return response.data;
}

getBalance().then(balance => {
console.log(`Account balance: ${balance.money} ${balance.currency}`);
});

Python​

import requests
import hashlib
from urllib.parse import urlencode

login = 'YourLogin'
apiKey = 'your_api_key_here'

def get_timestamp():
response = requests.get('https://www.lightsms.com/external/get/timestamp.php')
return response.text.strip()

def create_signature(params, api_key):
sorted_params = sorted(params.items())
param_string = ''.join([str(value) for key, value in sorted_params])
return hashlib.md5((param_string + api_key).encode()).hexdigest()

def get_balance():
timestamp = get_timestamp()

params = {
'login': login,
'timestamp': timestamp,
'return': 'json'
}

signature = create_signature(params, apiKey)
params['signature'] = signature

url = f'https://www.lightsms.com/external/get/balance.php?{urlencode(params)}'
response = requests.get(url)

return response.json()

balance = get_balance()

print(f"Account balance: {balance['money']} {balance['currency']}")

Handling Webhooks​

Receive and process webhook notifications for message delivery.

PHP​

<?php
// webhook-handler.php

// Read the webhook payload
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_LIGHTSMS_SIGNATURE'] ?? '';

// Verify webhook signature
$webhookSecret = getenv('LIGHTSMS_WEBHOOK_SECRET');
$expectedSignature = hash_hmac('sha256', $payload, $webhookSecret);

if (!hash_equals($expectedSignature, $signature)) {
http_response_code(401);
die('Invalid signature');
}

// Parse the event
$event = json_decode($payload, true);

// Handle different event types
switch ($event['event_type']) {
case 'message.delivered':
handleDelivered($event['data']);
break;

case 'message.failed':
handleFailed($event['data']);
break;

case 'message.sent':
handleSent($event['data']);
break;

default:
error_log("Unknown event type: {$event['event_type']}");
}

function handleDelivered($message) {
error_log("Message delivered: {$message['message_id']} to {$message['to']}");

// Update your database
// Send confirmation to user
// Update analytics
}

function handleFailed($message) {
error_log("Message failed: {$message['message_id']} - {$message['error_reason']}");

// Alert system administrators
// Retry with different method
// Notify customer service
}

function handleSent($message) {
error_log("Message sent: {$message['message_id']}");

// Update delivery tracking
}

// Return 200 OK
http_response_code(200);
echo json_encode(['status' => 'received']);
?>

JavaScript (Express.js)​

const express = require('express');
const crypto = require('crypto');

const app = express();
app.use(express.json());

const webhookSecret = process.env.LIGHTSMS_WEBHOOK_SECRET;

app.post('/webhooks/sms', (req, res) => {
// Verify signature
const signature = req.headers['x-lightsms-signature'];
const payload = JSON.stringify(req.body);

const expectedSignature = crypto
.createHmac('sha256', webhookSecret)
.update(payload)
.digest('hex');

if (signature !== expectedSignature) {
return res.status(401).json({ error: 'Invalid signature' });
}

const event = req.body;

// Handle different event types
switch (event.event_type) {
case 'message.delivered':
handleDelivered(event.data);
break;

case 'message.failed':
handleFailed(event.data);
break;

case 'message.sent':
handleSent(event.data);
break;

default:
console.log(`Unknown event type: ${event.event_type}`);
}

res.json({ status: 'received' });
});

function handleDelivered(message) {
console.log(`Message delivered: ${message.message_id} to ${message.to}`);
// Update database, send confirmations, etc.
}

function handleFailed(message) {
console.log(`Message failed: ${message.message_id} - ${message.error_reason}`);
// Alert admins, retry, etc.
}

function handleSent(message) {
console.log(`Message sent: ${message.message_id}`);
// Update tracking
}

app.listen(3000, () => {
console.log('Webhook server running on port 3000');
});

Python (Flask)​

from flask import Flask, request, jsonify
import hmac
import hashlib
import os

app = Flask(__name__)
webhook_secret = os.getenv('LIGHTSMS_WEBHOOK_SECRET')

@app.route('/webhooks/sms', methods=['POST'])
def sms_webhook():
# Verify signature
signature = request.headers.get('X-Lightsms-Signature', '')
payload = request.get_data()

expected_signature = hmac.new(
webhook_secret.encode(),
payload,
hashlib.sha256
).hexdigest()

if not hmac.compare_digest(signature, expected_signature):
return jsonify({'error': 'Invalid signature'}), 401

event = request.json

# Handle different event types
event_type = event.get('event_type')

if event_type == 'message.delivered':
handle_delivered(event['data'])
elif event_type == 'message.failed':
handle_failed(event['data'])
elif event_type == 'message.sent':
handle_sent(event['data'])
else:
print(f"Unknown event type: {event_type}")

return jsonify({'status': 'received'})

def handle_delivered(message):
print(f"Message delivered: {message['message_id']} to {message['to']}")
# Update database, send confirmations, etc.

def handle_failed(message):
print(f"Message failed: {message['message_id']} - {message['error_reason']}")
# Alert admins, retry, etc.

def handle_sent(message):
print(f"Message sent: {message['message_id']}")
# Update tracking

if __name__ == '__main__':
app.run(port=3000)

Complete Integration Example​

Full client implementation with error handling and retry logic.

PHP​

<?php
class LightSMSClient {
private $apiKey;
private $baseUrl;

public function __construct($apiKey, $sandbox = false) {
$this->apiKey = $apiKey;
$this->baseUrl = $sandbox
? 'https://sandbox-sms-api.paysera.com'
: 'https://sms-api.paysera.com';
}

private function request($method, $endpoint, $data = null) {
$url = $this->baseUrl . '/v1' . $endpoint;
$ch = curl_init($url);

$options = [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $this->apiKey,
'Content-Type: application/json'
]
];

if ($method === 'POST') {
$options[CURLOPT_POST] = true;
$options[CURLOPT_POSTFIELDS] = json_encode($data);
} elseif ($method === 'DELETE') {
$options[CURLOPT_CUSTOMREQUEST] = 'DELETE';
}

curl_setopt_array($ch, $options);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode >= 400) {
throw new Exception($response);
}

return json_decode($response, true);
}

public function sendSMS($to, $message, $options = []) {
$data = array_merge(['to' => $to, 'message' => $message], $options);
return $this->request('POST', '/messages', $data);
}

public function sendBulkSMS($recipients, $message, $options = []) {
$data = array_merge(['recipients' => $recipients, 'message' => $message], $options);
return $this->request('POST', '/messages/bulk', $data);
}

public function getMessageStatus($messageId) {
return $this->request('GET', "/messages/{$messageId}");
}

public function getBalance() {
return $this->request('GET', '/balance');
}

public function getPricing($country = null) {
$endpoint = '/pricing' . ($country ? "?country={$country}" : '');
return $this->request('GET', $endpoint);
}
}

// Usage
$client = new LightSMSClient(getenv('LIGHTSMS_API_KEY'), false);

try {
// Send SMS
$result = $client->sendSMS(
'+37060012345',
'Your order #12345 has been shipped!',
['from' => 'YourStore', 'reference' => 'order-12345']
);

echo "Message sent: {$result['message_id']}\n";

// Check balance
$balance = $client->getBalance();
echo "Remaining balance: {$balance['balance']} {$balance['currency']}\n";

} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
?>

Next Steps​