TypeScript SDK
The official TypeScript/JavaScript client for the SendAfrica REST API. It is fully typed, has zero runtime dependencies, and uses the native fetch API with automatic retries, backoff, and error mapping.
Feature overview
- Package:
sendafrica— Node.js 18 or newer - Zero runtime dependencies; uses global
fetch - CJS (
require) and ESM (import) builds with bundled type declarations - Full TypeScript types for every request and response
Install
npm install sendafricaQuickstart
import { SendAfricaClient } from 'sendafrica'
const client = new SendAfricaClient({
apiKey: process.env.SENDAFRICA_API_KEY!,
})
const result = await client.sms.send({
to: '0712345678',
message: 'Your verification code is 4921.',
})
console.log(result.messageId, result.status, result.creditsUsed)Instantiate the client in a server-side route, worker, or backend service — never in a browser bundle, because that exposes your API key.
Pages in this section
- Installation
- Authentication
- SMS — single, send-many, bulk, logs, analysis
- Credits
- Payments
- Rates
- Sender IDs
- Webhooks
- Errors
- Phone Numbers
- SMS Calculator
- Lessons
Last updated on