A class for sending SMS notifications via an HTTP API.
npm install muthofun-sms-api
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.
- 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.
This package is licensed under the MIT License.