-
Notifications
You must be signed in to change notification settings - Fork 2
/
getConObject.js
40 lines (38 loc) · 1.17 KB
/
getConObject.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
var dropdown_obj = {
"attachments": [
{
"text": "Scheduled time was not available. Here are some alternatives!",
"fallback": "WHAT IS A FALLBACK BRO?",
"color": "#3AA3E3",
"attachment_type": "default",
"callback_id": "alt_date_selection",
"actions": [
{
"name": "alt_dates",
"text": "Pick an alternate date and time...",
"type": "select",
"options": []
},
{
"name": "confirm",
"text": "Cancel",
"type": "button",
"value": "cancel"
}
]
}
]
}
var getConObject = function(array){
console.log("getConObject gets this array", array);
var tempObj = Object.assign({}, dropdown_obj);
tempObj.attachments[0].actions[0].options = [];
for(var i = 0 ;i < array.length; i++ ){
tempObj.attachments[0].actions[0].options.push({"text":array[i], "value":array[i]})
}
console.log('TEMPOBJ HERE ==>>> ', tempObj.attachments[0].actions[0].options);
return tempObj;
}
module.exports = {
getConObject
}