Skip to main content
Use getAnalytics to fetch SMS delivery statistics for your account. The method lets you filter by time range and adjust for your local timezone. Endpoint: GET https://api.pindo.io/v2/sms/analytics?timezone_offset={timezoneOffset}&start={start}&timeframe={timeframe}

Parameters

timezoneOffset
number
required
Your timezone offset in minutes relative to UTC. For example:
  • UTC+2 → 120
  • UTC-2 → -120
  • UTC → 0
Use new Date().getTimezoneOffset() * -1 to get the current system offset programmatically. Note that Date.getTimezoneOffset() returns the inverse (negative for east of UTC), so multiply by -1 to get the Pindo-expected value.
start
string
required
The start date for the analytics window in YYYY-MM-DD format. For example, '2024-07-20'.
timeframe
string
required
The duration of the analytics window. Accepted values include:
  • '30d' — last 30 days from start
  • '7d' — last 7 days from start
  • '1d' — a single day
  • 'all' — all available data from start

Response shape

The API returns a data object keyed by hour ('HH:mm' format), where each entry contains SMS delivery statistics for that hour:
{
  "data": {
    "00:00": { "sms_count": 0 },
    "01:00": { "sms_count": 3 },
    "02:00": { "sms_count": 0 }
  }
}

Code example

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

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

async function fetchAnalytics() {
  try {
    const response = await pindo.getAnalytics(
      120,           // UTC+2 timezone offset in minutes
      '2024-07-20',  // start date
      '30d',         // timeframe
    );
    console.log('Analytics:', response);
    // response.data is keyed by hour: { '00:00': { sms_count: 0 }, ... }
  } catch (error) {
    console.error('Failed to fetch analytics:', error);
  }
}

fetchAnalytics();

Dynamic timezone example

To use the system’s current timezone automatically:
const timezoneOffset = new Date().getTimezoneOffset() * -1;

const response = await pindo.getAnalytics(
  timezoneOffset,
  '2024-07-20',
  '30d',
);
getAnalytics calls the /v2/sms/analytics endpoint, which is separate from the v1 SMS endpoints used by sendSMS and sendBulkSMS.

Build docs developers (and LLMs) love