💬 WhatsApp API @ Best Rate | Zero Setup Fee → 99.9% Uptime OTP Delivery — Try FREE Demo! 🏆 10,000+ Registered Businesses — 2,000+ Enterprise Clients Served 🚀 API Integration in Under 5 Minutes 🏅 Verified Business Badge with RCS Messaging 💬 WhatsApp API @ Best Rate | Zero Setup Fee → 99.9% Uptime OTP Delivery — Try FREE Demo! 🏆 10,000+ Registered Businesses — 2,000+ Enterprise Clients Served 🚀 API Integration in Under 5 Minutes 🏅 Verified Business Badge with RCS Messaging
Talk to Sales: India 1800 102 1822

Official SDKs for SMS, WhatsApp, RCS, Email and OneTap Verify

Add messaging to your app in a few lines of code. One SDK per language covers the SMS API, WhatsApp with automatic SMS fallback, RCS, email, OneTap Verify and Email Verification - with retries, idempotency and clear errors built in.

Node.jsPythonPHPJava.NETGoRuby
7Official SDK languages
0Third-party dependencies
MITLicence, full source included
Since 2009Trusted messaging platform

Quick Answer

SMSGatewayHub SDKs are official client libraries for Node.js, Python, PHP, Java, .NET (C#), Go and Ruby. Each one wraps the classic SMS API, the CPaaS unified messages API (WhatsApp, SMS, RCS and email with automatic fallback), OneTap Verify and Email Verification, and adds retries, idempotency keys and one consistent error type. Install it from our download link, set your keys as environment variables and send your first message in minutes.

Choose your language

Seven official SDKs, all version 1.0.0, MIT licensed and free of third-party dependencies. Pick one to see the install line, a quick start and a WhatsApp-with-SMS-fallback example.

Node.js

Node 14+ · TypeScript types included

Package

smsgatewayhub

Install

npm install smsgatewayhub

Send an SMS

await client.sms.send({ senderId, to, text });

Python

Python 3.7+

Package

smsgatewayhub

Install

pip install https://www.smsgatewayhub.com/sdk/smsgatewayhub-1.0.0.tar.gz

Send an SMS

client.sms.send(sender_id=..., to=..., text=...)

PHP

PHP 7.2+ · ext-json, cURL or streams

Package

smsgatewayhub/smsgatewayhub

Install

curl -LO https://www.smsgatewayhub.com/sdk/smsgatewayhub-php-1.0.0.zip

Send an SMS

$client->sms()->send([...]);

Java

Java 8+

Package

com.smsgatewayhub:smsgatewayhub

Install

curl -LO https://www.smsgatewayhub.com/sdk/smsgatewayhub-java-1.0.0.zip

Send an SMS

client.sms().send(params);

.NET (C#)

.NET Standard 2.0 · .NET Framework 4.5+

Package

SmsGatewayHub

Install

curl -LO https://www.smsgatewayhub.com/sdk/SmsGatewayHub-dotnet-1.0.0.zip

Send an SMS

await client.Sms.SendAsync(options);

Go

Go 1.16+

Package

github.com/smsgatewayhub91/smsgatewayhub-go

Install

go get github.com/smsgatewayhub91/smsgatewayhub-go@v1.0.0

Send an SMS

client.SMS.Send(ctx, params)

Ruby

Ruby 2.5+

Package

smsgatewayhub

Install

curl -LO https://www.smsgatewayhub.com/sdk/smsgatewayhub-ruby-1.0.0.zip

Send an SMS

client.sms.send(sender_id:, to:, text:)

Install and quick start

Node.js installs from npm and Go with go get, the source of all seven SDKs is on GitHub, and every SDK also installs from our download link. PyPI, NuGet, Composer, Maven and RubyGems packages are coming soon. Every snippet reads your keys from environment variables, so nothing secret is written in code.

Node.js SDK

Package smsgatewayhub · Node 14+ · TypeScript types included · version 1.0.0 · MIT

1. Install

Direct download
npm install https://www.smsgatewayhub.com/sdk/smsgatewayhub-node-1.0.0.tgz

Live on npm; source on GitHub.

Package manager (npm)
npm install smsgatewayhub

2. Send an SMS

Quick start
const SmsGatewayHub = require('smsgatewayhub');

// Reads SGH_API_KEY and SGH_CPAAS_KEY from the environment
const client = new SmsGatewayHub();

async function main() {
  const res = await client.sms.send({
    senderId: 'YOURID',
    to: '9198XXXXXXXX',
    text: 'Your order #1001 is confirmed.',
    dltTemplateId: 'YOUR_DLT_TEMPLATE_ID'
  });
  console.log(res.jobId, res.messages);
}

main().catch(err => console.error(err.code, err.message));

3. WhatsApp with automatic SMS fallback

One CPaaS request: WhatsApp is tried first and SMS is sent only if WhatsApp is not delivered within fallbackAfter seconds. Needs the sghcp_ key.

WhatsApp + SMS fallback
const msg = await client.messages.send({
  channels: ['whatsapp', 'sms'],
  to: '9198XXXXXXXX',
  fallbackAfter: 300, // seconds to wait before SMS is tried
  ref: 'order-1001',
  whatsapp: { template: 'order_update', language: 'en', variables: ['Asha', '#1001'] },
  sms: { text: 'Hi Asha, order #1001 is confirmed.', sender: 'YOURID', templateId: 'YOUR_DLT_TEMPLATE_ID' }
});
console.log(msg.id, msg.status); // cp_...

Python SDK

Package smsgatewayhub · Python 3.7+ · version 1.0.0 · MIT

1. Install

Direct download
pip install https://www.smsgatewayhub.com/sdk/smsgatewayhub-1.0.0.tar.gz

Package-manager install coming soon; install from our download link today. Source and releases: GitHub.

Package managerComing soon
pip install smsgatewayhub

2. Send an SMS

Quick start
from smsgatewayhub import SmsGatewayHub, SmsGatewayHubError

client = SmsGatewayHub()  # reads SGH_API_KEY and SGH_CPAAS_KEY from the environment

try:
    res = client.sms.send(
        sender_id="YOURID",
        to="9198XXXXXXXX",
        text="Your order #1001 is confirmed.",
        dlt_template_id="YOUR_DLT_TEMPLATE_ID",
    )
    print(res["job_id"], res["messages"])
except SmsGatewayHubError as e:
    print(e.code, e.message)

3. WhatsApp with automatic SMS fallback

One CPaaS request: WhatsApp is tried first and SMS is sent only if WhatsApp is not delivered within fallbackAfter seconds. Needs the sghcp_ key.

WhatsApp + SMS fallback
msg = client.messages.send({
    "channels": ["whatsapp", "sms"],
    "to": "9198XXXXXXXX",
    "fallbackAfter": 300,  # seconds to wait before SMS is tried
    "ref": "order-1001",
    "whatsapp": {"template": "order_update", "language": "en", "variables": ["Asha", "#1001"]},
    "sms": {"text": "Hi Asha, order #1001 is confirmed.", "sender": "YOURID",
            "templateId": "YOUR_DLT_TEMPLATE_ID"},
})
print(msg["id"], msg["status"])  # cp_...

PHP SDK

Package smsgatewayhub/smsgatewayhub · PHP 7.2+ · ext-json, cURL or streams · version 1.0.0 · MIT

1. Install

Direct download
curl -LO https://www.smsgatewayhub.com/sdk/smsgatewayhub-php-1.0.0.zip
unzip smsgatewayhub-php-1.0.0.zip
# then in your code:
require __DIR__ . '/smsgatewayhub-php-1.0.0/autoload.php';

Package-manager install coming soon; install from our download link today. Source and releases: GitHub.

Package managerComing soon
composer require smsgatewayhub/smsgatewayhub

2. Send an SMS

Quick start
<?php
require __DIR__ . '/smsgatewayhub-php-1.0.0/autoload.php';

use SmsGatewayHub\Client;
use SmsGatewayHub\SmsGatewayHubException;

$client = new Client(); // reads SGH_API_KEY and SGH_CPAAS_KEY from the environment

try {
    $res = $client->sms()->send([
        'senderId'      => 'YOURID',
        'to'            => '9198XXXXXXXX',
        'text'          => 'Your order #1001 is confirmed.',
        'dltTemplateId' => 'YOUR_DLT_TEMPLATE_ID',
    ]);
    echo $res['jobId'];
} catch (SmsGatewayHubException $e) {
    echo $e->getErrorCode(), ': ', $e->getMessage();
}

3. WhatsApp with automatic SMS fallback

One CPaaS request: WhatsApp is tried first and SMS is sent only if WhatsApp is not delivered within fallbackAfter seconds. Needs the sghcp_ key.

WhatsApp + SMS fallback
$msg = $client->messages()->send([
    'channels'      => ['whatsapp', 'sms'],
    'to'            => '9198XXXXXXXX',
    'fallbackAfter' => 300, // seconds to wait before SMS is tried
    'ref'           => 'order-1001',
    'whatsapp'      => ['template' => 'order_update', 'language' => 'en', 'variables' => ['Asha', '#1001']],
    'sms'           => ['text' => 'Hi Asha, order #1001 is confirmed.', 'sender' => 'YOURID',
                        'templateId' => 'YOUR_DLT_TEMPLATE_ID'],
]);
echo $msg['id'], ' ', $msg['status']; // cp_...

Java SDK

Package com.smsgatewayhub:smsgatewayhub · Java 8+ · version 1.0.0 · MIT

1. Install

Direct download
curl -LO https://www.smsgatewayhub.com/sdk/smsgatewayhub-java-1.0.0.zip
unzip smsgatewayhub-java-1.0.0.zip
cd smsgatewayhub-java-1.0.0 && mvn install
# then add to your pom.xml:
#   <dependency>
#     <groupId>com.smsgatewayhub</groupId>
#     <artifactId>smsgatewayhub</artifactId>
#     <version>1.0.0</version>
#   </dependency>

Package-manager install coming soon; install from our download link today. Source and releases: GitHub.

Maven Central / GradleComing soon
# Maven Central (no download or mvn install step) - same dependency as above
# Gradle:
implementation 'com.smsgatewayhub:smsgatewayhub:1.0.0'

2. Send an SMS

Quick start
import com.smsgatewayhub.SmsGatewayHub;
import com.smsgatewayhub.SmsGatewayHubException;
import java.util.HashMap;
import java.util.Map;

public class SendSms {
    public static void main(String[] args) {
        // Reads SGH_API_KEY and SGH_CPAAS_KEY from the environment
        SmsGatewayHub client = SmsGatewayHub.fromEnv();

        Map<String, Object> sms = new HashMap<>();
        sms.put("senderId", "YOURID");
        sms.put("to", "9198XXXXXXXX");
        sms.put("text", "Your order #1001 is confirmed.");
        sms.put("dltTemplateId", "YOUR_DLT_TEMPLATE_ID");
        try {
            System.out.println(client.sms().send(sms).getJobId());
        } catch (SmsGatewayHubException e) {
            System.err.println(e.getCode() + ": " + e.getMessage());
        }
    }
}

3. WhatsApp with automatic SMS fallback

One CPaaS request: WhatsApp is tried first and SMS is sent only if WhatsApp is not delivered within fallbackAfter seconds. Needs the sghcp_ key.

WhatsApp + SMS fallback
Map<String, Object> whatsapp = new HashMap<>();
whatsapp.put("template", "order_update");
whatsapp.put("language", "en");
whatsapp.put("variables", Arrays.asList("Asha", "#1001"));

Map<String, Object> sms = new HashMap<>();
sms.put("text", "Hi Asha, order #1001 is confirmed.");
sms.put("sender", "YOURID");
sms.put("templateId", "YOUR_DLT_TEMPLATE_ID");

Map<String, Object> body = new HashMap<>();
body.put("channels", Arrays.asList("whatsapp", "sms"));
body.put("to", "9198XXXXXXXX");
body.put("fallbackAfter", 300); // seconds to wait before SMS is tried
body.put("ref", "order-1001");
body.put("whatsapp", whatsapp);
body.put("sms", sms);

Map<String, Object> msg = client.messages().send(body);
System.out.println(msg.get("id") + " " + msg.get("status")); // cp_...

.NET (C#) SDK

Package SmsGatewayHub · .NET Standard 2.0 · .NET Framework 4.5+ · version 1.0.0 · MIT

1. Install

Direct download
curl -LO https://www.smsgatewayhub.com/sdk/SmsGatewayHub-dotnet-1.0.0.zip
unzip SmsGatewayHub-dotnet-1.0.0.zip -d SmsGatewayHub
# add a reference to SmsGatewayHub/lib/net45/SmsGatewayHub.dll (and System.Net.Http);
# the XML docs next to the DLL give you IntelliSense

Package-manager install coming soon; install from our download link today. Source and releases: GitHub.

NuGetComing soon
dotnet add package SmsGatewayHub

2. Send an SMS

Quick start
using System;
using System.Threading.Tasks;
using SmsGatewayHub;

class Program
{
    static async Task Main()
    {
        // Reads SGH_API_KEY and SGH_CPAAS_KEY from the environment
        using (var client = new SmsGatewayHubClient())
        {
            try
            {
                var res = await client.Sms.SendAsync(new SmsSendOptions
                {
                    SenderId = "YOURID",
                    To = new[] { "9198XXXXXXXX" },
                    Text = "Your order #1001 is confirmed.",
                    DltTemplateId = "YOUR_DLT_TEMPLATE_ID"
                });
                Console.WriteLine(res.JobId);
            }
            catch (SmsGatewayHubException ex)
            {
                Console.WriteLine(ex.Code + ": " + ex.Message);
            }
        }
    }
}

3. WhatsApp with automatic SMS fallback

One CPaaS request: WhatsApp is tried first and SMS is sent only if WhatsApp is not delivered within fallbackAfter seconds. Needs the sghcp_ key.

WhatsApp + SMS fallback
var msg = await client.Messages.SendAsync(new
{
    channels = new[] { "whatsapp", "sms" },
    to = "9198XXXXXXXX",
    fallbackAfter = 300, // seconds to wait before SMS is tried
    @ref = "order-1001",
    whatsapp = new { template = "order_update", language = "en", variables = new[] { "Asha", "#1001" } },
    sms = new { text = "Hi Asha, order #1001 is confirmed.", sender = "YOURID", templateId = "YOUR_DLT_TEMPLATE_ID" }
});
Console.WriteLine(msg["id"] + " " + msg["status"]); // cp_...

Go SDK

Package github.com/smsgatewayhub91/smsgatewayhub-go · Go 1.16+ · version 1.0.0 · MIT

1. Install

Direct download
curl -LO https://www.smsgatewayhub.com/sdk/smsgatewayhub-go-1.0.0.zip
unzip smsgatewayhub-go-1.0.0.zip
go mod edit -require=github.com/smsgatewayhub91/smsgatewayhub-go@v1.0.0
go mod edit -replace=github.com/smsgatewayhub91/smsgatewayhub-go=./smsgatewayhub-go-1.0.0

Live: installs with go get; source on GitHub.

Package manager (go get)
go get github.com/smsgatewayhub91/smsgatewayhub-go@v1.0.0

2. Send an SMS

Quick start
package main

import (
    "context"
    "fmt"
    "log"

    smsgatewayhub "github.com/smsgatewayhub91/smsgatewayhub-go"
)

func main() {
    // Reads SGH_API_KEY and SGH_CPAAS_KEY from the environment
    client := smsgatewayhub.NewClient()

    res, err := client.SMS.Send(context.Background(), smsgatewayhub.SendSMSRequest{
        SenderID:      "YOURID",
        To:            []string{"9198XXXXXXXX"},
        Text:          "Your order #1001 is confirmed.",
        DLTTemplateID: "YOUR_DLT_TEMPLATE_ID",
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(res.JobID)
}

3. WhatsApp with automatic SMS fallback

One CPaaS request: WhatsApp is tried first and SMS is sent only if WhatsApp is not delivered within fallbackAfter seconds. Needs the sghcp_ key.

WhatsApp + SMS fallback
msg, err := client.Messages.Send(ctx, map[string]interface{}{
    "channels":      []string{"whatsapp", "sms"},
    "to":            "9198XXXXXXXX",
    "fallbackAfter": 300, // seconds to wait before SMS is tried
    "ref":           "order-1001",
    "whatsapp": map[string]interface{}{
        "template": "order_update", "language": "en", "variables": []string{"Asha", "#1001"},
    },
    "sms": map[string]interface{}{
        "text": "Hi Asha, order #1001 is confirmed.", "sender": "YOURID", "templateId": "YOUR_DLT_TEMPLATE_ID",
    },
}, nil) // or &smsgatewayhub.SendOptions{IdempotencyKey: "order-1001"}
if err != nil {
    log.Fatal(err)
}
fmt.Println(msg["id"], msg["status"]) // cp_...

Ruby SDK

Package smsgatewayhub · Ruby 2.5+ · version 1.0.0 · MIT

1. Install

Direct download
curl -LO https://www.smsgatewayhub.com/sdk/smsgatewayhub-ruby-1.0.0.zip
unzip smsgatewayhub-ruby-1.0.0.zip
cd smsgatewayhub-ruby-1.0.0
gem build smsgatewayhub.gemspec && gem install smsgatewayhub-1.0.0.gem

Package-manager install coming soon; install from our download link today. Source and releases: GitHub.

Package managerComing soon
gem install smsgatewayhub

2. Send an SMS

Quick start
require "smsgatewayhub"

client = SmsGatewayHub::Client.new # reads SGH_API_KEY and SGH_CPAAS_KEY from the environment

res = client.sms.send(
  sender_id: "YOURID",
  to: "9198XXXXXXXX",
  text: "Your order #1001 is confirmed.",
  dlt_template_id: "YOUR_DLT_TEMPLATE_ID"
)
puts res[:job_id]

3. WhatsApp with automatic SMS fallback

One CPaaS request: WhatsApp is tried first and SMS is sent only if WhatsApp is not delivered within fallbackAfter seconds. Needs the sghcp_ key.

WhatsApp + SMS fallback
msg = client.messages.send({
  "channels" => ["whatsapp", "sms"],
  "to" => "9198XXXXXXXX",
  "fallbackAfter" => 300, # seconds to wait before SMS is tried
  "ref" => "order-1001",
  "whatsapp" => { "template" => "order_update", "language" => "en", "variables" => ["Asha", "#1001"] },
  "sms" => { "text" => "Hi Asha, order #1001 is confirmed.", "sender" => "YOURID",
             "templateId" => "YOUR_DLT_TEMPLATE_ID" }
})
puts msg["id"], msg["status"] # cp_...
One SDK, every product

What every SDK covers

The same methods in all seven languages, written in each language's own style.

Classic SMS API

Send SMS to up to 100 numbers per call with DLT template and entity IDs, Unicode auto-detection, flash and scheduled messages; check balance and delivery reports.

CPaaS messages with fallback

One request across WhatsApp, SMS, RCS and email with automatic fallback, plus message status, event timeline and listing by status or your own reference.

OneTap Verify

Create a one-time sign-in link, verify the returned token, check status or cancel - plus a helper that reads vl_token from your redirect URL.

Email Verification

Check a single address (valid, invalid, risky or unknown, with reason and typo suggestion) or verify batches of up to 1,000 emails and fetch the results.

Retries and idempotency

Automatic retries on network errors, HTTP 429 and 5xx with back-off. Every CPaaS send carries an Idempotency-Key that is reused on retry, so a message is never duplicated.

White-label base URL

Resellers point the SDK at their own domain with one option or the SGH_BASE_URL variable - same code, your brand.

Methods at a glance

Names shown in Node.js style. Python and Ruby use snake_case, C# uses PascalCase with Async methods, Go uses PascalCase with a context.

GroupMethodsEndpointKey
smssend, balance, deliveryHTTP SMS API (/api/mt/SendSMS, GetBalance, GetDelivery)SMS API key
messagessend, get, list/cpaas/v1/messages.ashxCPaaS key sghcp_
verifyLinkcreate, verify, get, cancelOneTap Verify (/cpaas/v1/verify-link.ashx)CPaaS key sghcp_
emailVerifycheck, batch, batchStatus/cpaas/v1/email-verify.ashxCPaaS key sghcp_
helpersparseRedirect / getVerifyTokenReads vl_token from a callback URLNone

Errors arrive as one error type with status, code, message, channel and raw response text, so you can log and handle every failure the same way.

Get your keys

Two keys, one per product family. You only need the key for the groups you use.

Sign up or log in

Create a free account or log in to your SMSGatewayHub Panel.

SMS API key

Open Panel > API and copy your API key. It powers the sms group. Save it as SGH_API_KEY.

CPaaS key

Open Panel > CPaaS > API and copy the key that starts with sghcp_. It powers messages, OneTap Verify and Email Verification. Save it as SGH_CPAAS_KEY.

Run the quick start

Set the variables on your server and run the snippet for your language above.

Linux / macOS
export SGH_API_KEY="your-sms-api-key"
export SGH_CPAAS_KEY="sghcp_your-cpaas-key"
# resellers only: export SGH_BASE_URL="https://sms.your-brand.com"
Windows PowerShell
$env:SGH_API_KEY = "your-sms-api-key"
$env:SGH_CPAAS_KEY = "sghcp_your-cpaas-key"
# resellers only: $env:SGH_BASE_URL = "https://sms.your-brand.com"

Security: keep keys on your server

  • Use the SDKs in server-side code only. Never ship an API key inside a mobile app, desktop app or browser JavaScript - call your own backend instead.
  • Keep keys in environment variables SGH_API_KEY and SGH_CPAAS_KEY (or your secrets manager), never in source control.
  • The SDKs never log your keys, and error messages never contain them.
  • All calls go over HTTPS to https://www.smsgatewayhub.com or your white-label domain. If you think a key has leaked, contact support@smsgatewayhub.com straight away.

Prefer raw HTTP?

The SDKs are thin wrappers over our public APIs. You can always call them directly from any language.

HTTP SMS API

URL-based send, balance and delivery report calls.

Communications API

SMS API features, onboarding and integration support.

API Developer Hub

Guides, specifications and documentation for developers.

Frequently Asked Questions

There are official SDKs for Node.js 14+, Python 3.7+, PHP 7.2+, Java 8+, .NET (.NET Standard 2.0 and .NET Framework 4.5+), Go 1.16+ and Ruby 2.5+. All are version 1.0.0 and offer the same features.

Node.js is live on npm (npm install smsgatewayhub) and the Go module installs with go get github.com/smsgatewayhub91/smsgatewayhub-go. The source of all seven SDKs is on GitHub at github.com/smsgatewayhub91. PyPI, NuGet, Composer, Maven and RubyGems packages are coming soon; until then install from the download link on this page - your code stays the same.

No. Every SDK uses only its language's standard HTTP and JSON features, so it adds no third-party dependencies to your project.

The SMS API key from Panel > API powers the classic SMS methods. The CPaaS key starting with sghcp_ from Panel > CPaaS > API powers unified messages, OneTap Verify and Email Verification. Set them as SGH_API_KEY and SGH_CPAAS_KEY.

No. The SDKs are for server-side code only. An API key inside an app or web page can be extracted, so your app should call your own backend, which then calls SMSGatewayHub.

No. The SDKs retry only on network errors, HTTP 429 and server errors, and every CPaaS message request carries an Idempotency-Key that is reused on each retry, so the message is created only once.

Yes. Set the base URL option or the SGH_BASE_URL environment variable to your white-label domain and the SDK sends every request there.

Yes. The SDKs are free and MIT licensed. You pay only for the messages you send at your normal SMSGatewayHub rates.

Send your first message from code today

Create a free account, copy your API keys and run the quick start for your language. Our team helps with DLT, WhatsApp templates and integration.