-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathn8n_workflow.json
198 lines (198 loc) · 6.01 KB
/
n8n_workflow.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
{
"meta": {
"instanceId": "3035cdcb06feb14aef4fd4b75c11dfecfcc92e8eb8fd54d101ea2947bbac0777"
},
"nodes": [
{
"parameters": {
"resource": "file",
"operation": "edit",
"owner": "danielraffel",
"repository": "ggb",
"filePath": "ggb.screenshot.png",
"binaryData": true,
"commitMessage": "Update Golden Gate Bridge screenshot"
},
"name": "GitHub Create3",
"type": "n8n-nodes-base.github",
"typeVersion": 1,
"position": [
1060,
660
],
"id": "33ac1f7f-060f-4c59-9f61-c4bf728000f7",
"credentials": {
"githubApi": {
"id": "cDLjyjB6L048du3h",
"name": "GitHub account"
}
}
},
{
"parameters": {
"functionCode": "// Log the incoming data\nconsole.log(JSON.stringify(items, null, 2));\n\n// Check if binary data exists\nif (items[0].binary && items[0].binary.data) {\n console.log('Binary data exists');\n return items;\n} else {\n console.log('No binary data found');\n throw new Error('No binary data found in the input');\n}"
},
"name": "Debug Function3",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
860,
660
],
"id": "41379e3b-1437-483c-ad01-e78da51de9dd"
},
{
"parameters": {
"method": "POST",
"url": "http://REDACTED-PLAYWRIGHT-IP-ADDRESS:3000/chrome/screenshot?token=REDACTED-PLAYWRIGHT-TOKEN",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"contentType": "raw",
"rawContentType": "application/json",
"body": "{ \"url\": \"https://www.goldengate.org/bridge/visiting-the-bridge/current-weather/\", \"waitForSelector\": { \"selector\": \"video[aria-label='Camera Video Player']\", \"timeout\": 15000 }, \"options\": { \"type\": \"png\", \"clip\": { \"x\": 345, \"y\": 489, \"width\": 924, \"height\": 693 } }, \"viewport\": { \"width\": 1300, \"height\": 1200 }, \"bestAttempt\": true, \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36\" }",
"options": {}
},
"name": "HTTP Request: Screenshot2",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
680,
660
],
"id": "17bc58e5-54a8-41ee-9e7b-461fe06b2d5c",
"credentials": {
"httpHeaderAuth": {
"id": "sCWycGUnmkY6AdA8",
"name": "Header Auth account"
}
}
},
{
"parameters": {
"jsCode": "// Specify the desired timezone\nconst timeZone = 'America/Los_Angeles';\n\n// Get the current time in the specified timezone\nconst nowInTimeZone = new Date(new Date().toLocaleString('en-US', { timeZone }));\n\n// Extract the current hour\nconst currentHour = nowInTimeZone.getHours();\n\n// Define operational hours (5 AM to 9 PM)\nconst startHour = 5;\nconst endHour = 20;\n\n// Logging for debugging\nconsole.log(`Current timezone: ${timeZone}`);\nconsole.log(`Current time: ${nowInTimeZone.toLocaleString('en-US', { timeZone })}`);\nconsole.log(`Current hour: ${currentHour}`);\nconsole.log(`Start hour: ${startHour}`);\nconsole.log(`End hour: ${endHour}`);\n\nif (currentHour >= startHour && currentHour < endHour) {\n console.log(`Within operational hours (${currentHour}). Proceeding.`);\n return [{ json: { continueExecution: true } }];\n}\n\nconsole.log(`Outside operational hours (${currentHour}). Ending workflow.`);\nreturn [{ json: { continueExecution: false } }];\n"
},
"id": "6cf47823-d631-41d1-a696-a0d262e38788",
"name": "Time Check Code Node",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
140,
580
]
},
{
"parameters": {},
"id": "33d15de5-8a2f-4d23-bfa9-24c53f5a3950",
"name": "End Workflow",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
460,
460
]
},
{
"parameters": {},
"id": "26bb4de0-01ad-4704-a604-e3a2a69a8236",
"name": "Perform Task",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
460,
660
]
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "minutes"
}
]
}
},
"id": "da88bda4-c258-435a-b2b7-3dd38345df9e",
"name": "Schedule Trigger1",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1,
"position": [
-60,
580
]
}
],
"connections": {
"Debug Function3": {
"main": [
[
{
"node": "GitHub Create3",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request: Screenshot2": {
"main": [
[
{
"node": "Debug Function3",
"type": "main",
"index": 0
}
]
]
},
"Time Check Code Node": {
"main": [
[
{
"node": "End Workflow",
"type": "main",
"index": 0
},
{
"node": "Perform Task",
"type": "main",
"index": 0
}
]
]
},
"Perform Task": {
"main": [
[
{
"node": "HTTP Request: Screenshot2",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger1": {
"main": [
[
{
"node": "Time Check Code Node",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {}
}