npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pindo-sms

v1.0.5

Published

A lightweight npm package to easily send SMS messages using the Pindo API.

Downloads

7

Readme

PindoSMS SDK

Introduction

The PindoSMS SDK allows you to easily integrate the Pindo SMS API into your JavaScript applications. This SDK provides methods to send SMS messages, manage sender IDs, retrieve user details, and get analytics data.

Table of Contents

Installation

NPM

To install the PindoSMS SDK using npm, run the following command:

npm install pindo-sms

Yarn

To install the PindoSMS SDK using yarn, run the following command:

yarn add pindo-sms

Usage

Setting Up

Node.js / NestJS

const { PindoSMS } = require('pindo-sms');

const token = process.env.PINDO_API_TOKEN;
const pindoSMS = new PindoSMS(token);

ES6 Modules

import { PindoSMS } from 'pindo-sms';

const token = process.env.PINDO_API_TOKEN;
const pindoSMS = new PindoSMS(token);

React / Next.js

In a React or Next.js project, you can set up PindoSMS in a similar way to Node.js or ES6 Modules.

import React from 'react';
import { PindoSMS } from 'pindo-sms';

const App = () => {
    const token = process.env.PINDO_API_TOKEN;
    const pindoSMS = new PindoSMS(token);

    // Use pindoSMS methods as needed

    return <div>My React App</div>;
};

export default App;

Angular

In an Angular project, you can set up PindoSMS in a service.

import { Injectable } from '@angular/core';
import { PindoSMS } from 'pindo-sms';

@Injectable({
  providedIn: 'root',
})
export class PindoSMSService {
  private pindoSMS: PindoSMS;

  constructor() {
    const token = 'YOUR_API_TOKEN';
    this.pindoSMS = new PindoSMS(token);
  }

  // Use pindoSMS methods as needed
}

Vue

In a Vue project, you can set up PindoSMS in a component or a service.

import { PindoSMS } from 'pindo-sms';

export default {
  name: 'App',
  data() {
    return {
      pindoSMS: new PindoSMS('YOUR_API_TOKEN'),
    };
  },
};

Methods and Examples

Sending an SMS

const payload = {
    to: 'recipient_phone_number',
    text: 'Your message here',
    sender: 'YourSenderID',
};

pindoSMS.sendSMS(payload)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Sending Bulk SMS

const bulkPayload = {
    messages: [
        { to: 'recipient_phone_number1', text: 'Message 1', sender: 'YourSenderID' },
        { to: 'recipient_phone_number2', text: 'Message 2', sender: 'YourSenderID' },
        // Add more messages as needed
    ],
};

pindoSMS.sendBulkSMS(bulkPayload)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Creating a Sender ID

const senderID = 'YourSenderID';
const countries = ['Country1', 'Country2'];

pindoSMS.createSenderID(senderID, countries)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Getting Sender IDs

pindoSMS.getSenderIDs()
    .then(response => console.log(response))
    .catch(error => console.error(error));

Getting User Details

pindoSMS.getUserDetails()
    .then(response => console.log(response))
    .catch(error => console.error(error));

Getting Analytics

const timezoneOffset = -120;
const start = '2023-01-01';
const timeframe = '30d';

pindoSMS.getAnalytics(timezoneOffset, start, timeframe)
    .then(response => console.log(response))
    .catch(error => console.error(error));

Features

  • Send SMS
  • Send Bulk SMS
  • Create and manage sender IDs
  • Retrieve user details
  • Retrieve SMS analytics

Dependencies

  • node-fetch: Used for making HTTP requests

Configuration

You need an API token from Pindo to use this SDK. You can set the token and base URL during the initialization of the PindoSMS class.

To get an API token:

  1. Sign up at Pindo
  2. Retrieve your token from Pindo Security Settings
  3. Store the token in your .env file as follows:
PINDO_API_TOKEN=your_api_token

Documentation

For more detailed documentation, visit the Pindo API documentation.

Examples

See the Usage section for examples of how to use the PindoSMS SDK.

Troubleshooting

If you encounter any issues, check the following:

  • Ensure your API token is correct.
  • Verify the payload structure matches the Pindo API requirements.
  • Check network connectivity.

Contributors

License

This project is licensed under the MIT License - see the LICENSE file for details.