mta-api
v2.0.2
Published
A Node.js wrapper for the Mobile Text Alerts (MTA) v.3 API.
Downloads
2
Readme
MTA API
A Node.js wrapper for the Mobile Text Alerts (MTA) v.3 API.
Installation
$ npm install mta-api --save
Load Module
TypeScript
import { MTAApi } from 'mta-api';
JavaScript
const { MTAApi } = require('mta-api');
const mta = new MTAApi("your-api-key");
let recipientPhone = '1-222-222-2222';
try {
recipientPhone = MTAApi.formatPhoneNumber(recipientPhone);
} catch (e) {
console.error(e.message);
process.exit(130);
}
const requestData = {
subscribers: [recipientPhone],
message: "Hello World!"
}
mta.Send.sendSMS(requestData).then((response) => {
console.log(response);
process.exit(0);
}).catch((e) => {
console.error(e.message);
process.exit(130);
});