-
Notifications
You must be signed in to change notification settings - Fork 5.3k
/
Copy pathsms.js
45 lines (30 loc) · 853 Bytes
/
sms.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var request = require("request");
const db = require("../_helpers/db");
const express = require("express");
function SendOtp(mobile) {
const OTP = Math.floor(000000 + Math.random() * 999999);
console.log(OTP)
var options = {
method: "GET",
url: "https://api.authkey.io/request",
qs: {
authkey: "14f46e8842e516f7",
sms: `Use ${OTP} as your OTP to access your {#company#}, OTP is confidential and valid for {#time#}`,
mobile:`${mobile}`,
sender: "AUTHKY",
template: "Authkey otp message"
},
};
console.log(options)
request(options, function (error, response, body) {
if (error) {
console.log("error sms");
console.log(error);
}
console.log(body);
});
//2. save mobilenumber and otp in smslog table
}
module.exports = {
SendOtp,
};