TypeScript SDK

A typed client for the bubbl3 API.

The bubbl3 TypeScript SDK is a typed client generated from the same OpenAPI document as the API reference. Every call has a typed method, writes take an idempotency key, safe calls retry after network errors and rate limits, and verifyWebhook checks webhook signatures. It runs on Node 20 or later.

import { Bubbl3 } from "@bubbl3/sdk";

const b3 = new Bubbl3({ apiKey: process.env.BUBBL3_API_KEY });

await b3.messages.create(
  { to: "+19175550142", body: "Hi Maya, still good for Thursday at 4:30?" },
  { idempotencyKey: "confirm-4821" },
);

Details

How it works.

In the API, each number is a line object, so the SDK lists your numbers with lines.list.

The client

  • The package is @bubbl3/sdk. Create a client with your API key: new Bubbl3({ apiKey }).
  • Every public call has a typed method, grouped by section, such as messages.create, contacts.list, lines.list and webhooks.create.
  • Writes take { idempotencyKey } as their last argument. Pass your own on every send, named after what you're doing.
  • Reads, and writes with an idempotency key, are retried twice after a network error, a 429 or a 5xx, unless the API asks to wait more than a minute. A Retry-After longer than 60 seconds is thrown at once.
  • Lists return { data, next_cursor }.

Errors

A failed call throws a Bubbl3ApiError with its status, code, message and request id, with subclasses such as Bubbl3ValidationError and Bubbl3RateLimitError (with retryAfterSeconds). A call that never gets a response throws Bubbl3ConnectionError. All of them extend Bubbl3Error.

Webhooks

verifyWebhook(rawBody, header, secret) checks a delivery's bubbl3-signature header and returns true or false. It never throws, and a missing secret always fails.

Updated

Ready to see your first blue bubble?

Tell us who you text and roughly how many people a month. We'll reply within one business day with a recommended setup.