Who is this workflow for? The WriteKey workflow enables you to store key-value pairs in a local JSON file within your n8n environment. This setup allows multiple keys to be managed within a single file, facilitating efficient data storage and retrieval without the need for external databases..

What does this workflow do?

  • Setup Local Storage Directory:
  • Create a subfolder named local-files in your n8n home directory (/home/node/.n8n/local-files).
  • If using Docker, locate the data path and create the local-files subfolder there.
  • Set appropriate access rights using the command: chmod 1000:1000 local-files.
  • Implement the WriteKey Workflow:
  • Create a new workflow in n8n named WriteKey.
  • Insert the provided workflow code into this new workflow to handle writing key-value pairs to the JSON file.
  • Create a Data Input Workflow:
  • Build another workflow incorporating a Function Item node.
  • Configure the Function Item node to output the desired key-value data in the following format: javascript return { file: '/4711.json', // Replace 4711 with your workflow ID key: 'MyKey', value: 'MyValue' };
  • Connect to Execution Workflow:
  • Link the Function Item node to an Execution Workflow node.
  • Configure the Execution Workflow node to call the WriteKey workflow, passing the key-value data for storage.
  • Future Enhancements:
  • Anticipate the development of a dedicated n8n node for key-value storage to streamline this process further.

🤖 Why Use This Automation Workflow?

  • Local Data Management: Maintain and access key-value pairs locally without relying on external services.
  • Simplicity: Easily store and retrieve data using straightforward JSON file manipulation.
  • Integration: Seamlessly works with existing n8n workflows, enhancing data handling capabilities.

👨‍💻 Who is This Workflow For?

This workflow is ideal for developers and users of n8n who need a lightweight solution for managing configuration settings, temporary data storage, or simple data persistence tasks within their automation processes.

🎯 Use Cases

  1. Configuration Management: Store and retrieve application settings or configuration parameters locally.
  2. Temporary Data Storage: Maintain temporary data between workflow executions without using external databases.
  3. User Preferences: Save user-specific preferences or settings in a centralized JSON file for easy access and modification.

TL;DR

The WriteKey workflow provides a straightforward method for storing key-value pairs in a local JSON file within your n8n environment. By setting up this workflow, you can efficiently manage and persist data locally, enhancing your automation processes with minimal setup and maintenance.

Help us find the best n8n templates

About

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