-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathText automations using Apple Shortcuts.json
More file actions
504 lines (504 loc) · 9.87 KB
/
Copy pathText automations using Apple Shortcuts.json
File metadata and controls
504 lines (504 loc) · 9.87 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
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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
{
"meta": {
"instanceId": "f4f5d195bb2162a0972f737368404b18be694648d365d6c6771d7b4909d28167"
},
"nodes": [
{
"id": "b165115d-5505-4e03-bf41-c21320cb8b09",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
40
],
"parameters": {
"color": 7,
"width": 681.8337349708484,
"height": 843.1482165886073,
"content": "## Workflow: Text automations using Apple Shortcuts\n\n**Overview**\n- This workflow answers user requests sent via Apple Shortcuts\n- Several Shortcuts call the same webhook, with a query and a type of query\n- Types of query are:\n - translate to english\n - translate to spanish\n - correct grammar (without changing the actual content)\n - make content shorter\n - make content longer\n\n\n**How it works**\n- Select a text you are writing\n- Launch the shortcut\n- The text is sent to the webhook\n- Depending on the type of request, a different prompt is used\n- Each request is sent to an OpenAI node\n- The workflow responds to the request with the response from GPT\n- Shortcut replace the selected text with the new one\n\n**How to use it**\n- Activate the workflow\n- Download [this Shortcut template](https://drive.usercontent.google.com/u/0/uc?id=16zs5iJX7KeX_4e0SoV49_KfbU7-EF0NE&export=download)\n- Install the shortcut\n- In step 2 of the shortcut, change the url of the Webhook\n- In Shortcut details, \"add Keyboard Shortcut\" with the key you want to use to launch the shortcut\n- Go to settings, advanced, check \"Allow running scripts\"\n- You are ready to use the shortcut. Select a text and hit the keyboard shortcut you just defined\n\n\n**Notes**\n- If you use rich formatting, you'll have to test multiple ways to replace characters in the output. For example, you might use `{{ $json.message.content.output.replaceAll('\\n', \"<br/>\") }}` in the \"Respond to Shortcut\" node depending on the app you use most.\n- This is a basic example that you can extend and modify at your will\n- You can duplicate and modify the example shortcut based on your need, as well as making new automations in this workflow."
},
"typeVersion": 1
},
{
"id": "c45400b8-d3b8-47f7-81c6-d791bce4c266",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
1020,
380
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "spanish",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.body.type }}",
"rightValue": "spanish"
}
]
},
"renameOutput": true
},
{
"outputKey": "english",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "bedb302f-646c-4dcd-8246-1fcfecfe3f2e",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.body.type }}",
"rightValue": "english"
}
]
},
"renameOutput": true
},
{
"outputKey": "grammar",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "94e6cf7d-576d-4ad9-85b0-c6b945eb41b7",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.body.type }}",
"rightValue": "grammar"
}
]
},
"renameOutput": true
},
{
"outputKey": "shorter",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1ed0d1e1-2df0-4f8d-b102-4004a25919ed",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.body.type }}",
"rightValue": "shorter"
}
]
},
"renameOutput": true
},
{
"outputKey": "longer",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4756df03-7e7c-4e28-9b37-14684326b083",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.body.type }}",
"rightValue": "longer"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "48e0e58e-6293-4e11-a488-ca9943b53484",
"name": "Respond to Shortcut",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1840,
400
],
"parameters": {
"options": {},
"respondWith": "text",
"responseBody": "={{ $json.message.content.output.replaceAll('\\n', '<br/>') }}"
},
"typeVersion": 1.1
},
{
"id": "2655b782-9538-416c-ae65-35f8c77889c7",
"name": "Webhook from Shortcut",
"type": "n8n-nodes-base.webhook",
"position": [
840,
400
],
"webhookId": "e4ddadd2-a127-4690-98ca-e9ee75c1bdd6",
"parameters": {
"path": "shortcut-global-as",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "880ed4a2-0756-4943-a51f-368678e22273",
"name": "OpenAI - Make Shorter",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1300,
540
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "Summarize this content a little bit (5% shorter)\nOutput a JSON with a single field: output"
},
{
"content": "={{ $json.body.content }}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "WqzqjezKh8VtxdqA",
"name": "OpenAi account - Baptiste"
}
},
"typeVersion": 1.4
},
{
"id": "c6c6d988-7aab-4677-af1f-880d05691ec3",
"name": "OpenAI - Make Longer",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1300,
680
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "Make this content a little longer (5% longer)\nOutput a JSON with a single field: output"
},
{
"content": "={{ $json.body.content }}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "WqzqjezKh8VtxdqA",
"name": "OpenAi account - Baptiste"
}
},
"typeVersion": 1.4
},
{
"id": "8e6de4b7-22c3-45c9-a8d7-d498cf829b6f",
"name": "OpenAI - Correct Grammar",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1300,
400
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "Correct grammar only, don't change the actual contents.\nOutput a JSON with a single field: output"
},
{
"content": "={{ $json.body.content }}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "WqzqjezKh8VtxdqA",
"name": "OpenAi account - Baptiste"
}
},
"typeVersion": 1.4
},
{
"id": "bc006b36-5a96-4c3a-9a28-2778a6c49f10",
"name": "OpenAI - To Spanish",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1300,
120
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "Translate this message to Spanish.\nOutput a JSON with a single field: output"
},
{
"content": "={{ $json.body.content }}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "WqzqjezKh8VtxdqA",
"name": "OpenAi account - Baptiste"
}
},
"typeVersion": 1.4
},
{
"id": "330d2e40-1e52-4517-94e0-ce96226697fa",
"name": "OpenAI - To English",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1300,
260
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini",
"cachedResultName": "GPT-4O-MINI"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "Translate this message to English.\nOutput a JSON with a single field: output"
},
{
"content": "={{ $json.body.content }}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "WqzqjezKh8VtxdqA",
"name": "OpenAi account - Baptiste"
}
},
"typeVersion": 1.4
},
{
"id": "925e4b55-ac26-4c16-941f-66d17b6794ab",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
900
],
"parameters": {
"color": 7,
"width": 469.15174499329123,
"height": 341.88919758842485,
"content": "### Check these explanations [< 3 min]\n\n[](https://www.loom.com/share/c5b657568af64bb1b50fa8e8a91c45d1?sid=a406be73-55eb-4754-9f51-9ddf49b22d69)"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Switch": {
"main": [
[
{
"node": "OpenAI - To Spanish",
"type": "main",
"index": 0
}
],
[
{
"node": "OpenAI - To English",
"type": "main",
"index": 0
}
],
[
{
"node": "OpenAI - Correct Grammar",
"type": "main",
"index": 0
}
],
[
{
"node": "OpenAI - Make Shorter",
"type": "main",
"index": 0
}
],
[
{
"node": "OpenAI - Make Longer",
"type": "main",
"index": 0
}
]
]
},
"OpenAI - To English": {
"main": [
[
{
"node": "Respond to Shortcut",
"type": "main",
"index": 0
}
]
]
},
"OpenAI - To Spanish": {
"main": [
[
{
"node": "Respond to Shortcut",
"type": "main",
"index": 0
}
]
]
},
"OpenAI - Make Longer": {
"main": [
[
{
"node": "Respond to Shortcut",
"type": "main",
"index": 0
}
]
]
},
"OpenAI - Make Shorter": {
"main": [
[
{
"node": "Respond to Shortcut",
"type": "main",
"index": 0
}
]
]
},
"Webhook from Shortcut": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"OpenAI - Correct Grammar": {
"main": [
[
{
"node": "Respond to Shortcut",
"type": "main",
"index": 0
}
]
]
}
}
}