Zero-dependency TypeScript SDK for mNotify BMS API — send SMS, manage contacts and groups, and handle account operations with railway-oriented programming.
- Zero runtime dependencies — uses native
fetch - Runtime-agnostic — Node 18+, Deno, Bun, Cloudflare Workers, browsers
- Functional error handling — every method returns a
Resulttype - Dual-published — npm + JSR
npm install mnotify-ts-sdk
import { MNotify } from "mnotify-ts-sdk";
const mnotify = new MNotify({
apiKey: process.env.MNOTIFY_API_KEY!,
});
const result = await mnotify.sms.send({
recipient: "233200000000",
sender: "MyApp",
message: "Hello from mNotify!",
});
result.match({
ok: (res) => console.log(`Sent! Campaign: ${res.summary._id}`),
err: (err) => console.error(`Failed: ${err.message}`),
});| Service | Methods | Description |
|---|---|---|
mnotify.sms |
send, getStatus |
Send SMS and check delivery |
mnotify.contacts |
create, list |
Manage contacts |
mnotify.groups |
create, list, get, addContact, removeContact, delete |
Contact groups |
mnotify.templates |
create, list, get, delete |
SMS templates |
mnotify.account |
getBalance, registerSender, checkSender |
Account & sender IDs |
Every method returns Result<T, MNotifyError> — see Error Handling.
No try/catch needed. Every method returns a Result type:
const result = await mnotify.account.getBalance();
if (result.isOk()) {
console.log(`Balance: ${result.value.balance}`);
console.log(`Bonus: ${result.value.bonus ?? 0}`);
} else {
console.error(result.error.message, result.error.statusCode);
}Chain operations with .map() and .andThen():
import { ok, err, tryCatch, combine } from "mnotify-ts-sdk";
const final = await result
.map((data) => transform(data))
.andThen((transformed) => doMore(transformed));npm install mnotify-ts-sdk
import { MNotify } from "mnotify-ts-sdk";bun add mnotify-ts-sdk
import { MNotify } from "mnotify-ts-sdk";npx jsr add @adjarnor/mnotify-ts-sdk
deno add jsr:@adjarnor/mnotify-ts-sdk
import { MNotify } from "jsr:@adjarnor/mnotify-ts-sdk";const mnotify = new MNotify({
apiKey: "your-api-key", // required
baseUrl: "https://...", // optional (default: https://api.mnotify.com/api)
timeout: 10000, // optional (default: 10000ms)
maxRetries: 3, // optional (default: 3, only on 429)
});Full documentation at https://adjanour.github.io/mnotify-ts-sdk or run locally:
npm run docs:dev
Runnable examples live in examples/:
npm run example:smsnpm run example:railwaynpm run example:content
Cross-runtime example commands:
- Node:
npm run build && npm run example:smoke - Bun:
npm run build && MNOTIFY_EXAMPLE_MODE=smoke bun run examples/sendSMS.ts - Deno:
npm run build && MNOTIFY_EXAMPLE_MODE=smoke deno run --allow-env examples/sendSMS.ts
| Script | Description |
|---|---|
npm run build |
Build ESM + CJS |
npm test |
Run tests |
npm run lint |
Biome lint |
npm run format |
Biome format |
npm run example:sms |
Run the SMS example |
npm run example:railway |
Run the Result-pattern example |
npm run example:content |
Run the groups/templates example |
npm run example:smoke |
Smoke-run all examples in Node |
npm run docs:dev |
Start docs dev server |
npm run docs:build |
Build static docs |
MIT