Skip to main content
1

Install the package

npm install pindo-sms
2

Get your API token

  1. Sign up or log in at app.pindo.io
  2. Go to Account → Security settings
  3. Copy your API token
Store your token in a .env file as PINDO_API_TOKEN=your_token_here and load it with dotenv. Never hard-code tokens in source files.
3

Initialize the client

Create a PindoSMS instance using your token:
import { PindoSMS } from 'pindo-sms';

const pindo = new PindoSMS(process.env.PINDO_API_TOKEN!);
4

Send your first SMS

Call sendSMS with a payload containing to, text, and sender:
import 'dotenv/config';
import { PindoSMS, SMSPayload } from 'pindo-sms';

const pindo = new PindoSMS(process.env.PINDO_API_TOKEN!);

const payload: SMSPayload = {
  to: '+250781234567',
  text: 'Hello from Pindo!',
  sender: 'MyApp',
};

const response = await pindo.sendSMS(payload);
console.log(response);
The SMSPayload fields are:
FieldTypeDescription
tostringRecipient phone number in E.164 format, e.g. +250781234567
textstringMessage body
senderstringSender ID displayed to the recipient
5

Handle the response

sendSMS returns a Promise that resolves with the Pindo API response. Use a try/catch block to handle errors:
import 'dotenv/config';
import { PindoSMS, SMSPayload } from 'pindo-sms';

const pindo = new PindoSMS(process.env.PINDO_API_TOKEN!);

async function main() {
  try {
    const payload: SMSPayload = {
      to: '+250781234567',
      text: 'Hello from Pindo!',
      sender: 'MyApp',
    };

    const response = await pindo.sendSMS(payload);
    console.log('SMS sent:', response);
  } catch (error) {
    console.error('Failed to send SMS:', error);
  }
}

main();

Build docs developers (and LLMs) love