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

@emmsdan/termii-js

v1.0.6

Published

a javascript package for some of termii sms platform - - https://www.termii.com

Downloads

14

Readme

Termii-JS Laravel Package

Termii-JS is a Laravel package that simplifies setting up, testing, and managing your Termii integration directly in your Laravel application.

Total Downloads

Installation

You can install the package via npm:

npm install @emmsdan/termii-js

You can install the package via yarn:

yarn add @emmsdan/termii-js

Usage

Declare an Instance of the TermiiJs Class You can create an instance of the TermiiJs class by providing your Termii API key:

import { TermiiJs } from '@emmsdan/termii-js';

const termii = new TermiiJs("YOUR-TERMII-API-KEY");

Check Your Termii Balance

You can check your Termii account balance by calling the balance method:

termii.balance()
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});

Reports for Messages Sent

To retrieve reports for messages sent across SMS, voice, and WhatsApp channels, use the history method:

termii.history()
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});

Detect If a Number Is Fake or Ported

You can check if a phone number is fake or has ported to a new network using the status method:

const phoneNumber = 1234567890; // Replace with the phone number you want to check
const countryCode = 'US'; // Replace with the appropriate country code

termii.status(phoneNumber, countryCode)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});

Verify Phone Numbers

Verify phone numbers and automatically detect their status with the search method:

const phoneNumber = 1234567890; // Replace with the phone number you want to verify

termii.search(phoneNumber)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});

Retrieve Sender ID Status

You can retrieve the status of all registered sender IDs using the allSenderId method:

termii.allSenderId()
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});

Request a New Sender ID

To request a new sender ID, use the submitSenderId method:

const senderId = 'NEW_SENDER_ID'; // Replace with the sender ID you want to request
const useCase = 'SAMPLE_USE_CASE'; // Replace with the intended use case
const company = 'YOUR_COMPANY_NAME'; // Replace with your company name

termii.submitSenderId(senderId, useCase, company)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});

Send Messages

Send messages using the sendMessage method:

const to = 1234567890; // Replace with the recipient's phone number
const from = 'SENDER_ID'; // Replace with your sender ID
const sms = 'Hello, World!'; // Replace with your message content

termii.sendMessage(to, from, sms)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});

Send OTP

Send one-time passwords (OTP) with the sendOTP method:

const to = 1234567890; // Replace with the recipient's phone number
const from = 'SENDER_ID'; // Replace with your sender ID
const messageType = 'TEXT'; // Replace with the desired message type
const pinAttempts = 3; // Replace with the number of OTP attempts allowed
const pinTimeToLive = 3600; // Replace with the OTP expiration time in seconds
const pinLength = 6; // Replace with the OTP length
const pinPlaceholder = 'PIN_PLACEHOLDER'; // Replace with a placeholder for the OTP
const messageText = 'Your OTP is: PIN_PLACEHOLDER'; // Replace with the message text

termii.sendOTP(to, from, messageType, pinAttempts, pinTimeToLive, pinLength, pinPlaceholder, messageText)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});

Send Voice OTP

Send voice OTP using the sendVoiceOTP method:

const to = 1234567890; // Replace with the recipient's phone number
const pinAttempts = 3; // Replace with the number of OTP attempts allowed
const pinTimeToLive = 3600; // Replace with the OTP expiration time in seconds
const pinLength = 6; // Replace with the OTP length

termii.sendVoiceOTP(to, pinAttempts, pinTimeToLive, pinLength)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});

Send Voice Call

Send voice calls using the sendVoiceCall method:

const to = 1234567890; // Replace with the recipient's phone number
const code = 1234; // Replace with the code for the voice call

termii.sendVoiceCall(to, code)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
});

OTP Validation

You can verify or validate OTP using the verifyOTP method:

    const pinId = 'PIN_ID'; // Replace with the PIN ID
    const pin = '123456'; // Replace with the OTP to validate
    
    termii.verifyOTP(pinId, pin)
        .then((result) => {
            console.log(result);
        })
        .catch((error) => {
            console.error(error);
        });

Send In-App OTP

Send In-App OTP using the sendInAppOTP method:

    const to = 1234567890; // Replace with the recipient's phone number
    const pinAttempts = 3; // Replace with the number of OTP attempts allowed
    const pinTimeToLive = 3600; // Replace with the OTP expiration time in seconds
    const pinLength = 6; // Replace with the OTP length
    const pinType = 'numeric'; // Replace with the type of In-App OTP
    
    termii.sendInAppOTP(to, pinAttempts, pinTimeToLive, pinLength, pinType)
        .then((result) => {
        console.log(result);
        })
        .catch((error) => {
        console.error(error);
    });

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT)