1.0.11 • Published 5 months ago

sms-plivo v1.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

Plivo SMS Sender

This package provides a simple interface to send SMS messages using the Plivo API.

Installation

Install the package via npm:

bash
npm install sms-plivo

Configuration

Before using the package, obtain your Plivo API credentials (authId and authToken) from the Plivo dashboard. Configure the package by creating a configuration object:

const configuration = {
  authId: "your_auth_id",
  authToken: "your_auth_token",
};

Message Content

Prepare the message content by creating a message object:

const messageContent = {
  src: "Your Company Name or Title",
  dst: "+90XXXXXXXXXX", // The destination number (including country code)
  text: "Your message content",
};

Example Usage

Use the sendSms function to send an SMS:

const { sendSms } = require('sms-plivo');

sendSms(configuration, messageContent)
  .then((response) => {
    console.log('Plivo API Response:', response);
  })
  .catch((error) => {
    console.error('Error:', error.message);
  });

Make sure to handle the promise returned by sendSms.

Configuration Object

The configuration object requires the following properties:

  • authId: Your Plivo API authentication ID.
  • authToken: Your Plivo API authentication token.

Message Object

The messageContent object requires the following properties:

  • src: Your company name or title.
  • dst: The destination number (including the country code).
  • text: The content of your SMS message.

Example

const configuration = {
authId: "your_auth_id",
authToken: "your_auth_token",
};

const messageContent = {
src: "Your Company",
dst: "+901234567890",
text: "Hello, this is a test message.",
};

sendSms(configuration, messageContent)
.then((response) => {
console.log('Plivo API Response:', response);
})
.catch((error) => {
console.error('Error:', error.message);
});

Feel free to customize the configuration and message content according to your needs.

1.0.11

5 months ago

1.0.10

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago