Gathering detailed insights and metrics for @emmsdan/termii-js
Gathering detailed insights and metrics for @emmsdan/termii-js
Gathering detailed insights and metrics for @emmsdan/termii-js
Gathering detailed insights and metrics for @emmsdan/termii-js
npm install @emmsdan/termii-js
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
13 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Sep 01, 2023
Latest Version
1.0.6
Package Id
@emmsdan/termii-js@1.0.6
Unpacked Size
46.84 kB
Size
10.20 kB
File Count
8
NPM Version
9.5.1
Node Version
18.16.0
Published on
Sep 05, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Termii-JS is a Laravel package that simplifies setting up, testing, and managing your Termii integration directly in your Laravel application.
You can install the package via npm:
1npm install @emmsdan/termii-js
You can install the package via yarn:
1yarn add @emmsdan/termii-js
Declare an Instance of the TermiiJs Class You can create an instance of the TermiiJs class by providing your Termii API key:
1import { TermiiJs } from '@emmsdan/termii-js'; 2 3const termii = new TermiiJs("YOUR-TERMII-API-KEY");
You can check your Termii account balance by calling the balance method:
1termii.balance() 2.then((result) => { 3console.log(result); 4}) 5.catch((error) => { 6console.error(error); 7});
To retrieve reports for messages sent across SMS, voice, and WhatsApp channels, use the history method:
1termii.history() 2.then((result) => { 3console.log(result); 4}) 5.catch((error) => { 6console.error(error); 7});
You can check if a phone number is fake or has ported to a new network using the status method:
1const phoneNumber = 1234567890; // Replace with the phone number you want to check 2const countryCode = 'US'; // Replace with the appropriate country code 3 4termii.status(phoneNumber, countryCode) 5.then((result) => { 6console.log(result); 7}) 8.catch((error) => { 9console.error(error); 10});
Verify phone numbers and automatically detect their status with the search method:
1const phoneNumber = 1234567890; // Replace with the phone number you want to verify 2 3termii.search(phoneNumber) 4.then((result) => { 5console.log(result); 6}) 7.catch((error) => { 8console.error(error); 9});
You can retrieve the status of all registered sender IDs using the allSenderId method:
1termii.allSenderId() 2.then((result) => { 3console.log(result); 4}) 5.catch((error) => { 6console.error(error); 7});
To request a new sender ID, use the submitSenderId method:
1const senderId = 'NEW_SENDER_ID'; // Replace with the sender ID you want to request 2const useCase = 'SAMPLE_USE_CASE'; // Replace with the intended use case 3const company = 'YOUR_COMPANY_NAME'; // Replace with your company name 4 5termii.submitSenderId(senderId, useCase, company) 6.then((result) => { 7console.log(result); 8}) 9.catch((error) => { 10console.error(error); 11});
Send messages using the sendMessage method:
1const to = 1234567890; // Replace with the recipient's phone number 2const from = 'SENDER_ID'; // Replace with your sender ID 3const sms = 'Hello, World!'; // Replace with your message content 4 5termii.sendMessage(to, from, sms) 6.then((result) => { 7console.log(result); 8}) 9.catch((error) => { 10console.error(error); 11});
Send one-time passwords (OTP) with the sendOTP method:
1const to = 1234567890; // Replace with the recipient's phone number 2const from = 'SENDER_ID'; // Replace with your sender ID 3const messageType = 'TEXT'; // Replace with the desired message type 4const pinAttempts = 3; // Replace with the number of OTP attempts allowed 5const pinTimeToLive = 3600; // Replace with the OTP expiration time in seconds 6const pinLength = 6; // Replace with the OTP length 7const pinPlaceholder = 'PIN_PLACEHOLDER'; // Replace with a placeholder for the OTP 8const messageText = 'Your OTP is: PIN_PLACEHOLDER'; // Replace with the message text 9 10termii.sendOTP(to, from, messageType, pinAttempts, pinTimeToLive, pinLength, pinPlaceholder, messageText) 11.then((result) => { 12console.log(result); 13}) 14.catch((error) => { 15console.error(error); 16});
Send voice OTP using the sendVoiceOTP method:
1const to = 1234567890; // Replace with the recipient's phone number 2const pinAttempts = 3; // Replace with the number of OTP attempts allowed 3const pinTimeToLive = 3600; // Replace with the OTP expiration time in seconds 4const pinLength = 6; // Replace with the OTP length 5 6termii.sendVoiceOTP(to, pinAttempts, pinTimeToLive, pinLength) 7.then((result) => { 8console.log(result); 9}) 10.catch((error) => { 11console.error(error); 12});
Send voice calls using the sendVoiceCall method:
1const to = 1234567890; // Replace with the recipient's phone number 2const code = 1234; // Replace with the code for the voice call 3 4termii.sendVoiceCall(to, code) 5.then((result) => { 6console.log(result); 7}) 8.catch((error) => { 9console.error(error); 10});
You can verify or validate OTP using the verifyOTP method:
1 const pinId = 'PIN_ID'; // Replace with the PIN ID 2 const pin = '123456'; // Replace with the OTP to validate 3 4 termii.verifyOTP(pinId, pin) 5 .then((result) => { 6 console.log(result); 7 }) 8 .catch((error) => { 9 console.error(error); 10 });
Send In-App OTP using the sendInAppOTP method:
1 const to = 1234567890; // Replace with the recipient's phone number 2 const pinAttempts = 3; // Replace with the number of OTP attempts allowed 3 const pinTimeToLive = 3600; // Replace with the OTP expiration time in seconds 4 const pinLength = 6; // Replace with the OTP length 5 const pinType = 'numeric'; // Replace with the type of In-App OTP 6 7 termii.sendInAppOTP(to, pinAttempts, pinTimeToLive, pinLength, pinType) 8 .then((result) => { 9 console.log(result); 10 }) 11 .catch((error) => { 12 console.error(error); 13 });
If you discover any security-related issues, please email adamsohiani@gmail.com instead of using the issue tracker.
The MIT License (MIT)
No vulnerabilities found.
No security vulnerabilities found.