-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathzoom.js
60 lines (54 loc) · 1.65 KB
/
zoom.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const config = require('./config/config');
const agenda=require("./agenda");
const User = require("./models/UserSchema");
var rp = require('request-promise');
const twilo = require('./twilo');
const sendmail = require('./sendMail');
function test()
{
console.log("Test");
}
async function StartZoomMeeting(topicname,date) {
const email=User.find({
email:"" // User email
},(err,teams) => {
console.log(err);
});
console.log(email);
const options = {
method: "POST",
uri: "https://api.zoom.us/v2/users/" + "harishsg99@gmail.com"+ "/meetings",
body: {
topic: topicname,
start_time: date,
type: 1,
settings: {
host_video: "true",
participant_video: "true",
approval_type: 0
}
},
auth: {
bearer:"" //Auth JWT token
},
headers: {
"User-Agent": "Zoom-api-Jwt-Request",
"content-type": "application/json"
},
json: true //Parse the JSON string in the response
};
try {
const response = await rp(options);
var result = JSON.stringify(response);
result = JSON.parse(result);
console.log(result.start_url);
console.log(date);
agenda.scheduleMsg(result.start_url,date);
twilo.send(result.start_url);
sendmail.sendEmail(result.start_url);
// To schedule msg send
} catch (error) {
console.log("API call failed, reason ", error);
}
}
module.exports.StartZoomMeeting=StartZoomMeeting;