Who is this workflow for? The Simple File-Based Key-Value Store (GetKey) workflow enables you to retrieve values associated with specific keys from a local JSON file. This automated process streamlines data access within your n8n environment, enhancing efficiency and organization..

What does this workflow do?

  • Setup Local Directory:
  • Create a subfolder named local-files in your n8n home directory (/home/node/.n8n/local-files). For Docker setups, locate the data path and create the local-files subfolder there.
  • Set appropriate access rights using the command: chmod 1000:1000 local-files.
  • Deploy GetKey Workflow:
  • Import the provided workflow code into a new workflow named GetKey. This workflow is responsible for reading values from the specified JSON file based on the provided key.
  • Create Function Item Workflow:
  • Develop a separate workflow containing a Function Item node with the following code: javascript return { file: '/4711.json', // Replace '4711' with your workflow ID key: 'MyKey', default: 'Optional returned value if key is empty / not exists' }
  • This function defines the file path, the key to retrieve, and an optional default value if the key does not exist.
  • Connect Workflows:
  • Pipe the output of the Function Item node to an Execution Workflow node that invokes the GetKey workflow. This setup allows dynamic retrieval of values based on the defined key.
  • Deployment and Testing:
  • Ensure both workflows are active and correctly configured.
  • Test the setup by triggering the Function Item workflow and verifying that the correct value is retrieved from the JSON file.

🤖 Why Use This Automation Workflow?

  • Local Data Management: Store and access key-value pairs locally without relying on external databases.
  • Automation Integration: Seamlessly integrate with other workflows, enabling automated data retrieval and processing.
  • Ease of Setup: Simple configuration steps allow quick deployment and minimal maintenance.

👨‍💻 Who is This Workflow For?

This workflow is ideal for developers and automation enthusiasts using n8n who need a straightforward method to manage and retrieve configuration settings, user preferences, or other key-value data locally within their automation workflows.

🎯 Use Cases

  1. Configuration Management: Store application settings or configuration parameters that can be easily accessed and updated through workflows.
  2. User Preferences: Manage user-specific settings or preferences in a centralized local file, enabling personalized automation experiences.
  3. Data Retrieval for Automation: Retrieve specific data points during workflow execution to make dynamic decisions based on stored key-value pairs.

TL;DR

The Simple File-Based Key-Value Store (GetKey) workflow provides an efficient solution for managing and retrieving local key-value pairs within n8n. By following the straightforward setup and integration steps, users can enhance their automation processes with reliable local data access.

Help us find the best n8n templates

About

A curated directory of the best n8n templates for workflow automations.