Learning: Expressions in n8n
What are expressions in n8n, and why should you use them?
In n8n, expressions allow you to populate node parameters dynamically by executing JavaScript code. Instead of providing a static value, you can use the n8n expression syntax to define the value using data from previous nodes, other workflows, or your n8n environment.
[Example]
Suppose you build an n8n workflow that sends an order confirmation email. You need to provide the customer's email address in the Email node. You can enter it as a static value or use an expression to get it dynamically.
Without an expression: You enter john@example.com directly. This is a static value, so the workflow will always send the email to John. For another customer, you would need to change the value manually.
With an expression: You enter {{ $json.email }}. n8n gets the email from the incoming data. If the customer is John, it uses his email. If the customer is Sarah, it automatically uses her email.
This is the key benefit of expressions: you build the workflow once, and it works with changing data automatically. Static values stay the same, while expressions allow node parameters to adapt to the data flowing through your workflow.
14
2 comments
Aatar Atta
5
Learning: Expressions in n8n
The AI Advantage
skool.com/the-ai-advantage
Founded by Tony Robbins, Dean Graziosi & Igor Pogany - AI Advantage is your go-to hub to simplify AI and confidently unlock real & repeatable results
Leaderboard (30-day)
Powered by