npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@davidbolaji/termii-node

v1.0.3

Published

Node.js SDK for Termii API – send SMS, voice, OTP, and manage messaging with ease.

Downloads

16

Readme

Termii Node SDK

npm version build status

TypeScript SDK for Termii API. Provides convenient methods to send SMS, bulk messages, WhatsApp templates, manage campaigns, handle Sender IDs, OTP tokens, and eSIM services.

Installation

npm install @davidbolaji/termii-node

Quick Start

Using the Termii Client Class

import { Termii } from '@davidbolaji/termii-node';

const client = new Termii('YOUR_API_KEY');

// Send a message
const response = await client.message.sendMessage({
  to: '+2348012345678',
  from: 'SENDERID',
  sms: 'Hello from Termii SDK',
  type: 'plain',
  channel: 'generic'
});

Using Direct Functions

import { initialize, sendMessage } from '@davidbolaji/termii-node';

// Initialize once
initialize('YOUR_API_KEY');

// Send a single message
const response = await sendMessage({
  to: '+2348012345678',
  from: 'SENDERID',
  sms: 'Hello directly',
  type: 'plain',
  channel: 'generic'
});

Features

  • Messaging: Send SMS, WhatsApp, bulk, and template messages.
  • Campaigns: Create, list, retry, and view campaign history.
  • Sender IDs: Fetch and request new sender IDs.
  • OTP Tokens: Send and verify OTP via SMS, WhatsApp, Voice, Email, and In-App.
  • Insights: Balance, number lookup, history, porting, and webhook event verification.
  • eSIM Services (Sotel): Plans, provisioning, QR codes, usage tracking.

Examples

Messaging

const single = await client.message.sendMessage({
  to: '+2348012345678',
  from: 'SENDERID',
  sms: 'Hello world',
  type: 'plain',
  channel: 'generic'
});

Bulk Messaging

const bulk = await client.message.sendBulkMessage({
  to: ['+2348012345678', '+2348098765432'],
  from: 'SENDERID',
  sms: 'Hello everyone',
  type: 'plain',
  channel: 'generic'
});

Template Messaging

const template = await client.template.sendTemplate({
  phone_number: '2348012345678',
  device_id: 'DEVICE_ID',
  template_id: 'TEMPLATE_ID',
  data: { name: 'Alice', code: '9876' }
});

Campaigns

const sent = await client.campaign.sendCampaign({
  country_code: '234',
  sender_id: 'SENDERID',
  message: 'Hello campaign',
  channel: 'generic',
  message_type: 'plain',
  phonebook_id: 'PHONEBOOKID',
  campaign_type: 'promo',
  schedule_sms_status: 'regular'
});

Sender IDs

const senderIds = await client.sender.fetchSenderIds(1);

OTP Tokens

const otp = await client.token.sendToken({
  to: '2348012345678',
  from: 'SENDERID',
  channel: 'whatsapp',
  pin_attempts: 3,
  pin_time_to_live: 5,
  pin_length: 6,
  message_text: 'Your verification code is < 123456 >',
  pin_type: 'NUMERIC'
});

Insights

const balance = await client.insight.balance.getBalance();

eSIM Services

const esimPlans = await client.sotel.esim.fetchPlans({
  country: 'Nigeria',
  type: 'LOCAL'
});

Advanced Configuration

  • Custom Base URL:
    Pass baseUrl to the constructor:

    const client = new Termii('YOUR_API_KEY', 'https://api.custom-url.com');
  • Auth Location:
    Control how API key is injected (query, body, none).

    const response = await (client as any).http.request('/sms/otp/send', {
      method: 'POST',
      data: payload,
      authLocation: 'body'
    });
  • Raw HTTP Responses:
    Retrieve status, headers, and data.

    const { status, headers, data } = await (client as any).http.request('/sms/history', {
      authLocation: 'none',
      raw: true
    });
  • Extend the SDK:
    Subclass Termii to add interceptors.

    class CustomTermii extends Termii {
      constructor(apiKey: string, baseUrl?: string) {
        super(apiKey, baseUrl);
        this['http'].client.interceptors.request.use(config => {
          // custom request logic
          return config;
        });
      }
    }

Contributing

Contributions welcome! Please open issues or pull requests.


License

MIT