Skip to main content

Signature

getAnalytics(timezoneOffset: number, start: string, timeframe: string): Promise<any>

HTTP request

GET https://api.pindo.io/v2/sms/analytics?timezone_offset=<timezoneOffset>&start=<start>&timeframe=<timeframe>

Parameters

timezoneOffset
number
required
The UTC offset in minutes for the timezone you want analytics reported in. For example, use -120 for UTC-2.
start
string
required
The start date for the analytics window in YYYY-MM-DD format (e.g. '2024-07-20').
timeframe
string
required
The length of the analytics window. Use 'all' to retrieve all data from start, or a duration like '30d' for the last 30 days.

Response

A successful response contains a data object keyed by time slot (in HH:MM format), each with an sms_count:
{
  "data": {
    "00:00": {
      "sms_count": 0
    },
    "01:00": {
      "sms_count": 4
    }
  }
}

Example

import { PindoSMS } from 'pindo-sms';

const pindo = new PindoSMS('your-api-token');

const result = await pindo.getAnalytics(-120, '2024-07-20', 'all');
console.log(result.data);

Error handling

try {
  const result = await pindo.getAnalytics(-120, '2024-07-20', 'all');
} catch (err) {
  console.error('Failed to fetch analytics:', err.message);
}
Use timezoneOffset to align the reported time slots with your local timezone. For example, Rwanda (EAT, UTC+3) would use 180.

Build docs developers (and LLMs) love