-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathzengram-logger.json
More file actions
95 lines (95 loc) · 3.44 KB
/
zengram-logger.json
File metadata and controls
95 lines (95 loc) · 3.44 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
[{
"id": "BrainLog0000000001",
"name": "Shared Brain Logger",
"nodes": [
{
"parameters": {},
"id": "node-error-trigger",
"name": "Error Trigger",
"type": "n8n-nodes-base.errorTrigger",
"typeVersion": 1,
"position": [200, 200]
},
{
"parameters": {
"mode": "runOnceForAllItems",
"jsCode": "const errorData = $input.all();\nconst err = errorData[0]?.json || {};\n\n// Error Trigger provides: execution.id, workflow.id, workflow.name, error.message\nconst execution = err.execution || {};\nconst workflow = err.workflow || {};\nconst error = err.error || {};\n\nreturn [{\n json: {\n workflow_name: workflow.name || 'unknown',\n workflow_id: workflow.id || null,\n execution_id: execution.id || null,\n status: 'error',\n message: `Workflow failed: ${workflow.name || 'unknown'}`,\n error_message: error.message || JSON.stringify(error).slice(0, 500),\n client_id: null,\n items_processed: null\n }\n}];"
},
"id": "node-format-error",
"name": "Format Error",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [440, 200]
},
{
"parameters": {},
"id": "node-exec-trigger",
"name": "Success Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1,
"position": [200, 460]
},
{
"parameters": {
"mode": "runOnceForAllItems",
"jsCode": "// Called by other workflows via Execute Workflow node\n// Expected input: workflow_name, status, message, client_id, items_processed\nconst data = $input.all();\nconst input = data[0]?.json || {};\n\nreturn [{\n json: {\n workflow_name: input.workflow_name || 'unknown',\n workflow_id: input.workflow_id || null,\n execution_id: input.execution_id || null,\n status: input.status || 'success',\n message: input.message || `${input.workflow_name || 'Workflow'} completed successfully`,\n client_id: input.client_id || null,\n items_processed: input.items_processed || null,\n error_message: null\n }\n}];"
},
"id": "node-format-success",
"name": "Format Success",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [440, 460]
},
{
"parameters": {
"method": "POST",
"url": "http://localhost:8084/webhook/n8n",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "X-Api-Key",
"value": "YOUR_BRAIN_API_KEY"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify($json) }}",
"options": {
"timeout": 10000
}
},
"id": "node-post-brain",
"name": "POST to Shared Brain",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [700, 330]
}
],
"connections": {
"Error Trigger": {
"main": [
[{ "node": "Format Error", "type": "main", "index": 0 }]
]
},
"Format Error": {
"main": [
[{ "node": "POST to Shared Brain", "type": "main", "index": 0 }]
]
},
"Success Trigger": {
"main": [
[{ "node": "Format Success", "type": "main", "index": 0 }]
]
},
"Format Success": {
"main": [
[{ "node": "POST to Shared Brain", "type": "main", "index": 0 }]
]
}
},
"settings": {
"executionOrder": "v1"
}
}]