-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.js
More file actions
37 lines (32 loc) · 993 Bytes
/
demo.js
File metadata and controls
37 lines (32 loc) · 993 Bytes
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
const ringcentral = require('./ringcentral')
var rc = new ringcentral.RingCentral()
function get_account_extension(){
var endpoint = "/restapi/v1.0/account/~/extension";
params = {'status':'Enabled'}
rc.get(endpoint, params, function(err, response){
if (err)
console.log(err)
else {
var jsonObj = JSON.parse(response)
console.log(jsonObj)
}
})
}
function send_sms(recipientNumber, message){
var endpoint = "/restapi/v1.0/account/~/extension/~/sms";
var params = {
'from': { 'phoneNumber' : process.env.RC_USERNAME },
'to' :[{ 'phoneNumber': recipientNumber }],
'text': message
}
rc.post(endpoint, params, function(err, response){
if (err){
console.log(err)
}else {
var jsonObj = JSON.parse(response)
console.log(jsonObj)
}
})
}
get_account_extension()
send_sms('recipientNumber', "Hello World!")