Skip to main content

Install the package

npm install pindo-sms

TypeScript setup

pindo-sms ships with TypeScript definitions at dist/index.d.ts. No additional @types package is required — types are available automatically after installation. Make sure your tsconfig.json includes the following compiler options:
tsconfig.json
{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es2017",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "strict": true
  }
}

Set up your API token

Pindo SMS authenticates every request using your API token. Store it as an environment variable so it is never hard-coded in source files.
.env
PINDO_API_TOKEN=your_api_token_here
Never commit your .env file to version control. Add it to .gitignore before your first commit.
Load the variable at runtime using a package like dotenv:
import 'dotenv/config';

Initialize the client

Import PindoSMS and create an instance with your token:
import { PindoSMS } from 'pindo-sms';

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

Constructor parameters

The PindoSMS constructor accepts three parameters:
ParameterTypeDefaultDescription
tokenstringYour Pindo API token (required)
baseUrlstringhttps://api.pindo.ioBase URL for the Pindo API
versionstringv1API version string
You only need to supply baseUrl or version if you are targeting a non-default endpoint:
import { PindoSMS } from 'pindo-sms';

// Default — connects to https://api.pindo.io/v1/sms/
const pindo = new PindoSMS(process.env.PINDO_API_TOKEN!);

// Custom base URL and version
const pindoCustom = new PindoSMS(
  process.env.PINDO_API_TOKEN!,
  'https://api.pindo.io',
  'v1'
);
Keep a single shared PindoSMS instance in your application rather than creating a new one per request.

Build docs developers (and LLMs) love