-
Notifications
You must be signed in to change notification settings - Fork 6
/
get_meeting.js
114 lines (104 loc) · 3.42 KB
/
get_meeting.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
* _
* __ _____| |__ _____ __
* \ \ /\ / / _ \ '_ \ / _ \ \/ /
* \ V V / __/ |_) | __/> < @WebexDevs
* \_/\_/ \___|_.__/ \___/_/\_\
*
* READ (get) meeting in Webex with the REST API in Node
* https://developer.webex.com/docs/api/v1/meetings/get-a-meeting
*
* Step 0: Have a (free) Webex account: https://cart.webex.com/sign-up
* Step 1: Log in to https://developer.webex.com/login
* Step 2: Find your bearer token at
* https://developer.webex.com/docs/getting-started under "Your
* Personal Access Token" in the middle of the page.
* Step 3: Replace the string on the line that defines const myWebexDeveloperToken,
* just below, with your personal bearer (access) token. Hit "save".
* Step 4: Run the sample at https://github.com/Aaron-TheCreator/rest-api-samples/tree/main/meetings/create.
* Copy the meeting ID from the "id" property in the response object.
* Replace the string on the line that defines const meetingID,
* just below, with your copied meetingID value. Hit "save".
* Step 5: Run this file with node (https://nodejs.org/en/download/)
* from within this directory on the command line:
*
* node ./get_meeting.js
*
* Step 6: Profit. Get your app listed in the Webex App Hub!
* https://apphub.webex.com/
*
*/
const https = require('https'); // https://nodejs.org/api/https.html
// You can set your WEBEXTOKEN env to your 12-hour token, OR...
const myWebexDeveloperToken = (typeof process.env.WEBEXTOKEN !=='undefined' )
? process.env.WEBEXTOKEN // Sets the token from your system's ENV if you've done that, OR...
: 'REPLACE ME WITH YOUR WEBEX DEVELOPER PERSONAL ACCESS TOKEN'; // ...replace this text with your 12-hour token
const meetingID = 'REPLACE WITH MEETING ID';
const options = {
method: 'GET',
hostname: 'webexapis.com',
path: `/v1/meetings/${meetingID}`, // Make sure you set your meetingID above !
port: 443,
headers: {
Authorization: `Bearer ${myWebexDeveloperToken}`, // Make sure you set your token above!
},
};
const req = https.request(options, (res) => {
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(`This meeting's information includes the following: ${data}`);
});
res.on('error', (e) => {
console.error(`Error: ${e.message}`);
});
});
req.end();
/**
* Expected output:
*
* The HTTPS request should receive a status code. We expect a 200.
*
* The body of the response is JSON text. We expect a single object
* containing details of the meeting with "id" property matching value passed in.
* These details should include at least the following fields:
*
* - id
* - meetingNumber
* - title
* - password
* - phoneAndVideoSystemPassword
* - meetingType
* - state
* - timezone
* - start
* - end
* - hostUserId
* - hostDisplayName
* - hostEmail
* - hostKey
* - siteUrl
* - webLink
* - sipAddress
* - dialInIpAddress
* - enabledAutoRecordMeeting
* - allowAnyUserToBeCoHost
* - allowFirstUserToBeCoHost
* - allowAuthenticatedDevices
* - enabledJoinBeforeHost
* - joinBeforeHostMinutes
* - enableConnectAudioBeforeHost
* - excludePassword
* - publicMeeting
* - enableAutomaticLock
* - telephony
* - accessCode
* - callInNumbers
* - links
*
* An example of the response JSON may be found
* in this directory: ./get_example_response.json
*
*/