Skip to content

Node js SDK for the Termii messages(SMS) and one time password (OTP) services. User verification through the mobile number, In App Authentication, Voice Token, Call token, and Authentication services

License

Notifications You must be signed in to change notification settings

abduljeleelng/termii-nodejs-sdk

Repository files navigation

Node js SDK for the Termii messages (SMS) and one time password (OTP) services

Introduction

These docs will give you a deep dive into Termii Nodejs SDK full API Reference Documentation and how to seamlessly integrate Termii messaging channels and verification functionalities into NodeJS application. For more details about the Termii services

Installation

Use need NodeJS or yarn package manager to use this SDK with your nodejs application. Note: all the instance return promise.

npm install termii-nodejs-sdk

or

yarn add termii-nodejs-sdk

Get your api key

create an account at termii.com.

  • login to your account
  • click on the setting
  • click on the API Token
  • copy your API Key
  • the image bellow can guid you more termii API console!

Basic

#
import Termii from "termii-nodejs-sdk"

#es5
const Termii = require("termii-nodejs-sdk").default

#usage 
const termii = new Termii("your API Key")

#Get your account balance 
let balance = termii.balance(); #balance will return a promise
balance.then(data=>{
    console.log(JSON.stringify({data}))
})

#Or
termii.balance().then(data=>{console.log({data})}).catch(err=>{console.log({err})})

#Or
 (async () => {
     balance = await termii.balance();
     console.log(JSON.stringify({balance}))
 })()
 
 # Request for A token 
 termii.token({
    message_type: "NUMERIC",
    to: "2348037.........",
    from: "Token",
    channel: "generic",
    pin_attempts: 4,
    pin_time_to_live: 4,
    pin_length: 6,
    pin_placeholder: "< 123456 >",
    message_text: "Your (company name) confirmation code is < 123456 >. It expires in 30 minutes",
    "pin_type":"NUMERIC"
}).then(dat=>console.log({dat})).catch(er=>console.log({er}));

Available Services

 #
import Termii from "termii-nodejs-sdk"

#es5
const Termii = require("termii-nodejs-sdk").default

#usage 
const termii = new Termii("your API Key")

termii.getSenderId() Get all the your available sender id

termii.requestSenderId({sender_id,usecase,company}) Request for a new sender Id

termii.sendSMS({to,from,sms,type,channel,media}) Send SMS

termii.bulkSMS({to,from,sms,type,channel}) Send bulk SMS

termii.message({to,sms}) Send message | Number API

termii.template({phone_number,device_id,template_id,data:{product_name,opt,expiry_time}}) Template

termii.phoneBook() Get phone book

termii.createPhoneBook({phonebook_id,phonebook_name,description}) create phone book

termii.updatePhoneBook({phonebook_id,phonebook_name,description}) update phone book

termii.deletePhoneBook({phonebook_id}) Delete phone book

termii.contact({phonebook_id}) get all the contact

termii.addContact({phonebook_id,phone_number,country_code,email_address,first_name,last_name,company}) Add contact

termii.addBulkContact({phonebook_id,contact_file,country_code}) Add bulk Contact

termii.deleteContact({contact_id}) delete contact

termii.campaign({country_code,sender_id,message,channel,message_type,phonebook_id,campaign_type,schedule_sms_status,schedule_time}) Campaign

termii.campaignList() Campaign List

termii.campaignHistory({campaign_id}) Campaign Hostory

termii.token({message_type,to,from,channel,pin_attempts,pin_time_to_live,pin_length,pin_placeholder,message_text}) Token | OTP

termii.voiceToken({pin_type,phone_number,pin_attempts,pin_time_to_live,pin_length}) Voice Token

termii.callToken({phone_number,code}) call token | OTP

termii.inAppToken({pin_type,phone_number,pin_attempts,pin_time_to_live,pin_length}) In App Token

termii.verifyToken({pin_id,pin}) Verify Token

termii.balance() get account balance

termii.search({phone_number}) search

termii.status({ phone_number:", country_code:"}) status

termii.history() history

Report issues here 💔

Termii nodejs SDK issue

Documentation

Termi services

Todo

  • Create more sample to consume all the services
  • create more details in the documentation
  • add more validation to the payload and response
  • write an article about the services

Contact Me

[Abduljeleel Yusuff]mailto:[email protected]

About

Node js SDK for the Termii messages(SMS) and one time password (OTP) services. User verification through the mobile number, In App Authentication, Voice Token, Call token, and Authentication services

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published