Skip to content

JavaScript / TypeScript

The SMS Bridge API is plain HTTPS and JSON, so you do not need a special package. This example uses the standard HTTP client — it needs Node.js 18 or newer (or Bun / Deno). Official client packages are planned; until then, copy this into your project.

Send an SMS

Put your API key in the SMS_BRIDGE_KEY environment variable, and use one of your paired phone numbers as from_number.

// Node.js 18+ (built-in fetch)
const res = await fetch("https://api.99billingsolutions.com/v1/messages/send", {
  method: "POST",
  headers: {
    "x-api-key": process.env.SMS_BRIDGE_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    from_number: "+15550100001",
    to_number: "+15550100002",
    content: "Your order #A12 has shipped",
  }),
});

const body = await res.json();
if (!res.ok) throw new Error(`${body.error_code}: ${body.message}`);
console.log(body.data.id, body.data.status);

Good practice

  • Keep the key on your server, never in browser or app code.
  • Pass a unique request_id per message, so retrying after a timeout can never send twice.
  • On 429, wait for the Retry-After seconds before retrying.
  • Receive replies and delivery updates with webhooks and verify their signature.

Related