proovl-sms
proovl-sms
is an npm package that allows you to send SMS messages using the Proovl SMS API.
Installation
To install the package, run the following command:
npm install proovl-sms
Usage
Here's an example of how you can use the package to send an SMS message:
const sendMessage = require('proovl-sms').sendMessage;
const user = '***************';
const token = '***************';
const from = '***************';
const to = '***************';
const text = 'hi npm';
sendMessage(user, token, from, to, text, function(err, response) {
if (err) {
console.error(err);
} else {
console.log(response);
}
});
Parameters
The following parameters are required to send an SMS message:
-
user
: Your Proovl API user ID. You can obtain this from your Proovl account. -
token
: Your Proovl API authentication token. You can obtain this from your Proovl account. -
from
: The sender's name or phone number. This must be registered with Proovl. Leave this blank if you want to use the default sender name. -
to
: The recipient's phone number in international format (e.g. "+44555555555"). -
text
: The message you want to send.
bulkMessage
This function sends the same text message to multiple phone numbers using the Proovl SMS API. It takes the following parameters:
user
: Your Proovl username.
token
: Your Proovl authentication token.
from
: The sender name or number for the message.
toList
: A semicolon-separated list of recipient phone numbers.
text
: The text message to send.
The function returns an array of responses from the Proovl API for each message sent. Each response corresponds to the message sent to a specific phone number in the toList parameter. If an error occurs while sending any of the messages, the function will return an error object in the callback.
Example usage:
const sendMessage = require('proovl-sms').sendMessage;
const bulkMessage = require('proovl-sms').bulkMessage;
const user = 'your_proovl_user';
const token = 'your_proovl_token';
const from = 'your_sender_name';
const toList = 'recipient_phone_number_1;recipient_phone_number_2;recipient_phone_number_3';
const text = 'your_sms_text';
bulkMessage(user, token, from, toList, text, function(err, messages) {
if (err) {
console.error(err);
} else {
console.log(messages);
}
});
Credits
The proovl-sms
package was developed by Tomas. You can obtain your own Proovl account and API credentials from proovl.com.