UNPKG

notification-services

Version:

use email, sms and custom notification services for node.js application easily

22 lines (21 loc) 856 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.fast2smsSend = void 0; const axios_1 = __importDefault(require("axios")); const fast2smsSend = (options, callback) => { const { senderId, message, fast2smsRoute, to, apiKey } = options; axios_1.default.post('https://www.fast2sms.com/dev/bulkV2', { sender_id: senderId, message: message, route: fast2smsRoute, numbers: to }, { headers: { 'Content-type': 'application/x-www-form-urlencoded', 'authorization': `${apiKey}` } }).then(response => { callback(response, null); }).catch(error => { callback(null, error); }); }; exports.fast2smsSend = fast2smsSend;