Skip to content
SMS SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

SMS SDK overview: one TypeScript SDK for six SMS providers

SMS SDK is an open-source TypeScript SDK for sending and receiving text messages through Twilio, Telnyx, Plivo, Vonage, Bandwidth, or Sinch with one typed API.

SMS SDK (@opencoredev/sms-sdk) sends transactional SMS through six providers with one TypeScript API, and turns their delivery and inbound webhooks into one event shape.

What it solves

Every provider has its own request format, error codes, status names, and webhook signatures. Code written for one is hard to move, and the failure cases are easy to get wrong:

  • A timeout does not tell you whether the provider created the message. Retrying it, or trying a second provider, can text the recipient twice.
  • A successful response only means the provider queued the message. Delivery is reported later, by webhook.
  • A provider that cannot schedule or send MMS may ignore the field or fail in its own way.
  • Each provider signs its callbacks differently, and a proxy in front of your app often breaks verification.

With SMS SDK, a send either returns a result or throws an error that says whether sending again is safe. Fields the provider cannot handle throw before any request. Webhooks are verified before any field is read.

import { createSmsClient, HandoffUnknownError } from "@opencoredev/sms-sdk";
import { telnyx } from "@opencoredev/sms-sdk/telnyx";

const sms = createSmsClient({
  adapters: [telnyx({ apiKey: process.env.TELNYX_API_KEY ?? "", from: "+15550100001" })],
});

try {
  const result = await sms.send({
    to: "+14155550123",
    body: "Your order has shipped.",
    idempotencyKey: "order:123:shipped:v1",
  });
  console.log(result.providerId, result.delivery); // the provider's message ID, "queued"
} catch (error) {
  if (error instanceof HandoffUnknownError) {
    // The provider may have sent it. Check before sending again.
  }
  throw error;
}

To change provider, replace telnyx(...) with another adapter. The send() call stays the same. Runnable versions are in the examples.

Providers

  • Twilio: Programmable Messaging. Supported.
  • Telnyx: Messaging API v2. Supported.
  • Plivo: Message API. Partial: Plivo does not document its error body, so most rejections cannot be classified.
  • Vonage: Messages API, SMS channel. Partial: error classification is inferred, and there are no short codes or MMS.
  • Bandwidth: Messaging API v2. Partial: SMS only, and most rejections cannot be classified.
  • Sinch: SMS API. Partial: no MMS, and most rejections cannot be classified.

Choose a provider compares what each one supports.

Scope and limits

SMS SDK is a transport library for your server. It does not include:

  • Conversation threads, an inbox, chatbots, WhatsApp, RCS, or iMessage.
  • An OTP verification service, a hosted API, a dashboard, or number purchasing.
  • 10DLC, toll-free, or sender ID registration. You do that with each provider. See Registration and consent and 10DLC registration for developers.
  • Exactly-once delivery. No supported provider offers send idempotency, so no SMS library can promise it. SMS SDK tells you when an outcome is unknown instead of guessing. See Prevent duplicate sends.

When to use the provider’s own SDK instead

Use the provider’s SDK when you need more than SMS: voice, verification, number lookup, number purchasing, account management, or Twilio Content Templates. It also types a new API parameter the day it ships, where SMS SDK passes it through providerOptions.<provider>.extra unvalidated until a release adds it. Provider SDKs have years of production use; SMS SDK is at 0.1.0.

Use SMS SDK when you only send and receive SMS, may change or add providers, and want timeouts and duplicate risks handled for you. It has no runtime dependencies.

You can use both: SMS SDK for sending and webhooks, the provider SDK for everything else.

When to use a notification platform instead

Courier, Novu, and Knock are notification platforms, not SMS libraries. Your app sends one request to the platform, which can apply templates and user preferences, run a workflow you configured, and route the message through the SMS, email, push, or chat provider you connected to it. SMS SDK runs inside your server and calls your SMS provider directly, with no service in between.

Use a notification platform when SMS is one channel of several, when people outside engineering edit message templates, when users choose which channels they get, or when a notification needs delays, digests, or batching. Courier routes each message across channels and providers, and can try the next configured provider or channel when a send attempt fails (courier.com/docs). Novu is open source and builds workflows with digest and delay steps (docs.novu.co). Knock builds cross-channel workflows with batch and delay steps and user preferences (docs.knock.app). All checked 2026-11-23.

Use SMS SDK when your app only sends and receives SMS from a TypeScript or Node.js server and you don’t want another account, dashboard, or network hop in the send path. With fallback: "on-known-rejection" enabled, it tries the next provider only after a rejection that is safe to retry elsewhere; a timeout that leaves the outcome unknown stops the chain. By default, parseSmsWebhook() authenticates each supported callback before it returns an event. See Fallback and retries and Verify SMS webhook signatures.

Next steps

Last updated on