SBS TELECOM — 20 years of Tier-1 SMS termination and enterprise messaging excellence.Explore Solutions
S
SBS TELECOMEnterprise Telecom
Code Samples

Ready-to-Run Integration Examples

Integration examples in 7 languages covering message sending, status polling, and webhook handling. Copy, adapt, and ship — all samples target our live API.

Languages

7 Languages, One API

All samples use our HTTP REST API. The same single endpoint handles messages in any language — pick your stack and integrate in minutes.

.pyPython.jsNode.js.phpPHP.rbRuby.javaJava.goGo.csC#
Python.py

Clean, readable integration using the requests library. Ideal for backend services, scripts, and data pipelines. Covers message sending, status polling, and webhook receipt verification.

import requests

response = requests.post(
    'https://api.sbstelecom.co.uk/v1/messages',
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'to': '+447911123456',
        'from': 'SBSTELECOM',
        'text': 'Your code: 482910',
        'type': 'otp'
    }
)
data = response.json()
print(f"ID: {data['messageId']}")
Node.js.js

Native fetch-based example with async/await syntax, compatible with Node 18+. Covers sending, webhook handling with Express, and signature verification.

const response = await fetch(
  'https://api.sbstelecom.co.uk/v1/messages',
  {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      to: '+447911123456',
      from: 'SBSTELECOM',
      text: 'Your code: 482910',
      type: 'otp'
    })
  }
)
const data = await response.json()
console.log('Message ID:', data.messageId)
PHP.php

cURL-based implementation compatible with PHP 7.4+. Includes examples for sending messages, handling delivery receipts via webhook, and bulk sending.

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL =>
        'https://api.sbstelecom.co.uk/v1/messages',
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json'
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'to' => '+447911123456',
        'from' => 'SBSTELECOM',
        'text' => 'Your code: 482910',
        'type' => 'otp'
    ])
]);
$result = json_decode(curl_exec($ch));
Ruby.rb

Net::HTTP implementation with JSON parsing. Suitable for Rails applications, background jobs, and standalone scripts. Includes basic error handling pattern.

require 'net/http'
require 'json'

uri = URI('https://api.sbstelecom.co.uk/v1/messages')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = "Bearer #{api_key}"
req['Content-Type'] = 'application/json'
req.body = {
  to: '+447911123456',
  from: 'SBSTELECOM',
  text: 'Your code: 482910',
  type: 'otp'
}.to_json

res = Net::HTTP.start(uri.hostname,
  use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)
Java.java

HttpClient implementation using Java 11+ standard library. Covers message sending and response deserialization. Compatible with Spring Boot and Jakarta EE applications.

HttpClient client = HttpClient.newHttpClient();
String body = """
    {
      "to": "+447911123456",
      "from": "SBSTELECOM",
      "text": "Your code: 482910",
      "type": "otp"
    }""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create(
      "https://api.sbstelecom.co.uk/v1/messages"))
    .header("Authorization", "Bearer " + apiKey)
    .header("Content-Type", "application/json")
    .POST(BodyPublishers.ofString(body))
    .build();

HttpResponse<String> response = client.send(
    request, BodyHandlers.ofString());
Go.go

Idiomatic Go using net/http and encoding/json. Minimal dependencies, production-ready error handling, and context support. Suitable for microservices and CLI tools.

payload, _ := json.Marshal(map[string]string{
    "to":   "+447911123456",
    "from": "SBSTELECOM",
    "text": "Your code: 482910",
    "type": "otp",
})

req, _ := http.NewRequest(
    "POST",
    "https://api.sbstelecom.co.uk/v1/messages",
    bytes.NewBuffer(payload),
)
req.Header.Set("Authorization",
    "Bearer "+apiKey)
req.Header.Set("Content-Type",
    "application/json")

client := &http.Client{}
resp, err := client.Do(req)
C#.cs

HttpClient with System.Text.Json. Compatible with .NET 6+ and ASP.NET Core. Includes async/await pattern and typed response deserialization.

var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue(
        "Bearer", apiKey);

var payload = new {
    to = "+447911123456",
    from = "SBSTELECOM",
    text = "Your code: 482910",
    type = "otp"
};

var response = await client.PostAsJsonAsync(
    "https://api.sbstelecom.co.uk/v1/messages",
    payload);

var data = await response.Content
    .ReadFromJsonAsync<MessageResponse>();
SDK Availability

Official SDKs Coming Soon

We are developing official SDK packages for popular languages that wrap the HTTP API with typed models, automatic retry logic, and built-in signature verification. In the meantime, the HTTP API samples above are fully production-ready and used by customers sending millions of messages daily.

npm packagePyPI packagePackagist packageRubyGems packageMaven packageGo moduleNuGet package
Get Notified When SDKs Launch

Ready to Integrate?.

Request API credentials and start sending messages in the sandbox environment today.

UK Registered20 Years ExperienceTier-1 Connectivity190+ Countries24/7 Support