Skip to main content
Use sendSMS to deliver a message to a single recipient. The method makes a POST request to the Pindo SMS API and returns the API response as a Promise. Endpoint: POST https://api.pindo.io/v1/sms/

Parameters

sendSMS accepts a single SMSPayload object:
to
string
required
The recipient’s phone number in E.164 format, for example +250781234567. The number must include the country code prefix (e.g. +250 for Rwanda).
text
string
required
The message body to send. Plain text only.
sender
string
required
The sender ID displayed to the recipient. This must be a sender ID registered in your Pindo account. See Sender IDs for how to create one.

Phone number formatting

Pindo requires phone numbers in E.164 format:
  • Always start with + followed by the country code
  • No spaces, dashes, or parentheses
  • Examples: +250781234567 (Rwanda), +254712345678 (Kenya), +1415xxxxxxx (USA)
If your users enter numbers in local format (e.g. 0781234567), strip the leading zero and prepend the country code: +250 + 781234567 = +250781234567.

Code example

import 'dotenv/config';
import { PindoSMS, SMSPayload } from 'pindo-sms';

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

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

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

sendMessage();

Error handling

sendSMS returns a Promise. If the API request fails (network error, invalid token, bad payload), the Promise rejects. Always wrap calls in a try/catch block:
try {
  const response = await pindo.sendSMS(payload);
  // handle success
} catch (error) {
  // handle failure — check error.message for details
  console.error('Failed to send SMS:', error);
}
The method returns the full Pindo API response object. The exact shape depends on the API version. Log the response during development to inspect the fields available for your use case.

Build docs developers (and LLMs) love