-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIVR_Configure.js
More file actions
50 lines (45 loc) · 1.18 KB
/
Copy pathIVR_Configure.js
File metadata and controls
50 lines (45 loc) · 1.18 KB
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
// # API Access token
var access_token = "ENTER_ACCESS_TOKEN";
// # Sonetel account ID
var acc_id = "ENTER_ACCOUNT_ID";
// # Voice app ID
app_id = "ENTER_APP_ID";
var json_data = {
"app_type": "ivr",
"play_menu": "yes",
"name": "ENTER_IVR_NAME",
"voice": "en",
"play_welcome": "yes",
"get_extension": "yes",
"menu": {
"digit_1": {
"action": "call",
"to": "phnum",
"id": "ENTER_PHONE_NUMBER"
},
"digit_2": {
"action": "call",
"to": "user",
"id": "ENTER_USER_ID"
},
"digit_3": {
"action": "connect",
"to": "app",
"id": "ENTER_APP_ID"
}
}
};
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://public-api.sonetel.com/account/'+acc_id+'/voiceapp/'+app_id,
'headers': {
'Authorization': 'Bearer '+access_token,
'Content-Type': 'application/json;charset=UTF-8'
},
body: JSON.stringify(json_data)
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});