npm package for notify africa api
# Notify Africa SDK
SMS, WhatsApp, Voice, AI Chatbots, and CRM - all in one powerful platform designed for businesses across Africa.
This is a TypeScript/JavaScript SDK for interacting with the Notify Africa API, focusing on SMS messaging features. It provides a simple class-based interface for sending single or batch SMS messages and checking message status. Built with native `fetch` for zero external dependencies (requires Node.js >= 18.0.0).
## Features
- Send single SMS messages
- Send batch SMS messages to multiple recipients
- Check the status of sent messages
- Configurable base URL (defaults to `
api.notify.africa`)
- TypeScript support with full type definitions
- No external dependencies
## Installation
Install the package via npm:
```bash
npm install notify-africa
```
Or via yarn:
```bash
yarn add notify-africa
```
```ts
import { NotifyAfrica } from "notify-africa-npm"; // or from the package when published
const notifyAfrica = new NotifyAfrica(
process.env.NOTIFY_API_TOKEN || "your-token-here"
);
async function run() {
// Send a single message
const single = await notifyAfrica.sendSingleMessage(
"255123456789",
"Hello from API Management endpoint!",
"137"
);
console.log(single); // { messageId: "156023", status: "PROCESSING" }
// Send a batch
const batch = await notifyAfrica.sendBatchMessages(
["255123456789", "255123456789"],
"test",
"137"
);
console.log(batch); // { messageCount: 2, creditsDeducted: 2, remainingBalance: 1475 }
// Check status
const status = await notifyAfrica.checkMessageStatus("156022");
console.log(status); // { messageId: "156022", status: "SENT", sentAt: null, deliveredAt: "2025-11-13T12:34:08.540Z" }
}
run().catch(console.error);
```
console.log('Single message sent:', response); // { messageId: '156023', status: 'PROCESSING' }
} catch (error) {
console.error('Error:', error.message);
}
}
sendSingle();
### Send Batch Messages
```typescript
async function sendBatch() {
try {
const response = await clie …