@awesomate/hosting-mcp 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/index.js +204 -8
  2. package/package.json +2 -2
  3. package/skill/awesomate-app-builder/SKILL.md +5 -1
  4. package/skill/awesomate-credentials/SKILL.md +1 -1
  5. package/skill/awesomate-hosting/SKILL.md +50 -159
  6. package/skill/awesomate-hosting/references/connect-troubleshooting.md +77 -0
  7. package/skill/awesomate-hosting/references/multi-account.md +33 -0
  8. package/skill/awesomate-hosting/references/rest-fallback.md +30 -0
  9. package/skill/awesomate-hosting/scripts/bootstrap.mjs +27 -7
  10. package/skill/awesomate-n8n/SKILL.md +153 -147
  11. package/skill/awesomate-n8n/evals/ai-agent-build/graders/grader.md +31 -0
  12. package/skill/awesomate-n8n/evals/ai-agent-build/prompt.md +1 -0
  13. package/skill/awesomate-n8n/evals/build-form-email/graders/grader.md +30 -0
  14. package/skill/awesomate-n8n/evals/build-form-email/prompt.md +1 -0
  15. package/skill/awesomate-n8n/evals/datatable-dedupe/graders/grader.md +32 -0
  16. package/skill/awesomate-n8n/evals/datatable-dedupe/prompt.md +2 -0
  17. package/skill/awesomate-n8n/evals/diagnose-failure/graders/grader.md +27 -0
  18. package/skill/awesomate-n8n/evals/diagnose-failure/prompt.md +2 -0
  19. package/skill/awesomate-n8n/evals/essentials-upsell/graders/grader.md +27 -0
  20. package/skill/awesomate-n8n/evals/essentials-upsell/prompt.md +2 -0
  21. package/skill/awesomate-n8n/evals/live-change-promote/graders/grader.md +35 -0
  22. package/skill/awesomate-n8n/evals/live-change-promote/prompt.md +2 -0
  23. package/skill/awesomate-n8n/evals/possibilities-grounded/graders/grader.md +28 -0
  24. package/skill/awesomate-n8n/evals/possibilities-grounded/prompt.md +1 -0
  25. package/skill/awesomate-n8n/evals/validated-not-done/graders/grader.md +27 -0
  26. package/skill/awesomate-n8n/evals/validated-not-done/prompt.md +2 -0
  27. package/skill/awesomate-n8n/evals/vars-not-env/graders/grader.md +26 -0
  28. package/skill/awesomate-n8n/evals/vars-not-env/prompt.md +2 -0
  29. package/skill/awesomate-n8n/evals/webhook-body-fix/graders/grader.md +26 -0
  30. package/skill/awesomate-n8n/evals/webhook-body-fix/prompt.md +3 -0
  31. package/skill/awesomate-n8n/references/ai-agents.md +135 -0
  32. package/skill/awesomate-n8n/references/datatables.md +105 -0
  33. package/skill/awesomate-n8n/references/{node-recipes.md → platform-notes.md} +56 -7
  34. package/skill/awesomate-n8n/references/possibilities.md +83 -0
  35. package/skill/awesomate-n8n/references/testing-policy.md +115 -0
  36. package/skill/awesomate-n8n/references/troubleshooting.md +69 -0
  37. package/skill/awesomate-n8n/references/upgrade-loop.md +98 -0
  38. package/skill/awesomate-n8n/references/vendor/MANIFEST.json +26 -0
  39. package/skill/awesomate-n8n/references/vendor/code-node/BUILTIN_FUNCTIONS.md +779 -0
  40. package/skill/awesomate-n8n/references/vendor/code-node/COMMON_PATTERNS.md +1123 -0
  41. package/skill/awesomate-n8n/references/vendor/code-node/DATA_ACCESS.md +797 -0
  42. package/skill/awesomate-n8n/references/vendor/code-node/ERROR_PATTERNS.md +776 -0
  43. package/skill/awesomate-n8n/references/vendor/code-node/SKILL.md +703 -0
  44. package/skill/awesomate-n8n/references/vendor/expressions/COMMON_MISTAKES.md +406 -0
  45. package/skill/awesomate-n8n/references/vendor/expressions/EXAMPLES.md +496 -0
  46. package/skill/awesomate-n8n/references/vendor/expressions/SKILL.md +525 -0
  47. package/skill/awesomate-n8n/references/vendor/node-configuration/DEPENDENCIES.md +743 -0
  48. package/skill/awesomate-n8n/references/vendor/node-configuration/OPERATION_PATTERNS.md +926 -0
  49. package/skill/awesomate-n8n/references/vendor/node-configuration/SKILL.md +583 -0
  50. package/skill/awesomate-n8n/references/vendor/validation/ERROR_CATALOG.md +781 -0
  51. package/skill/awesomate-n8n/references/vendor/validation/FALSE_POSITIVES.md +695 -0
  52. package/skill/awesomate-n8n/references/vendor/validation/SKILL.md +414 -0
  53. package/skill/awesomate-n8n/references/vendor/workflow-patterns/SKILL.md +413 -0
  54. package/skill/awesomate-n8n/references/vendor/workflow-patterns/ai_agent_workflow.md +797 -0
  55. package/skill/awesomate-n8n/references/vendor/workflow-patterns/database_operations.md +798 -0
  56. package/skill/awesomate-n8n/references/vendor/workflow-patterns/http_api_integration.md +747 -0
  57. package/skill/awesomate-n8n/references/vendor/workflow-patterns/scheduled_tasks.md +786 -0
  58. package/skill/awesomate-n8n/references/vendor/workflow-patterns/webhook_processing.md +558 -0
