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 🙏

© 2024 – Pkg Stats / Ryan Hefner

termii-node-client

v1.0.0

Published

NodeJs wrapper for api.termii.com

Downloads

101

Readme

termii-node-client

NodeJs wrapper for Termii API. See termii documentation

Usage

  • CommonJS
const { Termii } = require("termii-node-client");
  • ES module
import { Termii } from "termii-node-client";

Tokens

Token allows businesses generate, send and verify one-time-passwords.

  • Send Token

The send token API allows businesses trigger one-time-passwords (OTP) across any available messaging channel on Termii. One-time-passwords created are generated randomly and there's an option to set an expiry time.


    const tokenDetails = {
      pinType: "NUMERIC",
      to: "+2348000000001",
      from: "termii",
      channel: "generic",
      pinAttempts: 1,
      timeToLive: 60,
      digits: 4,
      message: "Hello from termii node wrapper. Your OTP is <otp>",
    };

    const termii = Termii(TERMII_KEY);

    termii
        .token()
        .send(tokenDetails)
        .then((r) => console.log("response >>> ", r))
        .catch((e) => console.error("error >>> ", e));

Using Asyn/Await

const sendRes = await termii.token().send(tokenDetails);
  • Verify Token

Verify token API, checks tokens sent to customers and returns a response confirming the status of the token. A token can either be confirmed as verified or expired based on the timer set for the token.


const verifyTokenDetails = {
      pin: 3480,
      pinId: "fbe014a4-6580-4c88-a1c9-7ad3df44000b",
    };

    const verifyRes = await termii.token().verify(verifyTokenDetails);

    console.log(verifyRes, "verify response");

Switch

Switch allows you to send messages to any country in the world across SMS and WhatsApp channel

  • Send Message

This channel is used to send messages to phone number not on dnd


const msgDetails = {
      sms: "Testing termii node client wrapper",
      to: '+2348000000001',
      from: "Termii",
    };

    const termii = Termii(TERMII_KEY);

    const sendsms = await termii.message().sendSms(msgDetails);
    console.log(sendsms, "<<< send sms response");
  • Send Bulk Message
const msgDetails = {
      sms: "Testing termii node client wrapper",
      to: ["+2348000000001", "+2348000000002", "+2348000000003"],
      from: "Termii",
    };

    const termii = Termii(TERMII_KEY);

    const sendBulksms = await termii.message().sendBulkSms(msgDetails);
    console.log(sendBulksms, "<<< send sms response");
  • Send DND Message

This channel allows users to send and deliver messages to phone numbers with or without dnd restriction

For customers sending messages to Nigeria, DND stands for Do-Not-Disturb and phone numbers with DND settings activated are blocked from receiving messages from the generic route by the Mobile Network Operators.

Learn more about DND a blog post by Termii

DND messages on Termii is possible using Termii's default IDs; Talert or SecureOTP (Termii applies for DND IDs for only companies that have CBN/NCC license).

In order to activate Termii's DND default IDs, that is already whitelisted with the Telcos on your account, you need to upload the KYC documents listed below.

  1. CAC document or certificate
  2. A sample of the messages you would be sending out.

Promotions messages are STRICTLY not allowed on our DND route on any of Termii's default sender IDs

See Termii Documentation


const msgDetails = {
      sms: "Testing termii node client wrapper",
      to: '+2348000000001',
      from: "Termii",
    };

    const termii = Termii(TERMII_KEY);

    const sendsms = await termii.message().sendSmsDnd(msgDetails);
    console.log(sendsms, "<<< send sms response");
  • Send Bulk Message
const msgDetails = {
      sms: "Testing termii node client wrapper",
      to: ["+2348000000001", "+2348000000002", "+2348000000003"],
      from: "Termii",
    };

    const termii = Termii(TERMII_KEY);

    const sendBulksms = await termii.message().sendBulkSmsDnd(msgDetails);
    console.log(sendBulksms, "<<< send sms response");

If your senderId has been approved for sending DND messages set useTermiiDefaultId to false in the sendSmsDnd and sendBulkSmsDnd method.