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.
- Installation
- Usage
- Features
- Dependencies
- Configuration
- Documentation
- Examples
- Troubleshooting
- Contributors
- License
To install the PindoSMS SDK using npm, run the following command:
npm install pindo-sms
To install the PindoSMS SDK using yarn, run the following command:
yarn add pindo-sms
const { PindoSMS } = require('pindo-sms');
const token = process.env.PINDO_API_TOKEN;
const pindoSMS = new PindoSMS(token);
import { PindoSMS } from 'pindo-sms';
const token = process.env.PINDO_API_TOKEN;
const pindoSMS = new PindoSMS(token);
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;
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
}
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'),
};
},
};
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));
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));
const senderID = 'YourSenderID';
const countries = ['Country1', 'Country2'];
pindoSMS.createSenderID(senderID, countries)
.then(response => console.log(response))
.catch(error => console.error(error));
pindoSMS.getSenderIDs()
.then(response => console.log(response))
.catch(error => console.error(error));
pindoSMS.getUserDetails()
.then(response => console.log(response))
.catch(error => console.error(error));
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));
- Send SMS
- Send Bulk SMS
- Create and manage sender IDs
- Retrieve user details
- Retrieve SMS analytics
-
node-fetch
: Used for making HTTP requests
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:
- Sign up at Pindo
- Retrieve your token from Pindo Security Settings
- Store the token in your
.env
file as follows:
PINDO_API_TOKEN=your_api_token
For more detailed documentation, visit the Pindo API documentation.
See the Usage section for examples of how to use the PindoSMS SDK.
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.
- Your Name - Initial work
This project is licensed under the MIT License - see the LICENSE file for details.