-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemp.js
251 lines (224 loc) · 8.95 KB
/
temp.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
//let promises = [];
//-------------------
// promises.push(
// recipients.push(doSomethingAsync(inviteEmails[i], recipients))
// )
//------------------
// Promise.all(promises)
// .then((results) => {
// //console.log("All done", results);
// console.log("All done", recipients);
// resolve(recipients);
// })
// .catch((e) => {
// // Handle errors here
// });
//---------------------------------------------------------------------------------------------
// var graphapi2 = request.defaults({
// baseUrl: 'https://www.facebook.com',
// json: true,
// auth: {
// 'bearer' : PAGE_ACCESS_TOKEN
// }
// });
//---------------------------------------------------------------------------------------------
// FB.api('/', 'POST', {
// include_headers: false,
// batch: [
// { method: 'GET', relative_url: '[email protected]?fields=id,email,name,primary_phone,department'},
// { method: "GET", relative_url: "[email protected]?fields=id,email,name,primary_phone,department" }
// ]
// }, function (response) {
// var obj = JSON.parse(response[1].body);
// console.log("itzik123455===" + obj.email);
// console.log("itzik123455===" + JSON.stringify(obj));
// console.log("itzik123455===" + response[1].body);
// });
//---------------------------------------------------------------------------------------------
//Post into a group: itzik gmail 100022693691284, itzik avaya - 100022742164286
//graphapi({
// method: 'POST',
// url: '/395404170913985/feed?message=This+**@[100022742164286]**+@[100022693691284]+is+a+**formatted**+*post*&formatting=MARKDOWN',
//},function(error,response,body) {
// if(error) {
// console.error(error);
// } else {
// console.log('Published post: ' + body.id);
// }
//});
//---------------------------------------------------------------------------------------------
//graphapi({
// method: 'POST',
// url: '/395404170913985/feed',
// qs: {
// 'message': 'Itzik111',
// 'link': 'https:www.walla.co.il'
// }
//},function(error,response,body) {
// if(error) {
// console.error(error);
// } else {
// var post_id = JSON.stringify(body).id;
// console.log('Published itzik111: ' + post_id);
// }
//});
//---------------------------------------------------------------------------------------------
// function doSomethingAsync(inviteEmail) {
// return new Promise((resolve, reject) => {
// graphapi({
// method: 'POST',
// url: '/',
// batch: [
// { method: 'GET', relative_url: '[email protected]?fields=id,email,name,primary_phone,department'},
// { method: "GET",relative_url: "[email protected]?fields=id,email,name,primary_phone,department" }
// ]
// //url: '/[email protected],[email protected]?fields=id,email,name,primary_phone,department',
// //url: '/' + inviteEmail + '?fields=id,email,name,primary_phone,department',
// },function(error,response,body) {
// console.log("body.id1117-" + JSON.stringify(response));
// console.log("body.id1117-" + JSON.stringify(body));
// if(error) {
// console.error(error);
// reject(error);
// } else {
// console.log("body.id1117-" + JSON.stringify(response));
// console.log("body.id1117-" + JSON.stringify(body));
// if (body && body.id) {
// console.log("body.id1116-" + body.id);
// //recipients.push({"id": body.id });
// //if (i === inviteEmails.length) {
// console.log("resolve");
// resolve({"id": body.id });
// //}
// }
// }
// })
// });
// }
//---------------------------------------------------------------------------------------------
////events:
// var eventData = {
// "id" : 374369296368380,
// "start_time" : Math.round(new Date().getTime()/1000.0), //'2011-04-01T14:00:00+0000',
// "end_time": Math.round(new Date().getTime()/1000.0)+100, //'2011-05-01T14:00:00+0000',
// "location" : 'location',
// "name" : 'This is a new event',
// "description":'This is a new event222',
// "privacy":"OPEN"
// }
// var eventData2 = {"description":"Test Event Description","name":"Test Event","place":{"name":"Tel Aviv, Israel","location":{"city":"Tel Aviv","country":"Israel","latitude":32.0667,"longitude":34.7667},"id":"106371992735156"},"start_time":"2018-01-21T15:00:00+0200","id":"142175346457096"}
// var eventData3 = {"id" : 583221065350500, "can_guests_invite": true}
// FB.api('https://graph.facebook.com/v2.6/me/events', 'POST', eventData2, function (response) { //395404170913985
// //console.log("events response - " + JSON.stringify(response));
// });
// FB.api('https://graph.facebook.com/v2.6/395404170913985/events','post',{name:"JS-SDK Event",start_time:1272718027,location:"Beirut"},function(resp) {
// //console.log("events response2 - " + JSON.stringify(resp));
// });
// FB.api('https://graph.facebook.com/v2.4/374369296368380/invited?users=100022693691284',eventData , 'post', function (response) { //395404170913985
// //console.log("events response3 - " + JSON.stringify(response));
// });
////--------
// graphapi({
// url: '/activities',
// method: 'POST',
// form: {
// event: 'CUSTOM_APP_EVENTS',
// custom_events: JSON.stringify([{
// _eventName: "fb_mobile_purchase",
// _valueToSum: 55.22,
// _fb_currency: 'USD'
// }]),
// advertiser_tracking_enabled: 0,
// application_tracking_enabled: 0,
// extinfo: JSON.stringify(['mb1']),
// page_id: '395404170913985',
// page_scoped_user_id: '100022693691284'
// }
// }, function(err,httpResponse,body) {
// console.log(err);
// console.log(httpResponse.statusCode);
// console.log(body);
// });
// request.post({
// url : "https://graph.facebook.com/853549721475416/activities",
// form: {
// event: 'CUSTOM_APP_EVENTS',
// custom_events: JSON.stringify([{
// _eventName: "fb_mobile_purchase1123",
// _valueToSum: 55.22,
// _fb_currency: 'USD'
// }]),
// advertiser_tracking_enabled: 0,
// application_tracking_enabled: 0,
// //extinfo: JSON.stringify(['mb1']),
// page_id: '395404170913985',
// page_scoped_user_id: '100022693691284'
// }
// }, function(err,httpResponse,body){
// console.log(err);
// console.log(httpResponse.statusCode);
// console.log(body);
// });
// //-------
//---------------------------------------------------------------------------------------------
////getTextMessageResponse:
// case 'buttons':
// text = 'https://avayaequinoxmeetings.com/scopia/mt/9022?ID=' + VR;
// buttons:[
// {
// "type":"web_url",
// "url":"https://avayaequinoxmeetings.com/scopia/mt/9022?ID=" + VR,
// "title":"Link to guy vr",
// "webview_height_ratio": "full",
// "messenger_extensions": true,
// "fallback_url": "https://petersfancyapparel.com/fallback"
// }
// ]
// break;
// case '_letsa meet':
// text = 'Which virtual room?';
// quick_replies = [
// {
// //"type": "postback",
// "content_type":"text",
// "title":"Itzik",
// //"image_url":"http://example.com/img/red.png",
// "payload":"yes"
// },
// {
// "content_type":"text",
// "title":"Ronny",
// //"image_url":"http://example.com/img/red.png",
// "payload":"<lets meet ronny room>"
// },
// {
// "content_type":"text",
// "title":"Anna",
// //"image_url":"http://example.com/img/red.png",
// "payload":"<lets meet anna room>"
// }
// ]
// break;
// case 'location':
// text = "location";
// quick_replies = [
// {
// "content_type":"location"
// }
// ];
// break;
//default:
// text = `You sent the message: "${received_message.text}".`;
//}
// if(received_message.includes("meet") || received_message.includes("discuss") || received_message.includes("brainstorm") || received_message.includes("meeting")){
// text = 'May I suggest you enter your virtual room: https://alphaconfportal.avaya.com:8443/portal/tenants/default/?ID=' + VR;
// }
//if (received_message.text === 'lets meet') {
// text = 'https://rnd-10-134-86-27.holonlab.avaya.com:8443/portal/tenants/default/?ID=661236';
//}
//else {
// text = 'You sent the message: "${received_message.text}". Now send me an image111!';
//}
//console.log("text556 - " + text);
// Create the payload for a basic text message
//---------------------------------------------------------------------------------------------