SDKs▾

SDKs

Official clients for Node, Python and PHP, plus what to do if your language is not listed.

The SDKs are thin: typed request and response models, retries with backoff, idempotency keys and webhook signature verification. Everything they do is documented here, so hand-rolling a client is entirely reasonable.

Node

Install
npm install @sendport/node
Usage
import { Sendport } from "@sendport/node";

const sendport = new Sendport(process.env.SENDPORT_KEY!);

const message = await sendport.messages.send({
  to: "+201005550123",
  type: "template",
  template: {
    name: "order_shipped",
    language: "en",
    components: [
      { type: "body", parameters: [{ type: "text", text: "A-4417" }, { type: "text", text: "Tuesday" }] },
    ],
  },
});

console.log(message.wamid);

// Webhook verification
if (!sendport.webhooks.verify(rawBody, signature, process.env.SENDPORT_WEBHOOK_SECRET!)) {
  throw new Error("bad signature");
}

Python

Install
pip install sendport
Usage
import os
from sendport import Sendport

client = Sendport(api_key=os.environ["SENDPORT_KEY"])

message = client.messages.send(
    to="+201005550123",
    type="text",
    text={"body": "Your table is ready."},
)

for message in client.messages.list(wa_id="201005550123", limit=100):
    print(message.id, message.status)

PHP

Install
composer require sendport/sendport-php
Usage
<?php

use Sendport\Client;

$sendport = new Client(getenv('SENDPORT_KEY'));

$message = $sendport->messages->send([
    'to'   => '+201005550123',
    'type' => 'text',
    'text' => ['body' => 'Your table is ready.'],
]);

echo $message->wamid;

Other languages

There is no SDK for Go, Ruby, Java or .NET yet. The API is plain JSON over HTTPS with a bearer token — a client is a few dozen lines. Import the Postman collection to generate a starting point in your language.

Version pinning

SDKs pin the API version they were built against and send it as Sendport-Version. Upgrading the SDK can therefore change API behaviour — read Versioning before a major bump.