-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathTweet-Speaker.json
377 lines (377 loc) · 9.77 KB
/
Tweet-Speaker.json
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
[
{
"id": "aa9b7a75.52a7d8",
"type": "tab",
"label": "Tweet Speaker",
"disabled": false,
"info": ""
},
{
"id": "2466d365.23821c",
"type": "debug",
"z": "aa9b7a75.52a7d8",
"name": "Positive Tweet debug",
"active": true,
"console": "false",
"complete": "payload",
"x": 920,
"y": 280,
"wires": []
},
{
"id": "8613bdd3.0151e8",
"type": "switch",
"z": "aa9b7a75.52a7d8",
"name": "Positive / Negative Tweets",
"property": "sentiment.score",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "2",
"vt": "num"
},
{
"t": "lt",
"v": "0",
"vt": "str"
}
],
"checkall": "true",
"outputs": 2,
"x": 610,
"y": 340,
"wires": [
[
"2466d365.23821c"
],
[
"390ec360.35f6c4"
]
]
},
{
"id": "9f72401e.fba538",
"type": "debug",
"z": "aa9b7a75.52a7d8",
"name": "msg.sentiment.score",
"active": true,
"console": "false",
"complete": "sentiment.score",
"x": 600,
"y": 300,
"wires": []
},
{
"id": "ef331f60.674a",
"type": "twitter out",
"z": "aa9b7a75.52a7d8",
"twitter": "",
"name": "Retweet positive tweets",
"x": 920,
"y": 320,
"wires": []
},
{
"id": "452b85b.b1d367c",
"type": "twitter in",
"z": "aa9b7a75.52a7d8",
"twitter": "",
"tags": "",
"user": "false",
"name": "Listen to twitter feed",
"topic": "tweets",
"inputs": 1,
"x": 110,
"y": 100,
"wires": [
[
"5f2d24b1.c624ac",
"c51dc962.920cc",
"6a3ee9d5.250498"
]
]
},
{
"id": "5f2d24b1.c624ac",
"type": "debug",
"z": "aa9b7a75.52a7d8",
"name": "msg.tweet details",
"active": false,
"console": "false",
"complete": "tweet",
"x": 490,
"y": 60,
"wires": []
},
{
"id": "31619966.de6186",
"type": "sentiment",
"z": "aa9b7a75.52a7d8",
"name": "Sentiment of Tweets",
"x": 350,
"y": 340,
"wires": [
[
"9f72401e.fba538",
"8613bdd3.0151e8",
"df897d95.373c28"
]
]
},
{
"id": "390ec360.35f6c4",
"type": "debug",
"z": "aa9b7a75.52a7d8",
"name": "Negative Tweets",
"active": false,
"console": "false",
"complete": "payload",
"x": 900,
"y": 400,
"wires": []
},
{
"id": "c51dc962.920cc",
"type": "function",
"z": "aa9b7a75.52a7d8",
"name": "Remove URLS and replace #",
"func": "var tweet = msg.tweet.text;\nvar newtweet = tweet.replace(/#/g, \" Hash tag \");\n\n// regex from https://stackoverflow.com/questions/1500260/detect-urls-in-text-with-javascript\nmsg.payload = newtweet.replace( /(([a-z]+:\\/\\/)?(([a-z0-9\\-]+\\.)+([a-z]{2}|biz|com|co|edu|gov|info|net|org|ly))(:[0-9]{1,5})?(\\/[a-z0-9_\\-\\.~]+)*(\\/([a-z0-9_\\-\\.]*)(\\?[a-z0-9+_\\-\\.%=&]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(\\s+|$)/gi, \"see short URL \" );\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 520,
"y": 140,
"wires": [
[
"5dc2bed3.fa8a3",
"31619966.de6186"
]
]
},
{
"id": "5dc2bed3.fa8a3",
"type": "debug",
"z": "aa9b7a75.52a7d8",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 790,
"y": 140,
"wires": []
},
{
"id": "6a3ee9d5.250498",
"type": "debug",
"z": "aa9b7a75.52a7d8",
"name": "",
"active": true,
"console": "false",
"complete": "tweet.text",
"x": 480,
"y": 100,
"wires": []
},
{
"id": "1e895bf.08daa24",
"type": "watson-text-to-speech",
"z": "aa9b7a75.52a7d8",
"name": "",
"lang": "en-US",
"langhidden": "en-US",
"langcustom": "NoCustomisationSetting",
"langcustomhidden": "",
"voice": "en-US_MichaelVoice",
"voicehidden": "en-US_MichaelVoice",
"format": "audio/wav",
"password": "",
"payload-response": true,
"default-endpoint": true,
"service-endpoint": "",
"x": 550,
"y": 520,
"wires": [
[
"8e54d7fb.025948"
]
]
},
{
"id": "66f4e79d.91c9b",
"type": "comment",
"z": "aa9b7a75.52a7d8",
"name": "node-red-node-watson dependency",
"info": "This flow requires the\n node-red-node-watson@0.5.10 or higher\nfor the following Watson nodes:\n Text to Speech\n Speech to Text\n Tone Analyzer\n Visual Recognition\n\nYou can either \n $ sudo npm -g install node-red-node-watson\n and restart the Node-RED service\nor install it from Node-RED Manage Palette.",
"x": 510,
"y": 560,
"wires": []
},
{
"id": "443db3e7.713694",
"type": "comment",
"z": "aa9b7a75.52a7d8",
"name": "node-red-contrib-play-audio dependency",
"info": "This flow requires the\n node-red-contrib-play-audio\nfor the Browser play audio node.\nYou can either \n $ sudo npm -g install node-red-contrib-play-audio\n and restart the Node-RED service\nor install it from Node-RED Manage Palette.",
"x": 820,
"y": 560,
"wires": []
},
{
"id": "8e54d7fb.025948",
"type": "play audio",
"z": "aa9b7a75.52a7d8",
"name": "",
"voice": "",
"x": 730,
"y": 520,
"wires": []
},
{
"id": "df897d95.373c28",
"type": "delay",
"z": "aa9b7a75.52a7d8",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "10",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 340,
"y": 520,
"wires": [
[
"1e895bf.08daa24"
]
]
},
{
"id": "5e3e291a.0715b8",
"type": "comment",
"z": "aa9b7a75.52a7d8",
"name": "Paste API keys for Watson Text to Speech",
"info": "1. Log into IBM Cloud\n2. Create an instance of the \nWatson Text to Speech service.\n3. Visit the Service Credentials tab\n4. Click on View Credentials\n5. Copy/Paste the password and username into\nthis Node-RED node.\n\nOr\n1. Open this Cloud Foundry Node-RED Starter App\n2. Create a new Connection\n3. Bind the Watson Text to Speech service\n4. Restage your Cloud Foundry application",
"x": 560,
"y": 480,
"wires": []
},
{
"id": "48ebedb2.4c8644",
"type": "twilio out",
"z": "aa9b7a75.52a7d8",
"service": "_ext_",
"twilio": "4d760601.32ea58",
"from": "",
"number": "",
"name": "SMS to Phone",
"x": 900,
"y": 360,
"wires": []
},
{
"id": "5fbf9ac1.6aded4",
"type": "inject",
"z": "aa9b7a75.52a7d8",
"name": "Happy test",
"topic": "",
"payload": "{\"text\":\"every one is awesome\"}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"x": 100,
"y": 200,
"wires": [
[
"d6a8db.b0ea8728"
]
]
},
{
"id": "d6a8db.b0ea8728",
"type": "change",
"z": "aa9b7a75.52a7d8",
"name": "",
"rules": [
{
"t": "set",
"p": "tweet",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 300,
"y": 240,
"wires": [
[
"c51dc962.920cc"
]
]
},
{
"id": "3f4bce94.9100fa",
"type": "inject",
"z": "aa9b7a75.52a7d8",
"name": "Sadness test",
"topic": "",
"payload": "{\"text\":\"This is miserable and sad\"}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"x": 110,
"y": 240,
"wires": [
[
"d6a8db.b0ea8728"
]
]
},
{
"id": "52374841.fbf998",
"type": "inject",
"z": "aa9b7a75.52a7d8",
"name": "Angry test",
"topic": "",
"payload": "{\"text\":\"I hate this demo\"}",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"x": 100,
"y": 280,
"wires": [
[
"d6a8db.b0ea8728"
]
]
},
{
"id": "99f9634f.b98c28",
"type": "comment",
"z": "aa9b7a75.52a7d8",
"name": "Pick a #hashtag to follow",
"info": "",
"x": 120,
"y": 60,
"wires": []
},
{
"id": "4d760601.32ea58",
"type": "twilio-api",
"z": "aa9b7a75.52a7d8",
"sid": "",
"from": "",
"name": "My Twilio"
}
]