Repository navigation
Expand file tree
/
Copy pathFailure Alert.json
More file actions
74 lines (74 loc) · 1.9 KB
/
Copy pathFailure Alert.json
File metadata and controls
74 lines (74 loc) · 1.9 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
{
"name": "SUPPORT Failure Alert",
"nodes": [
{
"id": "on-error",
"name": "Workflow failed",
"type": "n8n-nodes-base.errorTrigger",
"typeVersion": 1,
"position": [
0,
0
],
"parameters": {}
},
{
"id": "record-error",
"name": "Record failure",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
200,
0
],
"parameters": {
"jsCode": "const event = $input.first().json;\nconst failure = {timestamp: new Date().toISOString(), result: 'failed', workflow: event.workflow?.name || '',\n runId: String(event.execution?.id || ''), node: event.execution?.lastNodeExecuted || '',\n message: String(event.execution?.error?.message || event.trigger?.error?.message || 'Unknown error')};\nconsole.error(JSON.stringify(failure));\nreturn [{json: failure}];"
}
},
{
"id": "email-operator",
"name": "Email operator",
"type": "n8n-nodes-base.gmail",
"typeVersion": 2,
"position": [
400,
0
],
"parameters": {
"sendTo": "={{ $env.SUPPORT_ALERT_EMAIL_TO }}",
"subject": "=Workflow failed: {{ $json.workflow }} / {{ $json.runId }}",
"message": "=Run: {{ $json.runId }}\nWorkflow: {{ $json.workflow }}\nNode: {{ $json.node }}\nError: {{ $json.message }}\nTime: {{ $json.timestamp }}",
"options": {}
}
}
],
"connections": {
"Workflow failed": {
"main": [
[
{
"node": "Record failure",
"type": "main",
"index": 0
}
]
]
},
"Record failure": {
"main": [
[
{
"node": "Email operator",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"timezone": "Asia/Manila"
}
}