Templates / Demo workflow - how to use workflowStaticData()

Demo workflow - how to use workflowStaticData()

Ready for 3.0

by Ria ✓ · 12,192 views · created 2024-11-12 · Engineering

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This workflow has 7 nodes and runs when an HTTP GET request hits its webhook URL (plus 1 other trigger). It uses only n8n's built-in nodes.

How it runs

Trigger: When an HTTP GET request hits its webhook URL (plus 1 other trigger).

  1. 1. initiate static data (Code): runs custom JavaScript code
  2. If: checks a condition and branches into true / false
  3. get new accessToken (HTTP Request): calls an HTTP API
  4. 2. set token in static data (Code): runs custom JavaScript code

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (6)

From the author

This workflow demonstrates how to use the workflowStaticData() function to set any type of variable that will persist within workflow executions. https://docs.n8n.io/code/cookbook/builtin/get-workflow-static-data/ This can be useful for example when working…

Excerpt from Ria's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.