bps-kit 1.2.2 β 1.3.1
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/.bps-kit.json +4 -4
- package/README.md +3 -0
- package/implementation_plan.md.resolved +37 -0
- package/package.json +2 -2
- package/templates/agents-template/ARCHITECTURE.md +21 -9
- package/templates/agents-template/agents/automation-specialist.md +157 -0
- package/templates/agents-template/rules/GEMINI.md +2 -10
- package/templates/agents-template/workflows/automate.md +153 -0
- package/templates/skills_normal/n8n-code-javascript/BUILTIN_FUNCTIONS.md +764 -0
- package/templates/skills_normal/n8n-code-javascript/COMMON_PATTERNS.md +1110 -0
- package/templates/skills_normal/n8n-code-javascript/DATA_ACCESS.md +782 -0
- package/templates/skills_normal/n8n-code-javascript/ERROR_PATTERNS.md +763 -0
- package/templates/skills_normal/n8n-code-javascript/README.md +350 -0
- package/templates/skills_normal/n8n-code-javascript/SKILL.md +699 -0
- package/templates/skills_normal/n8n-code-python/COMMON_PATTERNS.md +794 -0
- package/templates/skills_normal/n8n-code-python/DATA_ACCESS.md +702 -0
- package/templates/skills_normal/n8n-code-python/ERROR_PATTERNS.md +601 -0
- package/templates/skills_normal/n8n-code-python/README.md +386 -0
- package/templates/skills_normal/n8n-code-python/SKILL.md +748 -0
- package/templates/skills_normal/n8n-code-python/STANDARD_LIBRARY.md +974 -0
- package/templates/skills_normal/n8n-expression-syntax/COMMON_MISTAKES.md +393 -0
- package/templates/skills_normal/n8n-expression-syntax/EXAMPLES.md +483 -0
- package/templates/skills_normal/n8n-expression-syntax/README.md +93 -0
- package/templates/skills_normal/n8n-expression-syntax/SKILL.md +516 -0
- package/templates/skills_normal/n8n-mcp-tools-expert/README.md +99 -0
- package/templates/skills_normal/n8n-mcp-tools-expert/SEARCH_GUIDE.md +374 -0
- package/templates/skills_normal/n8n-mcp-tools-expert/SKILL.md +642 -0
- package/templates/skills_normal/n8n-mcp-tools-expert/VALIDATION_GUIDE.md +442 -0
- package/templates/skills_normal/n8n-mcp-tools-expert/WORKFLOW_GUIDE.md +618 -0
- package/templates/skills_normal/n8n-node-configuration/DEPENDENCIES.md +789 -0
- package/templates/skills_normal/n8n-node-configuration/OPERATION_PATTERNS.md +913 -0
- package/templates/skills_normal/n8n-node-configuration/README.md +364 -0
- package/templates/skills_normal/n8n-node-configuration/SKILL.md +785 -0
- package/templates/skills_normal/n8n-validation-expert/ERROR_CATALOG.md +943 -0
- package/templates/skills_normal/n8n-validation-expert/FALSE_POSITIVES.md +720 -0
- package/templates/skills_normal/n8n-validation-expert/README.md +290 -0
- package/templates/skills_normal/n8n-validation-expert/SKILL.md +689 -0
- package/templates/skills_normal/n8n-workflow-patterns/README.md +251 -0
- package/templates/skills_normal/n8n-workflow-patterns/SKILL.md +411 -0
- package/templates/skills_normal/n8n-workflow-patterns/ai_agent_workflow.md +784 -0
- package/templates/skills_normal/n8n-workflow-patterns/database_operations.md +785 -0
- package/templates/skills_normal/n8n-workflow-patterns/http_api_integration.md +734 -0
- package/templates/skills_normal/n8n-workflow-patterns/scheduled_tasks.md +773 -0
- package/templates/skills_normal/n8n-workflow-patterns/webhook_processing.md +545 -0
- package/templates/vault/n8n-code-javascript/SKILL.md +10 -10
- package/templates/vault/n8n-code-python/SKILL.md +11 -11
- package/templates/vault/n8n-expression-syntax/SKILL.md +4 -4
- package/templates/vault/n8n-mcp-tools-expert/SKILL.md +9 -9
- package/templates/vault/n8n-node-configuration/SKILL.md +2 -2
- package/templates/vault/n8n-validation-expert/SKILL.md +3 -3
- package/templates/vault/n8n-workflow-patterns/SKILL.md +11 -11
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
# n8n Expression Examples
|
|
2
|
+
|
|
3
|
+
Real working examples from n8n workflows.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Example 1: Webhook Form Submission
|
|
8
|
+
|
|
9
|
+
**Scenario**: Form submission webhook posts to Slack
|
|
10
|
+
|
|
11
|
+
**Workflow**: Webhook β Slack
|
|
12
|
+
|
|
13
|
+
**Webhook Input** (POST):
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"name": "John Doe",
|
|
17
|
+
"email": "john@example.com",
|
|
18
|
+
"company": "Acme Corp",
|
|
19
|
+
"message": "Interested in your product"
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Webhook Node Output**:
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"headers": {"content-type": "application/json"},
|
|
27
|
+
"params": {},
|
|
28
|
+
"query": {},
|
|
29
|
+
"body": {
|
|
30
|
+
"name": "John Doe",
|
|
31
|
+
"email": "john@example.com",
|
|
32
|
+
"company": "Acme Corp",
|
|
33
|
+
"message": "Interested in your product"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**In Slack Node** (text field):
|
|
39
|
+
```
|
|
40
|
+
New form submission! π
|
|
41
|
+
|
|
42
|
+
Name: {{$json.body.name}}
|
|
43
|
+
Email: {{$json.body.email}}
|
|
44
|
+
Company: {{$json.body.company}}
|
|
45
|
+
Message: {{$json.body.message}}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Output**:
|
|
49
|
+
```
|
|
50
|
+
New form submission! π
|
|
51
|
+
|
|
52
|
+
Name: John Doe
|
|
53
|
+
Email: john@example.com
|
|
54
|
+
Company: Acme Corp
|
|
55
|
+
Message: Interested in your product
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Example 2: HTTP API to Database
|
|
61
|
+
|
|
62
|
+
**Scenario**: Fetch user data from API and insert into database
|
|
63
|
+
|
|
64
|
+
**Workflow**: Schedule β HTTP Request β Postgres
|
|
65
|
+
|
|
66
|
+
**HTTP Request Returns**:
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"data": {
|
|
70
|
+
"users": [
|
|
71
|
+
{
|
|
72
|
+
"id": 123,
|
|
73
|
+
"name": "Alice Smith",
|
|
74
|
+
"email": "alice@example.com",
|
|
75
|
+
"role": "admin"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**In Postgres Node** (INSERT statement):
|
|
83
|
+
```sql
|
|
84
|
+
INSERT INTO users (user_id, name, email, role, synced_at)
|
|
85
|
+
VALUES (
|
|
86
|
+
{{$json.data.users[0].id}},
|
|
87
|
+
'{{$json.data.users[0].name}}',
|
|
88
|
+
'{{$json.data.users[0].email}}',
|
|
89
|
+
'{{$json.data.users[0].role}}',
|
|
90
|
+
'{{$now.toFormat('yyyy-MM-dd HH:mm:ss')}}'
|
|
91
|
+
)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Result**: User inserted with current timestamp
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Example 3: Multi-Node Data Flow
|
|
99
|
+
|
|
100
|
+
**Scenario**: Webhook β HTTP Request β Email
|
|
101
|
+
|
|
102
|
+
**Workflow Structure**:
|
|
103
|
+
1. Webhook receives order ID
|
|
104
|
+
2. HTTP Request fetches order details
|
|
105
|
+
3. Email sends confirmation
|
|
106
|
+
|
|
107
|
+
### Node 1: Webhook
|
|
108
|
+
|
|
109
|
+
**Receives**:
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"body": {
|
|
113
|
+
"order_id": "ORD-12345"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Node 2: HTTP Request
|
|
119
|
+
|
|
120
|
+
**URL field**:
|
|
121
|
+
```
|
|
122
|
+
https://api.example.com/orders/{{$json.body.order_id}}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Returns**:
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"order": {
|
|
129
|
+
"id": "ORD-12345",
|
|
130
|
+
"customer": "Bob Jones",
|
|
131
|
+
"total": 99.99,
|
|
132
|
+
"items": ["Widget", "Gadget"]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Node 3: Email
|
|
138
|
+
|
|
139
|
+
**Subject**:
|
|
140
|
+
```
|
|
141
|
+
Order {{$node["Webhook"].json.body.order_id}} Confirmed
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Body**:
|
|
145
|
+
```
|
|
146
|
+
Dear {{$node["HTTP Request"].json.order.customer}},
|
|
147
|
+
|
|
148
|
+
Your order {{$node["Webhook"].json.body.order_id}} has been confirmed!
|
|
149
|
+
|
|
150
|
+
Total: ${{$node["HTTP Request"].json.order.total}}
|
|
151
|
+
Items: {{$node["HTTP Request"].json.order.items.join(', ')}}
|
|
152
|
+
|
|
153
|
+
Thank you for your purchase!
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Email Result**:
|
|
157
|
+
```
|
|
158
|
+
Subject: Order ORD-12345 Confirmed
|
|
159
|
+
|
|
160
|
+
Dear Bob Jones,
|
|
161
|
+
|
|
162
|
+
Your order ORD-12345 has been confirmed!
|
|
163
|
+
|
|
164
|
+
Total: $99.99
|
|
165
|
+
Items: Widget, Gadget
|
|
166
|
+
|
|
167
|
+
Thank you for your purchase!
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Example 4: Date Formatting
|
|
173
|
+
|
|
174
|
+
**Scenario**: Various date format outputs
|
|
175
|
+
|
|
176
|
+
**Current Time**: 2025-10-20 14:30:45
|
|
177
|
+
|
|
178
|
+
### ISO Format
|
|
179
|
+
```javascript
|
|
180
|
+
{{$now.toISO()}}
|
|
181
|
+
```
|
|
182
|
+
**Output**: `2025-10-20T14:30:45.000Z`
|
|
183
|
+
|
|
184
|
+
### Custom Date Format
|
|
185
|
+
```javascript
|
|
186
|
+
{{$now.toFormat('yyyy-MM-dd')}}
|
|
187
|
+
```
|
|
188
|
+
**Output**: `2025-10-20`
|
|
189
|
+
|
|
190
|
+
### Time Only
|
|
191
|
+
```javascript
|
|
192
|
+
{{$now.toFormat('HH:mm:ss')}}
|
|
193
|
+
```
|
|
194
|
+
**Output**: `14:30:45`
|
|
195
|
+
|
|
196
|
+
### Full Readable Format
|
|
197
|
+
```javascript
|
|
198
|
+
{{$now.toFormat('MMMM dd, yyyy')}}
|
|
199
|
+
```
|
|
200
|
+
**Output**: `October 20, 2025`
|
|
201
|
+
|
|
202
|
+
### Date Math - Future
|
|
203
|
+
```javascript
|
|
204
|
+
{{$now.plus({days: 7}).toFormat('yyyy-MM-dd')}}
|
|
205
|
+
```
|
|
206
|
+
**Output**: `2025-10-27`
|
|
207
|
+
|
|
208
|
+
### Date Math - Past
|
|
209
|
+
```javascript
|
|
210
|
+
{{$now.minus({hours: 24}).toFormat('yyyy-MM-dd HH:mm')}}
|
|
211
|
+
```
|
|
212
|
+
**Output**: `2025-10-19 14:30`
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Example 5: Array Operations
|
|
217
|
+
|
|
218
|
+
**Data**:
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"users": [
|
|
222
|
+
{"name": "Alice", "email": "alice@example.com"},
|
|
223
|
+
{"name": "Bob", "email": "bob@example.com"},
|
|
224
|
+
{"name": "Charlie", "email": "charlie@example.com"}
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### First User
|
|
230
|
+
```javascript
|
|
231
|
+
{{$json.users[0].name}}
|
|
232
|
+
```
|
|
233
|
+
**Output**: `Alice`
|
|
234
|
+
|
|
235
|
+
### Last User
|
|
236
|
+
```javascript
|
|
237
|
+
{{$json.users[$json.users.length - 1].name}}
|
|
238
|
+
```
|
|
239
|
+
**Output**: `Charlie`
|
|
240
|
+
|
|
241
|
+
### All Emails (Join)
|
|
242
|
+
```javascript
|
|
243
|
+
{{$json.users.map(u => u.email).join(', ')}}
|
|
244
|
+
```
|
|
245
|
+
**Output**: `alice@example.com, bob@example.com, charlie@example.com`
|
|
246
|
+
|
|
247
|
+
### Array Length
|
|
248
|
+
```javascript
|
|
249
|
+
{{$json.users.length}}
|
|
250
|
+
```
|
|
251
|
+
**Output**: `3`
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Example 6: Conditional Logic
|
|
256
|
+
|
|
257
|
+
**Data**:
|
|
258
|
+
```json
|
|
259
|
+
{
|
|
260
|
+
"order": {
|
|
261
|
+
"status": "completed",
|
|
262
|
+
"total": 150
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Ternary Operator
|
|
268
|
+
```javascript
|
|
269
|
+
{{$json.order.status === 'completed' ? 'Order Complete β' : 'Pending...'}}
|
|
270
|
+
```
|
|
271
|
+
**Output**: `Order Complete β`
|
|
272
|
+
|
|
273
|
+
### Default Values
|
|
274
|
+
```javascript
|
|
275
|
+
{{$json.order.notes || 'No notes provided'}}
|
|
276
|
+
```
|
|
277
|
+
**Output**: `No notes provided` (if notes field doesn't exist)
|
|
278
|
+
|
|
279
|
+
### Multiple Conditions
|
|
280
|
+
```javascript
|
|
281
|
+
{{$json.order.total > 100 ? 'Premium Customer' : 'Standard Customer'}}
|
|
282
|
+
```
|
|
283
|
+
**Output**: `Premium Customer`
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Example 7: String Manipulation
|
|
288
|
+
|
|
289
|
+
**Data**:
|
|
290
|
+
```json
|
|
291
|
+
{
|
|
292
|
+
"user": {
|
|
293
|
+
"email": "JOHN@EXAMPLE.COM",
|
|
294
|
+
"message": " Hello World "
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Lowercase
|
|
300
|
+
```javascript
|
|
301
|
+
{{$json.user.email.toLowerCase()}}
|
|
302
|
+
```
|
|
303
|
+
**Output**: `john@example.com`
|
|
304
|
+
|
|
305
|
+
### Uppercase
|
|
306
|
+
```javascript
|
|
307
|
+
{{$json.user.message.toUpperCase()}}
|
|
308
|
+
```
|
|
309
|
+
**Output**: ` HELLO WORLD `
|
|
310
|
+
|
|
311
|
+
### Trim
|
|
312
|
+
```javascript
|
|
313
|
+
{{$json.user.message.trim()}}
|
|
314
|
+
```
|
|
315
|
+
**Output**: `Hello World`
|
|
316
|
+
|
|
317
|
+
### Substring
|
|
318
|
+
```javascript
|
|
319
|
+
{{$json.user.email.substring(0, 4)}}
|
|
320
|
+
```
|
|
321
|
+
**Output**: `JOHN`
|
|
322
|
+
|
|
323
|
+
### Replace
|
|
324
|
+
```javascript
|
|
325
|
+
{{$json.user.message.replace('World', 'n8n')}}
|
|
326
|
+
```
|
|
327
|
+
**Output**: ` Hello n8n `
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Example 8: Fields with Spaces
|
|
332
|
+
|
|
333
|
+
**Data**:
|
|
334
|
+
```json
|
|
335
|
+
{
|
|
336
|
+
"user data": {
|
|
337
|
+
"first name": "Jane",
|
|
338
|
+
"last name": "Doe",
|
|
339
|
+
"phone number": "+1234567890"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Bracket Notation
|
|
345
|
+
```javascript
|
|
346
|
+
{{$json['user data']['first name']}}
|
|
347
|
+
```
|
|
348
|
+
**Output**: `Jane`
|
|
349
|
+
|
|
350
|
+
### Combined
|
|
351
|
+
```javascript
|
|
352
|
+
{{$json['user data']['first name']}} {{$json['user data']['last name']}}
|
|
353
|
+
```
|
|
354
|
+
**Output**: `Jane Doe`
|
|
355
|
+
|
|
356
|
+
### Nested Spaces
|
|
357
|
+
```javascript
|
|
358
|
+
Contact: {{$json['user data']['phone number']}}
|
|
359
|
+
```
|
|
360
|
+
**Output**: `Contact: +1234567890`
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Example 9: Code Node (Direct Access)
|
|
365
|
+
|
|
366
|
+
**Code Node**: Transform webhook data
|
|
367
|
+
|
|
368
|
+
**Input** (from Webhook node):
|
|
369
|
+
```json
|
|
370
|
+
{
|
|
371
|
+
"body": {
|
|
372
|
+
"items": ["apple", "banana", "cherry"]
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
**Code** (JavaScript):
|
|
378
|
+
```javascript
|
|
379
|
+
// β
Direct access (no {{ }})
|
|
380
|
+
const items = $json.body.items;
|
|
381
|
+
|
|
382
|
+
// Transform to uppercase
|
|
383
|
+
const uppercased = items.map(item => item.toUpperCase());
|
|
384
|
+
|
|
385
|
+
// Return in n8n format
|
|
386
|
+
return [{
|
|
387
|
+
json: {
|
|
388
|
+
original: items,
|
|
389
|
+
transformed: uppercased,
|
|
390
|
+
count: items.length
|
|
391
|
+
}
|
|
392
|
+
}];
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**Output**:
|
|
396
|
+
```json
|
|
397
|
+
{
|
|
398
|
+
"original": ["apple", "banana", "cherry"],
|
|
399
|
+
"transformed": ["APPLE", "BANANA", "CHERRY"],
|
|
400
|
+
"count": 3
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
## Example 10: Environment Variables
|
|
407
|
+
|
|
408
|
+
**Setup**: Environment variable `API_KEY=secret123`
|
|
409
|
+
|
|
410
|
+
### In HTTP Request (Headers)
|
|
411
|
+
```javascript
|
|
412
|
+
Authorization: Bearer {{$env.API_KEY}}
|
|
413
|
+
```
|
|
414
|
+
**Result**: `Authorization: Bearer secret123`
|
|
415
|
+
|
|
416
|
+
### In URL
|
|
417
|
+
```javascript
|
|
418
|
+
https://api.example.com/data?key={{$env.API_KEY}}
|
|
419
|
+
```
|
|
420
|
+
**Result**: `https://api.example.com/data?key=secret123`
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## Template from Real Workflow
|
|
425
|
+
|
|
426
|
+
**Based on n8n template #2947** (Weather to Slack)
|
|
427
|
+
|
|
428
|
+
### Workflow Structure
|
|
429
|
+
Webhook β OpenStreetMap API β Weather API β Slack
|
|
430
|
+
|
|
431
|
+
### Webhook Slash Command
|
|
432
|
+
**Input**: `/weather London`
|
|
433
|
+
|
|
434
|
+
**Webhook receives**:
|
|
435
|
+
```json
|
|
436
|
+
{
|
|
437
|
+
"body": {
|
|
438
|
+
"text": "London"
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### OpenStreetMap API
|
|
444
|
+
**URL**:
|
|
445
|
+
```
|
|
446
|
+
https://nominatim.openstreetmap.org/search?q={{$json.body.text}}&format=json
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Weather API (NWS)
|
|
450
|
+
**URL**:
|
|
451
|
+
```
|
|
452
|
+
https://api.weather.gov/points/{{$node["OpenStreetMap"].json[0].lat}},{{$node["OpenStreetMap"].json[0].lon}}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### Slack Message
|
|
456
|
+
```
|
|
457
|
+
Weather for {{$json.body.text}}:
|
|
458
|
+
|
|
459
|
+
Temperature: {{$node["Weather API"].json.properties.temperature.value}}Β°C
|
|
460
|
+
Conditions: {{$node["Weather API"].json.properties.shortForecast}}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## Summary
|
|
466
|
+
|
|
467
|
+
**Key Patterns**:
|
|
468
|
+
1. Webhook data is under `.body`
|
|
469
|
+
2. Use `{{}}` for expressions (except Code nodes)
|
|
470
|
+
3. Reference other nodes with `$node["Node Name"].json`
|
|
471
|
+
4. Use brackets for field names with spaces
|
|
472
|
+
5. Node names are case-sensitive
|
|
473
|
+
|
|
474
|
+
**Most Common Uses**:
|
|
475
|
+
- `{{$json.body.field}}` - Webhook data
|
|
476
|
+
- `{{$node["Name"].json.field}}` - Other node data
|
|
477
|
+
- `{{$now.toFormat('yyyy-MM-dd')}}` - Timestamps
|
|
478
|
+
- `{{$json.array[0].field}}` - Array access
|
|
479
|
+
- `{{$json.field || 'default'}}` - Default values
|
|
480
|
+
|
|
481
|
+
---
|
|
482
|
+
|
|
483
|
+
**Related**: See [COMMON_MISTAKES.md](COMMON_MISTAKES.md) for error examples and fixes.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# n8n Expression Syntax
|
|
2
|
+
|
|
3
|
+
Expert guide for writing correct n8n expressions in workflows.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Teaches correct n8n expression syntax ({{ }} patterns) and fixes common mistakes, especially the critical webhook data structure gotcha.
|
|
10
|
+
|
|
11
|
+
## Activates On
|
|
12
|
+
|
|
13
|
+
- expression
|
|
14
|
+
- {{}} syntax
|
|
15
|
+
- $json, $node, $now, $env
|
|
16
|
+
- webhook data
|
|
17
|
+
- troubleshoot expression error
|
|
18
|
+
- undefined in workflow
|
|
19
|
+
|
|
20
|
+
## File Count
|
|
21
|
+
|
|
22
|
+
4 files, ~450 lines total
|
|
23
|
+
|
|
24
|
+
## Dependencies
|
|
25
|
+
|
|
26
|
+
**n8n-mcp tools**:
|
|
27
|
+
- None directly (syntax knowledge skill)
|
|
28
|
+
- Works with n8n-mcp validation tools
|
|
29
|
+
|
|
30
|
+
**Related skills**:
|
|
31
|
+
- n8n Workflow Patterns (uses expressions in examples)
|
|
32
|
+
- n8n MCP Tools Expert (validates expressions)
|
|
33
|
+
- n8n Node Configuration (when expressions are needed)
|
|
34
|
+
|
|
35
|
+
## Coverage
|
|
36
|
+
|
|
37
|
+
### Core Topics
|
|
38
|
+
- Expression format ({{ }})
|
|
39
|
+
- Core variables ($json, $node, $now, $env)
|
|
40
|
+
- **Webhook data structure** ($json.body.*)
|
|
41
|
+
- When NOT to use expressions (Code nodes)
|
|
42
|
+
|
|
43
|
+
### Common Patterns
|
|
44
|
+
- Accessing nested fields
|
|
45
|
+
- Referencing other nodes
|
|
46
|
+
- Array and object access
|
|
47
|
+
- Date/time formatting
|
|
48
|
+
- String manipulation
|
|
49
|
+
|
|
50
|
+
### Error Prevention
|
|
51
|
+
- 15 common mistakes with fixes
|
|
52
|
+
- Quick reference table
|
|
53
|
+
- Debugging process
|
|
54
|
+
|
|
55
|
+
## Evaluations
|
|
56
|
+
|
|
57
|
+
4 scenarios (100% coverage expected):
|
|
58
|
+
1. **eval-001**: Missing curly braces
|
|
59
|
+
2. **eval-002**: Webhook body data access (critical!)
|
|
60
|
+
3. **eval-003**: Code node vs expression confusion
|
|
61
|
+
4. **eval-004**: Node reference syntax
|
|
62
|
+
|
|
63
|
+
## Key Features
|
|
64
|
+
|
|
65
|
+
β
**Critical Gotcha Highlighted**: Webhook data under `.body`
|
|
66
|
+
β
**Real Examples**: From MCP testing and real templates
|
|
67
|
+
β
**Quick Fixes Table**: Fast reference for common errors
|
|
68
|
+
β
**Code vs Expression**: Clear distinction
|
|
69
|
+
β
**Comprehensive**: Covers 95% of expression use cases
|
|
70
|
+
|
|
71
|
+
## Files
|
|
72
|
+
|
|
73
|
+
- **SKILL.md** (285 lines) - Main content with all essential knowledge
|
|
74
|
+
- **COMMON_MISTAKES.md** (380 lines) - Complete error catalog with 15 common mistakes
|
|
75
|
+
- **EXAMPLES.md** (450 lines) - 10 real working examples
|
|
76
|
+
- **README.md** (this file) - Skill metadata
|
|
77
|
+
|
|
78
|
+
## Success Metrics
|
|
79
|
+
|
|
80
|
+
**Expected outcomes**:
|
|
81
|
+
- Users correctly wrap expressions in {{ }}
|
|
82
|
+
- Zero webhook `.body` access errors
|
|
83
|
+
- No expressions used in Code nodes
|
|
84
|
+
- Correct $node reference syntax
|
|
85
|
+
|
|
86
|
+
## Last Updated
|
|
87
|
+
|
|
88
|
+
2025-10-20
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
**Part of**: n8n-skills repository
|
|
93
|
+
**Conceived by**: Romuald CzΕonkowski - [www.aiadvisors.pl/en](https://www.aiadvisors.pl/en)
|