TypeScript SDK
The Goomzo API for TypeScript and JavaScript.
@goomzo/sdk is the Goomzo API for TypeScript and JavaScript. It types every request and answer, retries safely,
and pages through lists for you. It has no dependencies, and runs anywhere with fetch.
Requirements
- Node 20 or later, Bun, Deno, Cloudflare Workers or Vercel Edge.
- An API key. See Authentication.
Install
npm install @goomzo/sdkMake your first request
Set your API key's secret as GOOMZO_API_KEY, then send a message:
import { Goomzo } from '@goomzo/sdk'
const goomzo = new Goomzo()
const message = await goomzo.messages.sendOne({
to: '+255712345678',
channel: 'sms',
content: { text: 'Amina, order #1042 is ready.' },
})
console.log(message.id, message.status)What it does for you
- Types: every request and answer is typed, made from the API's own description.
- A fixed version: it pins the API version it was written for, so a new version never changes what your code gets.
- Safe retries: network errors,
429and5xxare tried again, twice by default. EveryPOSTcarries anIdempotency-Key, the same on each try, so nothing is done twice. - Lists: await a list for one page, or loop over it with
for awaitfor every item. - Errors you can act on: a
GoomzoErrorhas thestatus, thecode, thefieldsthat were wrong and therequestId.
Next steps
Last updated