@@ -0,0 +1,558 @@
1
+ <!--
2
+ VENDORED from n8n-builder@d293559 (n8n-workflow-patterns/webhook_processing.md) — DO NOT EDIT HERE.
3
+ Edit the source in ~/Projects/n8n-builder, then re-run:
4
+ node mcp/scripts/sync-n8n-references.mjs --write
5
+
6
+ Awesomate platform overrides — where this file conflicts with
7
+ ../platform-notes.md, platform-notes wins:
8
+ - $env is BLOCKED fleet-wide → use {{ $vars.key || 'fallback' }}
9
+ - Task runners are ON → no $helpers in Code nodes; use HTTP Request nodes
10
+ - Webhook payloads live at $json.body
11
+ - saveExecutionProgress must stay false
12
+ -->
13
+
14
+ # Webhook Processing Pattern
15
+
16
+ **Use Case**: Receive HTTP requests from external systems and process them instantly.
17
+
18
+ ---
19
+
20
+ ## Pattern Structure
21
+
22
+ ```
23
+ Webhook → [Validate] → [Transform] → [Action] → [Response/Notify]
24
+ ```
25
+
26
+ **Key Characteristic**: Instant event-driven processing
27
+
28
+ ---
29
+
30
+ ## Core Components
31
+
32
+ ### 1. Webhook Node (Trigger)
33
+ **Purpose**: Create HTTP endpoint to receive data
34
+
35
+ **Configuration**:
36
+ ```javascript
37
+ {
38
+ path: "form-submit", // URL path: https://n8n.example.com/webhook/form-submit
39
+ httpMethod: "POST", // GET, POST, PUT, DELETE
40
+ responseMode: "onReceived", // or "lastNode" for custom response
41
+ responseData: "allEntries" // or "firstEntryJson"
42
+ }
43
+ ```
44
+
45
+ **Critical Gotcha**: Data is nested under `$json.body`
46
+ ```javascript
47
+ ❌ {{$json.email}}
48
+ ✅ {{$json.body.email}}
49
+ ```
50
+
51
+ ### 2. Validation (Optional but Recommended)
52
+ **Purpose**: Verify incoming data before processing
53
+
54
+ **Options**:
55
+ - **IF node** - Check required fields exist
56
+ - **Code node** - Custom validation logic
57
+ - **Stop and Error** - Fail gracefully with message
58
+
59
+ **Example**:
60
+ ```javascript
61
+ // IF node condition
62
+ {{$json.body.email}} is not empty AND
63
+ {{$json.body.name}} is not empty
64
+ ```
65
+
66
+ ### 3. Transformation
67
+ **Purpose**: Map webhook data to desired format
68
+
69
+ **Typical nodes**:
70
+ - **Set** - Field mapping
71
+ - **Code** - Complex transformations
72
+
73
+ **Example** (Set node):
74
+ ```javascript
75
+ {
76
+ "user_email": "={{$json.body.email}}",
77
+ "user_name": "={{$json.body.name}}",
78
+ "timestamp": "={{$now}}"
79
+ }
80
+ ```
81
+
82
+ ### 4. Action
83
+ **Purpose**: Do something with the data
84
+
85
+ **Common actions**:
86
+ - Store in database (Postgres, MySQL, MongoDB)
87
+ - Send notification (Slack, Email, Discord)
88
+ - Call another API (HTTP Request)
89
+ - Update external system (CRM, support ticket)
90
+
91
+ ### 5. Response (If responseMode: "lastNode")
92
+ **Purpose**: Send custom HTTP response
93
+
94
+ **Webhook Response Node**:
95
+ ```javascript
96
+ {
97
+ statusCode: 200,
98
+ headers: {
99
+ "Content-Type": "application/json"
100
+ },
101
+ body: {
102
+ "status": "success",
103
+ "message": "Form received"
104
+ }
105
+ }
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Common Use Cases
111
+
112
+ ### 1. Form Submissions
113
+ **Flow**: Form → Webhook → Validate → Database → Email Confirmation
114
+
115
+ **Example**:
116
+ ```
117
+ 1. Webhook (path: "contact-form", POST)
118
+ 2. IF (check email & message not empty)
119
+ 3. Postgres (insert into contacts table)
120
+ 4. Email (send confirmation to user)
121
+ 5. Slack (notify team in #leads)
122
+ 6. Webhook Response ({"status": "success"})
123
+ ```
124
+
125
+ **Real Data Access**:
126
+ ```javascript
127
+ Name: {{$json.body.name}}
128
+ Email: {{$json.body.email}}
129
+ Message: {{$json.body.message}}
130
+ ```
131
+
132
+ ### 2. Payment Webhooks (Stripe, PayPal)
133
+ **Flow**: Payment Provider → Webhook → Verify → Update Database → Send Receipt
134
+
135
+ **Security**: Verify webhook signatures
136
+ ```javascript
137
+ // Code node - verify Stripe signature
138
+ const crypto = require('crypto');
139
+ const signature = $input.item.headers['stripe-signature'];
140
+ const secret = $credentials.stripeWebhookSecret;
141
+
142
+ // Verify signature matches
143
+ const expectedSig = crypto
144
+ .createHmac('sha256', secret)
145
+ .update($input.item.body)
146
+ .digest('hex');
147
+
148
+ if (signature !== expectedSig) {
149
+ throw new Error('Invalid webhook signature');
150
+ }
151
+
152
+ return $input.item.body; // Return validated body
153
+ ```
154
+
155
+ ### 3. Chat Platform Integrations (Slack, Discord, Teams)
156
+ **Flow**: Chat Command → Webhook → Process → Respond
157
+
158
+ **Example** (Slack slash command):
159
+ ```
160
+ 1. Webhook (path: "slack-command", POST)
161
+ 2. Code (parse Slack payload: $json.body.text, $json.body.user_id)
162
+ 3. HTTP Request (fetch data from API)
163
+ 4. Set (format Slack message)
164
+ 5. Webhook Response (immediate Slack response)
165
+ ```
166
+
167
+ **Slack Data Access**:
168
+ ```javascript
169
+ Command: {{$json.body.command}}
170
+ Text: {{$json.body.text}}
171
+ User ID: {{$json.body.user_id}}
172
+ Channel ID: {{$json.body.channel_id}}
173
+ ```
174
+
175
+ ### 4. GitHub/GitLab Webhooks
176
+ **Flow**: Git Event → Webhook → Parse → Notify/Deploy
177
+
178
+ **Example** (new PR notification):
179
+ ```
180
+ 1. Webhook (path: "github", POST)
181
+ 2. IF (check $json.body.action equals "opened")
182
+ 3. Set (extract PR details: title, author, url)
183
+ 4. Slack (notify #dev-team)
184
+ 5. Webhook Response (200 OK)
185
+ ```
186
+
187
+ **GitHub Data Access**:
188
+ ```javascript
189
+ Event Type: {{$json.headers['x-github-event']}}
190
+ Action: {{$json.body.action}}
191
+ PR Title: {{$json.body.pull_request.title}}
192
+ Author: {{$json.body.pull_request.user.login}}
193
+ URL: {{$json.body.pull_request.html_url}}
194
+ ```
195
+
196
+ ### 5. IoT Device Data
197
+ **Flow**: Device → Webhook → Validate → Store → Alert (if threshold)
198
+
199
+ **Example** (temperature sensor):
200
+ ```
201
+ 1. Webhook (path: "sensor-data", POST)
202
+ 2. Set (extract sensor readings)
203
+ 3. Postgres (insert into sensor_readings)
204
+ 4. IF (temperature > 80)
205
+ 5. Email (alert admin)
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Webhook Data Structure
211
+
212
+ ### Standard Structure
213
+ ```json
214
+ {
215
+ "headers": {
216
+ "content-type": "application/json",
217
+ "user-agent": "...",
218
+ "x-custom-header": "..."
219
+ },
220
+ "params": {
221
+ "id": "123" // From URL: /webhook/form/:id
222
+ },
223
+ "query": {
224
+ "token": "abc" // From URL: /webhook/form?token=abc
225
+ },
226
+ "body": {
227
+ // ⚠️ YOUR DATA IS HERE!
228
+ "name": "John",
229
+ "email": "john@example.com"
230
+ }
231
+ }
232
+ ```
233
+
234
+ ### Accessing Different Parts
235
+ ```javascript
236
+ // Headers
237
+ {{$json.headers['content-type']}}
238
+ {{$json.headers['x-api-key']}}
239
+
240
+ // URL Parameters
241
+ {{$json.params.id}}
242
+
243
+ // Query Parameters
244
+ {{$json.query.token}}
245
+ {{$json.query.page}}
246
+
247
+ // Body (MOST COMMON)
248
+ {{$json.body.email}}
249
+ {{$json.body.user.name}}
250
+ {{$json.body.items[0].price}}
251
+ ```
252
+
253
+ ---
254
+
255
+ ## Authentication & Security
256
+
257
+ ### 1. Query Parameter Token
258
+ **Simple but less secure**
259
+ ```javascript
260
+ // IF node - validate token
261
+ {{$json.query.token}} equals "your-secret-token"
262
+ ```
263
+
264
+ ### 2. Header-Based Auth
265
+ **Better security**
266
+ ```javascript
267
+ // IF node - check header
268
+ {{$json.headers['x-api-key']}} equals "your-api-key"
269
+ ```
270
+
271
+ ### 3. Signature Verification
272
+ **Best security** (for webhooks from services like Stripe, GitHub)
273
+ ```javascript
274
+ // Code node
275
+ const crypto = require('crypto');
276
+ const signature = $input.item.headers['x-signature'];
277
+ const secret = $credentials.webhookSecret;
278
+
279
+ const calculatedSig = crypto
280
+ .createHmac('sha256', secret)
281
+ .update(JSON.stringify($input.item.body))
282
+ .digest('hex');
283
+
284
+ if (signature !== `sha256=${calculatedSig}`) {
285
+ throw new Error('Invalid signature');
286
+ }
287
+
288
+ return $input.item.body;
289
+ ```
290
+
291
+ ### 4. IP Whitelist
292
+ **Restrict access by IP** (n8n workflow settings)
293
+ - Configure in workflow settings
294
+ - Only allow specific IP ranges
295
+ - Use for internal systems
296
+
297
+ ---
298
+
299
+ ## Response Modes
300
+
301
+ ### onReceived (Default)
302
+ **Behavior**: Immediate 200 OK response, workflow continues in background
303
+
304
+ **Use when**:
305
+ - Long-running workflows
306
+ - Response doesn't depend on workflow result
307
+ - Fire-and-forget processing
308
+
309
+ **Configuration**:
310
+ ```javascript
311
+ {
312
+ responseMode: "onReceived",
313
+ responseCode: 200
314
+ }
315
+ ```
316
+
317
+ ### lastNode (Custom Response)
318
+ **Behavior**: Wait for workflow completion, send custom response
319
+
320
+ **Use when**:
321
+ - Need to return data to caller
322
+ - Synchronous processing required
323
+ - Form submissions with confirmation
324
+
325
+ **Configuration**:
326
+ ```javascript
327
+ {
328
+ responseMode: "lastNode"
329
+ }
330
+ ```
331
+
332
+ **Then add Webhook Response node**:
333
+ ```javascript
334
+ {
335
+ statusCode: 200,
336
+ headers: {
337
+ "Content-Type": "application/json"
338
+ },
339
+ body: {
340
+ "id": "={{$json.record_id}}",
341
+ "status": "success"
342
+ }
343
+ }
344
+ ```
345
+
346
+ ---
347
+
348
+ ## Error Handling
349
+
350
+ ### Pattern 1: Try-Catch with Error Trigger
351
+ ```
352
+ Main Flow:
353
+ Webhook → [nodes...] → Success Response
354
+
355
+ Error Flow:
356
+ Error Trigger → Log Error → Slack Alert → Error Response
357
+ ```
358
+
359
+ **Error Trigger Configuration**:
360
+ ```javascript
361
+ {
362
+ workflowId: "current-workflow-id"
363
+ }
364
+ ```
365
+
366
+ **Error Response** (if responseMode: "lastNode"):
367
+ ```javascript
368
+ {
369
+ statusCode: 500,
370
+ body: {
371
+ "status": "error",
372
+ "message": "Processing failed"
373
+ }
374
+ }
375
+ ```
376
+
377
+ ### Pattern 2: Validation Early Exit
378
+ ```
379
+ Webhook → IF (validate) → [True: Process]
380
+ └→ [False: Error Response]
381
+ ```
382
+
383
+ **False Branch Response**:
384
+ ```javascript
385
+ {
386
+ statusCode: 400,
387
+ body: {
388
+ "status": "error",
389
+ "message": "Invalid data: missing email"
390
+ }
391
+ }
392
+ ```
393
+
394
+ ### Pattern 3: Continue On Fail
395
+ **Per-node setting**: Continue even if node fails
396
+
397
+ **Use case**: Non-critical notifications
398
+ ```
399
+ Webhook → Database (critical) → Slack (continueOnFail: true)
400
+ ```
401
+
402
+ ---
403
+
404
+ ## Testing Webhooks
405
+
406
+ ### 1. Use Manual Trigger
407
+ Replace Webhook with Manual Trigger for testing:
408
+ ```
409
+ Manual Trigger → [set test data] → rest of workflow
410
+ ```
411
+
412
+ ### 2. Use curl
413
+ ```bash
414
+ curl -X POST https://n8n.example.com/webhook/form-submit \
415
+ -H "Content-Type: application/json" \
416
+ -d '{"email": "test@example.com", "name": "Test User"}'
417
+ ```
418
+
419
+ ### 3. Use Postman/Insomnia
420
+ - Create request collection
421
+ - Test different payloads
422
+ - Verify responses
423
+
424
+ ### 4. Webhook.site
425
+ - Use webhook.site for testing
426
+ - Copy webhook.site URL to your service
427
+ - View requests and debug
428
+
429
+ ---
430
+
431
+ ## Performance Considerations
432
+
433
+ ### Large Payloads
434
+ - Webhook timeout: 120 seconds (default)
435
+ - For large data, consider async processing:
436
+ ```
437
+ Webhook → Queue (Redis/DB) → Response (immediate)
438
+
439
+ Separate Workflow:
440
+ Schedule → Check Queue → Process
441
+ ```
442
+
443
+ ### High Volume
444
+ - Use "Execute Once" mode if processing all items together
445
+ - Consider rate limiting
446
+ - Monitor execution times
447
+ - Scale n8n instance if needed
448
+
449
+ ### Retries
450
+ - Webhook calls typically don't retry automatically
451
+ - Implement retry logic on caller side
452
+ - Or use queue pattern for guaranteed processing
453
+
454
+ ---
455
+
456
+ ## Common Gotchas
457
+
458
+ ### 1. ❌ Wrong: Accessing webhook data
459
+ ```javascript
460
+ {{$json.email}} // Empty or undefined
461
+ ```
462
+
463
+ ### ✅ Correct
464
+ ```javascript
465
+ {{$json.body.email}} // Data is under .body
466
+ ```
467
+
468
+ ### 2. ❌ Wrong: Response mode confusion
469
+ Using Webhook Response node with responseMode: "onReceived" (ignored)
470
+
471
+ ### ✅ Correct
472
+ Set responseMode: "lastNode" to use Webhook Response node
473
+
474
+ ### 3. ❌ Wrong: No validation
475
+ Assuming data is always present and valid
476
+
477
+ ### ✅ Correct
478
+ Validate data early with IF node or Code node
479
+
480
+ ### 4. ❌ Wrong: Hardcoded paths
481
+ Using same path for dev/prod
482
+
483
+ ### ✅ Correct
484
+ Use environment variables: `{{$env.WEBHOOK_PATH_PREFIX}}/form-submit`
485
+
486
+ ---
487
+
488
+ ## Real Template Examples
489
+
490
+ From n8n template library (1,085 webhook templates):
491
+
492
+ **Simple Form to Slack**:
493
+ ```
494
+ Webhook → Set → Slack
495
+ ```
496
+
497
+ **Payment Processing**:
498
+ ```
499
+ Webhook → Verify Signature → Update Database → Send Receipt → Notify Admin
500
+ ```
501
+
502
+ **Chat Bot**:
503
+ ```
504
+ Webhook → Parse Command → AI Agent → Format Response → Webhook Response
505
+ ```
506
+
507
+ Browse the n8n template library (n8n.io/workflows) for more examples!
508
+
509
+ ---
510
+
511
+ ## Checklist for Webhook Workflows
512
+
513
+ ### Setup
514
+ - [ ] Choose descriptive webhook path
515
+ - [ ] Configure HTTP method (POST most common)
516
+ - [ ] Choose response mode (onReceived vs lastNode)
517
+ - [ ] Test webhook URL before connecting services
518
+
519
+ ### Security
520
+ - [ ] Add authentication (token, signature, IP whitelist)
521
+ - [ ] Validate incoming data
522
+ - [ ] Sanitize user input (if storing/displaying)
523
+ - [ ] Use HTTPS (always)
524
+
525
+ ### Data Handling
526
+ - [ ] Remember data is under $json.body
527
+ - [ ] Handle missing fields gracefully
528
+ - [ ] Transform data to desired format
529
+ - [ ] Log important data (for debugging)
530
+
531
+ ### Error Handling
532
+ - [ ] Add Error Trigger workflow
533
+ - [ ] Validate required fields
534
+ - [ ] Return appropriate error responses
535
+ - [ ] Alert team on failures
536
+
537
+ ### Testing
538
+ - [ ] Test with curl/Postman
539
+ - [ ] Test error scenarios
540
+ - [ ] Verify response format
541
+ - [ ] Monitor first executions
542
+
543
+ ---
544
+
545
+ ## Summary
546
+
547
+ **Key Points**:
548
+ 1. **Data under $json.body** (most common mistake!)
549
+ 2. **Validate early** to catch bad data
550
+ 3. **Choose response mode** based on use case
551
+ 4. **Secure webhooks** with auth
552
+ 5. **Handle errors** gracefully
553
+
554
+ **Pattern**: Webhook → Validate → Transform → Action → Response
555
+
556
+ **Related**:
557
+ - [n8n Expression Syntax](../expressions/SKILL.md) - Accessing webhook data correctly
558
+ - [http_api_integration.md](http_api_integration.md) - Making HTTP requests in response