Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GlobUtil.prototype.sendSms = (number, msg, callback) => {
- let options = {
- url: format(process.env.APPSMS, number),
- ca: fs.readFileSync(process.env.SMS_CERT_PATH),
- body: msg
- };
- request.post(options, function(error, response, body) {
- if (error) {
- log.error("Error calling sendSms: " + options.url);
- log.error("===== Error =====");
- log.error(error);
- return callback(error);
- }
- if (response.statusCode === 200) {
- return callback(null, true);
- } else {
- result = JSON.parse(body)
- return callback(new Error(result));
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement