Termii Node SDK
Nodejs SDK for Termii messaging platform written in typescript
Table of content
Prerequisite
Node v16 and higher is required. To make sure you have them available on your machine, try running the following command.
node -v
Getting Started
To get started with this SDK, create an account on Termii if you haven't already.
You can then retrieve your API keys from your Termii dashboard.
Installation
This SDK can be installed with npm or yarn or pnpm.
npm install termii-nodejs-client
yarn install termii-nodejs-client
pnpm add termii-nodejs-client
Usage
Import and Initialize the library
import { Termii } from 'termii-nodejs-client';
const {Termii} = require('termii-nodejs-client')
const termii = new Termii('YOUR_API_KEY');
Instantiate the Termii class
const termii = new Termii('YOUR_API_KEY');
Warning
Be sure to keep your API Credentials securely in environment variables.
Documentation
Available Services exposed by the SDK
Sender ID
A Sender ID is the name or number that identifies the sender of an SMS message.
Fetch Sender ID
const senderIds = await termii.message.fetchSenderIDs()
const senderIds = await termii.message.fetchSenderIDs(2)
Find more details about the parameters and response for the above method here
Create Sender ID
import { type IRequestSenderID } from 'termii-nodejs-client';
const message: IRequestSenderID = {
sender_id: 'acme',
usecase: 'Testing! Working!! This is it!!!',
company: 'Metalabs',
}
const senderIds = await termii.message.requestSenderID(payload)
Find more details about the parameters and response for the above method here
Message
This API allows businesses send text messages to their customers across different messaging channels.
Send message
import { type ISendMessage } from 'termii-nodejs-client';
const message: ISendMessage = {
to: "2347880234567",
from: "talert",
sms: "Hi there, testing Termii",
type: "plain",
channel: "generic",
api_key: "Your API Key",
media: {
url: "https://media.example.com/file",
caption: "your media file"
}
}
const senderIds = await termii.message.sendMessage(payload)
Find more details about the parameters and response for the above method here
Send Bulk message
import { type ISendMessage } from 'termii-nodejs-client';
const message: ISendMessage = {
to: ["23490555546", "23423490126999","23490555546"],
from: "talert",
sms: "Hi there, testing Termii",
type: "plain",
channel: "generic"
}
const senderIds = await termii.message.sendBulkMessage(payload)
Find more details about the parameters and response for the above method here
License
MIT