Demo Workflow - How to use workflowStaticData()

Nodes

9dd572aa-e531-4ffe-a66c-58ac7003ac5d3b9f1b78-6b80-4575-aa6c-9669870003892e3e39e3-0e17-4fae-9ac5-9ee31f9711ed

Created by

RiRia

Last edited 39 days ago

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 with access tokens that expire after a certain time period. Using staticData we can keep a record of that access token and the expiry time and build our workflow logic around it.

Important

Static Data only persists across production executions, i.e. triggered by Webhooks or Schedule Triggers (not manual executions!) For this the workflow will have to be activated.

Setup

  • configure HTTP Request node to fetch access token from your API (optional)
  • activate workflow
  • test the workflow with the webhook production link
  • you can check the population of the static data in the single executions

Feedback

If you found this useful or want to report some missing information - I'd be happy to hear from you at ria@n8n.io

New to n8n?

Need help building new n8n workflows? Process automation for you or your company will save you time and money, and it's completely free!