Webhook { body, headers } trigger Parse payload Code node AI Agent Memory ↓ Model ↓ Format reply {{ $json.output }} Post to Mattermost HTTP POST {{ $('Webhook').first().json.body }} reads from named node sessionKey: {{ $('chat trigger').first().json.sessionId }} {{ $json.output }} current node field n8n expression cheat sheet · 50 examples · cos.32dots.de
n8n Expression Cheat Sheet
50 ready-to-paste snippets · toggle ={ in any n8n field to enter expression mode
The Session Memory Pattern — Anatomy of an Expression Most important for session-02
={{ $('When chat message received').first().json.sessionId }}
$
Expression prefix
All n8n expressions start with $. The gateway to runtime data.
('When chat message received')
Node selector
Name of the upstream node — must match exactly, including spaces.
.first()
Item picker
First item in the node's output. Also: .last(), .all(), .item
.json
Data accessor
Access the JSON data bag of the item (vs .binary for files).
.sessionId
Field name
Auto-generated unique UUID per browser chat session. The memory key.
Why this matters: The Simple Memory node needs a unique key per conversation. The chat trigger auto-generates a sessionId UUID for each browser chat session. Without it you get "Key parameter is empty" errors — every user shares one memory buffer.