-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAI-Powered “Signal → Action” Decision Engine.json
More file actions
422 lines (422 loc) · 14.7 KB
/
AI-Powered “Signal → Action” Decision Engine.json
File metadata and controls
422 lines (422 loc) · 14.7 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
{
"name": "My workflow 3",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "signal-webhook",
"responseMode": "responseNode",
"options": {}
},
"id": "09263d17-3428-4c93-a916-b55564a1e9ff",
"name": "Signal Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-1024,
288
],
"webhookId": "69c80165-235d-47ee-a86b-6128402aefad"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "id-1",
"name": "source",
"value": "={{ $json.body.source }}",
"type": "string"
},
{
"id": "id-2",
"name": "channel",
"value": "={{ $json.body.channel }}",
"type": "string"
},
{
"id": "id-3",
"name": "content",
"value": "={{ $json.body.content }}",
"type": "string"
},
{
"id": "id-4",
"name": "timestamp",
"value": "={{ $json.body.timestamp }}",
"type": "string"
}
]
},
"options": {}
},
"id": "f1d8fb88-54a3-4423-8d5e-e94460b5d4d7",
"name": "Workflow Configuration",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-800,
288
]
},
{
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"intent\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"The detected intent of the signal\"\n\t\t},\n\t\t\"urgency\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Urgency level: low, medium, high, critical\"\n\t\t},\n\t\t\"sentiment\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Sentiment: positive, neutral, negative\"\n\t\t},\n\t\t\"confidence_score\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"description\": \"Confidence score from 0 to 1\"\n\t\t},\n\t\t\"risk_flags\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"string\"\n\t\t\t},\n\t\t\t\"description\": \"Array of identified risk flags\"\n\t\t},\n\t\t\"recommended_action\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Recommended action: notify_human, create_crm_task, escalate_management, or open_support_ticket\"\n\t\t}\n\t},\n\t\"required\": [\"intent\", \"urgency\", \"sentiment\", \"confidence_score\", \"risk_flags\", \"recommended_action\"]\n}"
},
"id": "d1baaa14-197f-40cb-81f9-9c31ca02c46f",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.3,
"position": [
-440,
512
]
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "id",
"value": "gpt-4o-mini"
},
"builtInTools": {},
"options": {}
},
"id": "93ae1a1b-d8f3-4478-9014-e2cbb069d8d8",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"position": [
-568,
512
]
},
{
"parameters": {
"promptType": "define",
"text": "=Signal Data:\nSource: {{ $json.source }}\nChannel: {{ $json.channel }}\nContent: {{ $json.content }}\nTimestamp: {{ $json.timestamp }}\n\nAnalyze this signal and provide a structured assessment:\n\n1. INTENT: What is the user trying to communicate or achieve?\n2. URGENCY: Rate as low, medium, high, or critical based on:\n - Time-sensitive keywords (urgent, asap, immediately)\n - Problem severity indicators\n - Business impact signals\n3. SENTIMENT: Classify as positive, neutral, or negative\n4. CONFIDENCE_SCORE: Your confidence in this analysis (0.0 to 1.0)\n5. RISK_FLAGS: Identify any concerning elements:\n - Security threats\n - Compliance issues\n - Customer churn risk\n - Legal concerns\n - Data breach indicators\n6. RECOMMENDED_ACTION: Choose the most appropriate action:\n - notify_human: For general alerts requiring human awareness\n - create_crm_task: For sales/customer success follow-ups\n - escalate_management: For high-priority issues requiring leadership\n - open_support_ticket: For technical support requests",
"hasOutputParser": true,
"options": {
"systemMessage": "You are an AI Signal Analyzer that evaluates incoming signals and determines the appropriate action. Analyze signals for intent, urgency, sentiment, confidence, risk flags, and recommend the most appropriate action from: notify_human, create_crm_task, escalate_management, or open_support_ticket."
}
},
"id": "a84fd299-7c46-4552-9b0c-6e94ab93aa6d",
"name": "AI Signal Analyzer",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"position": [
-576,
288
]
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.recommended_action }}",
"rightValue": "notify_human",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Notify Human"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.recommended_action }}",
"rightValue": "create_crm_task",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Create CRM Task"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.recommended_action }}",
"rightValue": "escalate_management",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Escalate Management"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.recommended_action }}",
"rightValue": "open_support_ticket",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Open Support Ticket"
}
]
},
"options": {}
},
"id": "c59712db-75e6-467b-9d60-fbd5b7a27cd5",
"name": "Route by Action",
"type": "n8n-nodes-base.switch",
"typeVersion": 3.4,
"position": [
-224,
256
]
},
{
"parameters": {
"select": "channel",
"channelId": {
"__rl": true,
"mode": "id",
"value": "YOUR_SLACK_CHANNEL_ID"
},
"text": "=🚨 Signal Alert - Human Notification Required\n\n*Source:* {{ $('Workflow Configuration').item.json.source }}\n*Channel:* {{ $('Workflow Configuration').item.json.channel }}\n*Timestamp:* {{ $('Workflow Configuration').item.json.timestamp }}\n\n*Intent:* {{ $json.intent }}\n*Urgency:* {{ $json.urgency }}\n*Sentiment:* {{ $json.sentiment }}\n*Confidence:* {{ $json.confidence_score }}\n\n*Content:*\n{{ $('Workflow Configuration').item.json.content }}\n\n*Risk Flags:* {{ $json.risk_flags.join(', ') || 'None' }}",
"otherOptions": {}
},
"id": "82273327-c4af-4d1f-b924-785107a319f3",
"name": "Send Slack Notification",
"type": "n8n-nodes-base.slack",
"typeVersion": 2.4,
"position": [
0,
0
],
"webhookId": "6d1f2cf1-a5b3-4fe6-8767-c175f360f72d"
},
{
"parameters": {
"method": "POST",
"url": "https://your-crm-api.example.com/api/tasks",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer YOUR_CRM_API_TOKEN"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ {\"title\": \"Follow-up: \" + $('Workflow Configuration').item.json.source, \"description\": $('Workflow Configuration').item.json.content, \"priority\": $json.urgency, \"source\": $('Workflow Configuration').item.json.channel, \"metadata\": {\"intent\": $json.intent, \"sentiment\": $json.sentiment, \"confidence\": $json.confidence_score, \"risk_flags\": $json.risk_flags, \"timestamp\": $('Workflow Configuration').item.json.timestamp}} }}",
"options": {}
},
"id": "b6e16e44-1901-4d94-a3e3-8408f3b0346a",
"name": "Create CRM Task",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
0,
192
]
},
{
"parameters": {
"fromEmail": "alerts@yourcompany.com",
"toEmail": "management@yourcompany.com",
"subject": "=🚨 ESCALATION REQUIRED: {{ $json.urgency }} Priority Signal",
"emailFormat": "text",
"text": "=MANAGEMENT ESCALATION REQUIRED\n\nA signal has been flagged for immediate management attention.\n\n=== SIGNAL DETAILS ===\nSource: {{ $('Workflow Configuration').item.json.source }}\nChannel: {{ $('Workflow Configuration').item.json.channel }}\nTimestamp: {{ $('Workflow Configuration').item.json.timestamp }}\n\n=== AI ANALYSIS ===\nIntent: {{ $json.intent }}\nUrgency: {{ $json.urgency }}\nSentiment: {{ $json.sentiment }}\nConfidence Score: {{ $json.confidence_score }}\n\nRisk Flags: {{ $json.risk_flags.join(', ') || 'None identified' }}\n\n=== ORIGINAL CONTENT ===\n{{ $('Workflow Configuration').item.json.content }}\n\n=== RECOMMENDED ACTION ===\nImmediate review and response required.\n\nThis is an automated alert from the Signal Decision Engine.",
"options": {}
},
"id": "31dcb675-f7f9-467c-905c-a1edd0811fad",
"name": "Escalate to Management",
"type": "n8n-nodes-base.emailSend",
"typeVersion": 2.1,
"position": [
0,
384
],
"webhookId": "d536c126-c8a2-441d-997b-02f926c8175a"
},
{
"parameters": {
"method": "POST",
"url": "https://your-helpdesk-api.example.com/api/tickets",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer YOUR_HELPDESK_API_TOKEN"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ {\"subject\": \"Support Request: \" + $json.intent, \"description\": $('Workflow Configuration').item.json.content, \"priority\": $json.urgency, \"source\": $('Workflow Configuration').item.json.source, \"channel\": $('Workflow Configuration').item.json.channel, \"tags\": $json.risk_flags, \"metadata\": {\"sentiment\": $json.sentiment, \"confidence_score\": $json.confidence_score, \"timestamp\": $('Workflow Configuration').item.json.timestamp}} }}",
"options": {}
},
"id": "bf8016c3-520b-4fb9-adb9-0b80a0575750",
"name": "Open Support Ticket",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
0,
576
]
}
],
"pinData": {},
"connections": {
"Signal Webhook": {
"main": [
[
{
"node": "Workflow Configuration",
"type": "main",
"index": 0
}
]
]
},
"Workflow Configuration": {
"main": [
[
{
"node": "AI Signal Analyzer",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Signal Analyzer",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Signal Analyzer",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AI Signal Analyzer": {
"main": [
[
{
"node": "Route by Action",
"type": "main",
"index": 0
}
]
]
},
"Route by Action": {
"main": [
[
{
"node": "Send Slack Notification",
"type": "main",
"index": 0
}
],
[
{
"node": "Create CRM Task",
"type": "main",
"index": 0
}
],
[
{
"node": "Escalate to Management",
"type": "main",
"index": 0
}
],
[
{
"node": "Open Support Ticket",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1",
"availableInMCP": false
},
"versionId": "03469370-ec8b-4484-b59c-425a1caad35a",
"meta": {
"instanceId": "241b798e45d31da326d6d61cb74091878e9e36afce779239b17a965bf800b1e9"
},
"id": "Jg-fF--JFV9omrN_2G_wT",
"tags": []
}