Portfolio
← Projects
dialog-esms logo
npm package · 2026

dialog-esms

An unofficial TypeScript SDK for Dialog's eSMS API, with no dependencies, for Node, Bun, Deno and the edge.

TypeScriptnpmSDKCLI
Get dialog-esms on npm
npm install dialog-esms

dialog-esms is an SDK I wrote for Dialog’s eSMS API, a bulk SMS service in Sri Lanka. It sends SMS and checks campaign status, delivery reports and your account balance. It’s an unofficial community package.

import { EsmsClient } from 'dialog-esms';

const esms = new EsmsClient({ username: '947xxxxxxxx', password: 'your-password' });

await esms.sendSms({ to: '0771234567', message: 'Your OTP is 123456' });

What it does

  • It logs in, keeps the token, and logs in again when the token expires.
  • It supports both the token-based POST API and the URL key GET API.
  • It accepts numbers as 0771234567 or 94771234567, one at a time or as a list.
  • Errors come back as an EsmsError, with the API’s error code turned into a readable message.

How it’s built

  • It has no dependencies. It uses the built-in fetch, so it runs on Node 18+, Bun, Deno and edge runtimes.
  • It ships as both ESM and CommonJS, with types.
  • A small CLI gets an access token for testing or scripts. It prints only the token to stdout, so you can put it into an environment variable:
npx dialog-esms token --username 947xxxxxxxx