@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.
- package/dist/index.js +204 -8
- package/package.json +2 -2
- package/skill/awesomate-app-builder/SKILL.md +5 -1
- package/skill/awesomate-credentials/SKILL.md +1 -1
- package/skill/awesomate-hosting/SKILL.md +50 -159
- package/skill/awesomate-hosting/references/connect-troubleshooting.md +77 -0
- package/skill/awesomate-hosting/references/multi-account.md +33 -0
- package/skill/awesomate-hosting/references/rest-fallback.md +30 -0
- package/skill/awesomate-hosting/scripts/bootstrap.mjs +27 -7
- package/skill/awesomate-n8n/SKILL.md +153 -147
- package/skill/awesomate-n8n/evals/ai-agent-build/graders/grader.md +31 -0
- package/skill/awesomate-n8n/evals/ai-agent-build/prompt.md +1 -0
- package/skill/awesomate-n8n/evals/build-form-email/graders/grader.md +30 -0
- package/skill/awesomate-n8n/evals/build-form-email/prompt.md +1 -0
- package/skill/awesomate-n8n/evals/datatable-dedupe/graders/grader.md +32 -0
- package/skill/awesomate-n8n/evals/datatable-dedupe/prompt.md +2 -0
- package/skill/awesomate-n8n/evals/diagnose-failure/graders/grader.md +27 -0
- package/skill/awesomate-n8n/evals/diagnose-failure/prompt.md +2 -0
- package/skill/awesomate-n8n/evals/essentials-upsell/graders/grader.md +27 -0
- package/skill/awesomate-n8n/evals/essentials-upsell/prompt.md +2 -0
- package/skill/awesomate-n8n/evals/live-change-promote/graders/grader.md +35 -0
- package/skill/awesomate-n8n/evals/live-change-promote/prompt.md +2 -0
- package/skill/awesomate-n8n/evals/possibilities-grounded/graders/grader.md +28 -0
- package/skill/awesomate-n8n/evals/possibilities-grounded/prompt.md +1 -0
- package/skill/awesomate-n8n/evals/validated-not-done/graders/grader.md +27 -0
- package/skill/awesomate-n8n/evals/validated-not-done/prompt.md +2 -0
- package/skill/awesomate-n8n/evals/vars-not-env/graders/grader.md +26 -0
- package/skill/awesomate-n8n/evals/vars-not-env/prompt.md +2 -0
- package/skill/awesomate-n8n/evals/webhook-body-fix/graders/grader.md +26 -0
- package/skill/awesomate-n8n/evals/webhook-body-fix/prompt.md +3 -0
- package/skill/awesomate-n8n/references/ai-agents.md +135 -0
- package/skill/awesomate-n8n/references/datatables.md +105 -0
- package/skill/awesomate-n8n/references/{node-recipes.md → platform-notes.md} +56 -7
- package/skill/awesomate-n8n/references/possibilities.md +83 -0
- package/skill/awesomate-n8n/references/testing-policy.md +115 -0
- package/skill/awesomate-n8n/references/troubleshooting.md +69 -0
- package/skill/awesomate-n8n/references/upgrade-loop.md +98 -0
- package/skill/awesomate-n8n/references/vendor/MANIFEST.json +26 -0
- package/skill/awesomate-n8n/references/vendor/code-node/BUILTIN_FUNCTIONS.md +779 -0
- package/skill/awesomate-n8n/references/vendor/code-node/COMMON_PATTERNS.md +1123 -0
- package/skill/awesomate-n8n/references/vendor/code-node/DATA_ACCESS.md +797 -0
- package/skill/awesomate-n8n/references/vendor/code-node/ERROR_PATTERNS.md +776 -0
- package/skill/awesomate-n8n/references/vendor/code-node/SKILL.md +703 -0
- package/skill/awesomate-n8n/references/vendor/expressions/COMMON_MISTAKES.md +406 -0
- package/skill/awesomate-n8n/references/vendor/expressions/EXAMPLES.md +496 -0
- package/skill/awesomate-n8n/references/vendor/expressions/SKILL.md +525 -0
- package/skill/awesomate-n8n/references/vendor/node-configuration/DEPENDENCIES.md +743 -0
- package/skill/awesomate-n8n/references/vendor/node-configuration/OPERATION_PATTERNS.md +926 -0
- package/skill/awesomate-n8n/references/vendor/node-configuration/SKILL.md +583 -0
- package/skill/awesomate-n8n/references/vendor/validation/ERROR_CATALOG.md +781 -0
- package/skill/awesomate-n8n/references/vendor/validation/FALSE_POSITIVES.md +695 -0
- package/skill/awesomate-n8n/references/vendor/validation/SKILL.md +414 -0
- package/skill/awesomate-n8n/references/vendor/workflow-patterns/SKILL.md +413 -0
- package/skill/awesomate-n8n/references/vendor/workflow-patterns/ai_agent_workflow.md +797 -0
- package/skill/awesomate-n8n/references/vendor/workflow-patterns/database_operations.md +798 -0
- package/skill/awesomate-n8n/references/vendor/workflow-patterns/http_api_integration.md +747 -0
- package/skill/awesomate-n8n/references/vendor/workflow-patterns/scheduled_tasks.md +786 -0
- package/skill/awesomate-n8n/references/vendor/workflow-patterns/webhook_processing.md +558 -0
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
VENDORED from n8n-builder@d293559 (n8n-expression-syntax/SKILL.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
|
+
# n8n Expression Syntax
|
|
15
|
+
|
|
16
|
+
Expert guide for writing correct n8n expressions in workflows.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Expression Format
|
|
21
|
+
|
|
22
|
+
All dynamic content in n8n uses **double curly braces**:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
{{expression}}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Examples**:
|
|
29
|
+
```
|
|
30
|
+
✅ {{$json.email}}
|
|
31
|
+
✅ {{$json.body.name}}
|
|
32
|
+
✅ {{$node["HTTP Request"].json.data}}
|
|
33
|
+
❌ $json.email (no braces - treated as literal text)
|
|
34
|
+
❌ {$json.email} (single braces - invalid)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Core Variables
|
|
40
|
+
|
|
41
|
+
### $json - Current Node Output
|
|
42
|
+
|
|
43
|
+
Access data from the current node:
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
{{$json.fieldName}}
|
|
47
|
+
{{$json['field with spaces']}}
|
|
48
|
+
{{$json.nested.property}}
|
|
49
|
+
{{$json.items[0].name}}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### $node - Reference Other Nodes
|
|
53
|
+
|
|
54
|
+
Access data from any previous node:
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
{{$node["Node Name"].json.fieldName}}
|
|
58
|
+
{{$node["HTTP Request"].json.data}}
|
|
59
|
+
{{$node["Webhook"].json.body.email}}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Important**:
|
|
63
|
+
- Node names **must** be in quotes
|
|
64
|
+
- Node names are **case-sensitive**
|
|
65
|
+
- Must match exact node name from workflow
|
|
66
|
+
|
|
67
|
+
### $now - Current Timestamp
|
|
68
|
+
|
|
69
|
+
Access current date/time:
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
{{$now}}
|
|
73
|
+
{{$now.toFormat('yyyy-MM-dd')}}
|
|
74
|
+
{{$now.toFormat('HH:mm:ss')}}
|
|
75
|
+
{{$now.plus({days: 7})}}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### $env - Environment Variables
|
|
79
|
+
|
|
80
|
+
Access environment variables:
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
{{$env.API_KEY}}
|
|
84
|
+
{{$env.DATABASE_URL}}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
> ⚠️ **n8n 2.0+:** `$env` works in regular node fields and expressions (as above), but **not inside a Code node**. Since n8n 2.0, Code nodes run on task runners with `N8N_BLOCK_ENV_ACCESS_IN_NODE=true` by default, so `$env`/`process.env` return nothing there. Pass the value into the Code node as input (e.g. via a Set node using `{{$env.X}}`) or use the credential system.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 🚨 CRITICAL: Webhook Data Structure
|
|
92
|
+
|
|
93
|
+
**Most Common Mistake**: Webhook data is **NOT** at the root!
|
|
94
|
+
|
|
95
|
+
### Webhook Node Output Structure
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
{
|
|
99
|
+
"headers": {...},
|
|
100
|
+
"params": {...},
|
|
101
|
+
"query": {...},
|
|
102
|
+
"body": { // ⚠️ USER DATA IS HERE!
|
|
103
|
+
"name": "John",
|
|
104
|
+
"email": "john@example.com",
|
|
105
|
+
"message": "Hello"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Correct Webhook Data Access
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
❌ WRONG: {{$json.name}}
|
|
114
|
+
❌ WRONG: {{$json.email}}
|
|
115
|
+
|
|
116
|
+
✅ CORRECT: {{$json.body.name}}
|
|
117
|
+
✅ CORRECT: {{$json.body.email}}
|
|
118
|
+
✅ CORRECT: {{$json.body.message}}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Why**: Webhook node wraps incoming data under `.body` property to preserve headers, params, and query parameters.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Common Patterns
|
|
126
|
+
|
|
127
|
+
### Access Nested Fields
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
// Simple nesting
|
|
131
|
+
{{$json.user.email}}
|
|
132
|
+
|
|
133
|
+
// Array access
|
|
134
|
+
{{$json.data[0].name}}
|
|
135
|
+
{{$json.items[0].id}}
|
|
136
|
+
|
|
137
|
+
// Bracket notation for spaces
|
|
138
|
+
{{$json['field name']}}
|
|
139
|
+
{{$json['user data']['first name']}}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Reference Other Nodes
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
// Node without spaces
|
|
146
|
+
{{$node["Set"].json.value}}
|
|
147
|
+
|
|
148
|
+
// Node with spaces (common!)
|
|
149
|
+
{{$node["HTTP Request"].json.data}}
|
|
150
|
+
{{$node["Respond to Webhook"].json.message}}
|
|
151
|
+
|
|
152
|
+
// Webhook node
|
|
153
|
+
{{$node["Webhook"].json.body.email}}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Combine Variables
|
|
157
|
+
|
|
158
|
+
```javascript
|
|
159
|
+
// Concatenation (automatic)
|
|
160
|
+
Hello {{$json.body.name}}!
|
|
161
|
+
|
|
162
|
+
// In URLs
|
|
163
|
+
https://api.example.com/users/{{$json.body.user_id}}
|
|
164
|
+
|
|
165
|
+
// In object properties
|
|
166
|
+
{
|
|
167
|
+
"name": "={{$json.body.name}}",
|
|
168
|
+
"email": "={{$json.body.email}}"
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## When NOT to Use Expressions
|
|
175
|
+
|
|
176
|
+
### ❌ Code Nodes
|
|
177
|
+
|
|
178
|
+
Code nodes use **direct JavaScript access**, NOT expressions!
|
|
179
|
+
|
|
180
|
+
```javascript
|
|
181
|
+
// ❌ WRONG in Code node
|
|
182
|
+
const email = '={{$json.email}}';
|
|
183
|
+
const name = '{{$json.body.name}}';
|
|
184
|
+
|
|
185
|
+
// ✅ CORRECT in Code node
|
|
186
|
+
const email = $json.email;
|
|
187
|
+
const name = $json.body.name;
|
|
188
|
+
|
|
189
|
+
// Or using Code node API
|
|
190
|
+
const email = $input.item.json.email;
|
|
191
|
+
const allItems = $input.all();
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### ❌ Webhook Paths
|
|
195
|
+
|
|
196
|
+
```javascript
|
|
197
|
+
// ❌ WRONG
|
|
198
|
+
path: "{{$json.user_id}}/webhook"
|
|
199
|
+
|
|
200
|
+
// ✅ CORRECT
|
|
201
|
+
path: "user-webhook" // Static paths only
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### ❌ Credential Fields
|
|
205
|
+
|
|
206
|
+
```javascript
|
|
207
|
+
// ❌ WRONG
|
|
208
|
+
apiKey: "={{$env.API_KEY}}"
|
|
209
|
+
|
|
210
|
+
// ✅ CORRECT
|
|
211
|
+
Use n8n credential system, not expressions
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Validation Rules
|
|
217
|
+
|
|
218
|
+
### 1. Always Use {{}}
|
|
219
|
+
|
|
220
|
+
Expressions **must** be wrapped in double curly braces.
|
|
221
|
+
|
|
222
|
+
```javascript
|
|
223
|
+
❌ $json.field
|
|
224
|
+
✅ {{$json.field}}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### 2. Use Quotes for Spaces
|
|
228
|
+
|
|
229
|
+
Field or node names with spaces require **bracket notation**:
|
|
230
|
+
|
|
231
|
+
```javascript
|
|
232
|
+
❌ {{$json.field name}}
|
|
233
|
+
✅ {{$json['field name']}}
|
|
234
|
+
|
|
235
|
+
❌ {{$node.HTTP Request.json}}
|
|
236
|
+
✅ {{$node["HTTP Request"].json}}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### 3. Match Exact Node Names
|
|
240
|
+
|
|
241
|
+
Node references are **case-sensitive**:
|
|
242
|
+
|
|
243
|
+
```javascript
|
|
244
|
+
❌ {{$node["http request"].json}} // lowercase
|
|
245
|
+
❌ {{$node["Http Request"].json}} // wrong case
|
|
246
|
+
✅ {{$node["HTTP Request"].json}} // exact match
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### 4. No Nested {{}}
|
|
250
|
+
|
|
251
|
+
Don't double-wrap expressions:
|
|
252
|
+
|
|
253
|
+
```javascript
|
|
254
|
+
❌ {{{$json.field}}}
|
|
255
|
+
✅ {{$json.field}}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Common Mistakes
|
|
261
|
+
|
|
262
|
+
For complete error catalog with fixes, see [COMMON_MISTAKES.md](COMMON_MISTAKES.md)
|
|
263
|
+
|
|
264
|
+
### Quick Fixes
|
|
265
|
+
|
|
266
|
+
| Mistake | Fix |
|
|
267
|
+
|---------|-----|
|
|
268
|
+
| `$json.field` | `{{$json.field}}` |
|
|
269
|
+
| `{{$json.field name}}` | `{{$json['field name']}}` |
|
|
270
|
+
| `{{$node.HTTP Request}}` | `{{$node["HTTP Request"]}}` |
|
|
271
|
+
| `{{{$json.field}}}` | `{{$json.field}}` |
|
|
272
|
+
| `{{$json.name}}` (webhook) | `{{$json.body.name}}` |
|
|
273
|
+
| `'={{$json.email}}'` (Code node) | `$json.email` |
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Working Examples
|
|
278
|
+
|
|
279
|
+
For real workflow examples, see [EXAMPLES.md](EXAMPLES.md)
|
|
280
|
+
|
|
281
|
+
### Example 1: Webhook to Slack
|
|
282
|
+
|
|
283
|
+
**Webhook receives**:
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"body": {
|
|
287
|
+
"name": "John Doe",
|
|
288
|
+
"email": "john@example.com",
|
|
289
|
+
"message": "Hello!"
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**In Slack node text field**:
|
|
295
|
+
```
|
|
296
|
+
New form submission!
|
|
297
|
+
|
|
298
|
+
Name: {{$json.body.name}}
|
|
299
|
+
Email: {{$json.body.email}}
|
|
300
|
+
Message: {{$json.body.message}}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Example 2: HTTP Request to Email
|
|
304
|
+
|
|
305
|
+
**HTTP Request returns**:
|
|
306
|
+
```json
|
|
307
|
+
{
|
|
308
|
+
"data": {
|
|
309
|
+
"items": [
|
|
310
|
+
{"name": "Product 1", "price": 29.99}
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**In Email node** (reference HTTP Request):
|
|
317
|
+
```
|
|
318
|
+
Product: {{$node["HTTP Request"].json.data.items[0].name}}
|
|
319
|
+
Price: ${{$node["HTTP Request"].json.data.items[0].price}}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Example 3: Format Timestamp
|
|
323
|
+
|
|
324
|
+
```javascript
|
|
325
|
+
// Current date
|
|
326
|
+
{{$now.toFormat('yyyy-MM-dd')}}
|
|
327
|
+
// Result: 2025-10-20
|
|
328
|
+
|
|
329
|
+
// Time
|
|
330
|
+
{{$now.toFormat('HH:mm:ss')}}
|
|
331
|
+
// Result: 14:30:45
|
|
332
|
+
|
|
333
|
+
// Full datetime
|
|
334
|
+
{{$now.toFormat('yyyy-MM-dd HH:mm')}}
|
|
335
|
+
// Result: 2025-10-20 14:30
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Data Type Handling
|
|
341
|
+
|
|
342
|
+
### Arrays
|
|
343
|
+
|
|
344
|
+
```javascript
|
|
345
|
+
// First item
|
|
346
|
+
{{$json.users[0].email}}
|
|
347
|
+
|
|
348
|
+
// Array length
|
|
349
|
+
{{$json.users.length}}
|
|
350
|
+
|
|
351
|
+
// Last item
|
|
352
|
+
{{$json.users[$json.users.length - 1].name}}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Objects
|
|
356
|
+
|
|
357
|
+
```javascript
|
|
358
|
+
// Dot notation (no spaces)
|
|
359
|
+
{{$json.user.email}}
|
|
360
|
+
|
|
361
|
+
// Bracket notation (with spaces or dynamic)
|
|
362
|
+
{{$json['user data'].email}}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Strings
|
|
366
|
+
|
|
367
|
+
```javascript
|
|
368
|
+
// Concatenation (automatic)
|
|
369
|
+
Hello {{$json.name}}!
|
|
370
|
+
|
|
371
|
+
// String methods
|
|
372
|
+
{{$json.email.toLowerCase()}}
|
|
373
|
+
{{$json.name.toUpperCase()}}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Numbers
|
|
377
|
+
|
|
378
|
+
```javascript
|
|
379
|
+
// Direct use
|
|
380
|
+
{{$json.price}}
|
|
381
|
+
|
|
382
|
+
// Math operations
|
|
383
|
+
{{$json.price * 1.1}} // Add 10%
|
|
384
|
+
{{$json.quantity + 5}}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Advanced Patterns
|
|
390
|
+
|
|
391
|
+
### Conditional Content
|
|
392
|
+
|
|
393
|
+
```javascript
|
|
394
|
+
// Ternary operator
|
|
395
|
+
{{$json.status === 'active' ? 'Active User' : 'Inactive User'}}
|
|
396
|
+
|
|
397
|
+
// Default values
|
|
398
|
+
{{$json.email || 'no-email@example.com'}}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Date Manipulation
|
|
402
|
+
|
|
403
|
+
```javascript
|
|
404
|
+
// Add days
|
|
405
|
+
{{$now.plus({days: 7}).toFormat('yyyy-MM-dd')}}
|
|
406
|
+
|
|
407
|
+
// Subtract hours
|
|
408
|
+
{{$now.minus({hours: 24}).toISO()}}
|
|
409
|
+
|
|
410
|
+
// Set specific date
|
|
411
|
+
{{DateTime.fromISO('2025-12-25').toFormat('MMMM dd, yyyy')}}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### String Manipulation
|
|
415
|
+
|
|
416
|
+
```javascript
|
|
417
|
+
// Substring
|
|
418
|
+
{{$json.email.substring(0, 5)}}
|
|
419
|
+
|
|
420
|
+
// Replace
|
|
421
|
+
{{$json.message.replace('old', 'new')}}
|
|
422
|
+
|
|
423
|
+
// Split and join
|
|
424
|
+
{{$json.tags.split(',').join(', ')}}
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## Debugging Expressions
|
|
430
|
+
|
|
431
|
+
### Test in Expression Editor
|
|
432
|
+
|
|
433
|
+
1. Click field with expression
|
|
434
|
+
2. Open expression editor (click "fx" icon)
|
|
435
|
+
3. See live preview of result
|
|
436
|
+
4. Check for errors highlighted in red
|
|
437
|
+
|
|
438
|
+
### Common Error Messages
|
|
439
|
+
|
|
440
|
+
**"Cannot read property 'X' of undefined"**
|
|
441
|
+
→ Parent object doesn't exist
|
|
442
|
+
→ Check your data path
|
|
443
|
+
|
|
444
|
+
**"X is not a function"**
|
|
445
|
+
→ Trying to call method on non-function
|
|
446
|
+
→ Check variable type
|
|
447
|
+
|
|
448
|
+
**Expression shows as literal text**
|
|
449
|
+
→ Missing {{ }}
|
|
450
|
+
→ Add curly braces
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## Expression Helpers
|
|
455
|
+
|
|
456
|
+
### Available Methods
|
|
457
|
+
|
|
458
|
+
**String**:
|
|
459
|
+
- `.toLowerCase()`, `.toUpperCase()`
|
|
460
|
+
- `.trim()`, `.replace()`, `.substring()`
|
|
461
|
+
- `.split()`, `.includes()`
|
|
462
|
+
|
|
463
|
+
**Array**:
|
|
464
|
+
- `.length`, `.map()`, `.filter()`
|
|
465
|
+
- `.find()`, `.join()`, `.slice()`
|
|
466
|
+
|
|
467
|
+
**DateTime** (Luxon):
|
|
468
|
+
- `.toFormat()`, `.toISO()`, `.toLocal()`
|
|
469
|
+
- `.plus()`, `.minus()`, `.set()`
|
|
470
|
+
|
|
471
|
+
**Number**:
|
|
472
|
+
- `.toFixed()`, `.toString()`
|
|
473
|
+
- Math operations: `+`, `-`, `*`, `/`, `%`
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## Best Practices
|
|
478
|
+
|
|
479
|
+
### ✅ Do
|
|
480
|
+
|
|
481
|
+
- Always use {{ }} for dynamic content
|
|
482
|
+
- Use bracket notation for field names with spaces
|
|
483
|
+
- Reference webhook data from `.body`
|
|
484
|
+
- Use $node for data from other nodes
|
|
485
|
+
- Test expressions in expression editor
|
|
486
|
+
|
|
487
|
+
### ❌ Don't
|
|
488
|
+
|
|
489
|
+
- Don't use expressions in Code nodes
|
|
490
|
+
- Don't forget quotes around node names with spaces
|
|
491
|
+
- Don't double-wrap with extra {{ }}
|
|
492
|
+
- Don't assume webhook data is at root (it's under .body!)
|
|
493
|
+
- Don't use expressions in webhook paths or credentials
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
## Related Skills
|
|
498
|
+
|
|
499
|
+
- **n8n Workflow Patterns**: See expressions in real workflow examples
|
|
500
|
+
- **n8n Node Configuration**: Understand when expressions are needed
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
## Summary
|
|
505
|
+
|
|
506
|
+
**Essential Rules**:
|
|
507
|
+
1. Wrap expressions in {{ }}
|
|
508
|
+
2. Webhook data is under `.body`
|
|
509
|
+
3. No {{ }} in Code nodes
|
|
510
|
+
4. Quote node names with spaces
|
|
511
|
+
5. Node names are case-sensitive
|
|
512
|
+
|
|
513
|
+
**Most Common Mistakes**:
|
|
514
|
+
- Missing {{ }} → Add braces
|
|
515
|
+
- `{{$json.name}}` in webhooks → Use `{{$json.body.name}}`
|
|
516
|
+
- `{{$json.email}}` in Code → Use `$json.email`
|
|
517
|
+
- `{{$node.HTTP Request}}` → Use `{{$node["HTTP Request"]}}`
|
|
518
|
+
|
|
519
|
+
For more details, see:
|
|
520
|
+
- [COMMON_MISTAKES.md](COMMON_MISTAKES.md) - Complete error catalog
|
|
521
|
+
- [EXAMPLES.md](EXAMPLES.md) - Real workflow examples
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
**Need Help?** Reference the n8n expression documentation, or test expressions directly in the n8n editor — the expression editor shows a live preview of the result against real input data.
|