muthofun-sms-api
v3.0.5
Published
A class for sending SMS notifications via an HTTP API.
Downloads
2
Readme
Muthofun-SMSNotifier
A class for sending SMS notifications via an HTTP API.
Installation
npm install muthofun-sms-api
Usage
import SMSNotifier from 'muthofun-sms-api';
const notifier = new SMSNotifier({ authToken: 'my-auth-token', apiUrl: 'https://sysadmin.muthobarta.com', });
notifier.sendSMSNotification('Hello, world!', '+1234567890') .then(() => { console.log('SMS notification sent'); })
.catch((err) => { console.error(`Error sending SMS notification: ${err.message}`); });
The SMSNotifier class takes an object with authToken and apiUrl properties as its constructor argument. You can then call the sendSMSNotification method with the message content and phone number as its arguments. The method returns a Promise that resolves when the SMS notification has been sent, or rejects with an error if there is a problem sending the notification.
API
new SMSNotifier(options: SMSNotificationOptions)
Creates a new instance of the SMSNotifier class.
- options - An object with the following properties:
- authToken - The authorization token for the API.
- apiUrl - The URL of the API endpoint.
- async sendSMSNotification(msg: string, phone: string): Promise Sends an SMS notification via an HTTP API.
- msg - The content of the SMS notification.
- phone - The phone number to send the notification to.
Returns a Promise that resolves when the SMS notification has been sent, or rejects with an error if there is a problem sending the notification.
License
This package is licensed under the MIT License.