N8n Workflow And Credentials Backup
Periodically exports n8n workflows and credentials, detects changes via hash comparison.
ops and IT teams
What it does
You automatically back up your n8n workflows and credentials to local files every period. The system detects changes by comparing hash values and only commits updates to your GitHub repository when differences are found, ensuring you never lose critical data without a reason.
Step by step
- Configure a cron-based schedule trigger to initiate the backup process at regular intervals.
- Use the built-in HTTP request node or specific n8n API endpoints to export workflow and credential data as JSON.
- Apply an SHA-256 hash function to the exported JSON payload using a crypto utility node.
- Compare the newly generated hash against the stored previous hash to determine if changes occurred.
Where the LLM does the work
- Generate robust error handling logic for API timeouts or temporary n8n service unavailability during export.
- Draft clear commit messages that summarize the specific workflow changes detected in the diff process.
- Design a secure method to store and retrieve GitHub personal access tokens without hardcoding them in plain text.
Watch out for
Large workflow exports can exceed memory limits for the crypto node, so stream or chunk the data if possible.
Hash comparison might fail due to JSON formatting differences like whitespace, so normalize the JSON structure before hashing.
Tools that fit
The agent brief
Everything your agent needs, including the gotchas. Copy it and go.
You are helping me build the following AI agent workflow. ## Goal N8n Workflow And Credentials Backup: Periodically exports n8n workflows and credentials, detects changes via hash comparison. ## Specification - What it does: You automatically back up your n8n workflows and credentials to local files every period. The system detects changes by comparing hash values and only commits updates to your GitHub repository when differences are found, ensuring you never lose critical data without a reason. - Trigger: On a schedule (Scheduled · user-defined interval) - Autonomy: Fully hands-off - Expected setup effort: under an hour - Tools/services involved: - n8n: Workflow orchestration and export - GitHub: Storing backup files - Crypto: Generating SHA-256 hashes for change detection ## Known pitfalls, handle each one explicitly in your implementation 1. Large workflow exports can exceed memory limits for the crypto node, so stream or chunk the data if possible. 2. Hash comparison might fail due to JSON formatting differences like whitespace, so normalize the JSON structure before hashing. ## Reference implementation https://n8n.io/workflows/4609 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/n8n-workflow-and-credentials-backup/ via usecasesforagents.com
Frequently asked questions
Can I use a different Automation Platform than n8n?
Yes. n8n is only the example automation platform in this recipe. The same flow works with Home Assistant. Swap the automation platform connection and keep the rest of the setup as written.
Want this running in your business?
This is what I do. I design and build AI agents like this one, and keep them running. If you want it set up for your team instead of doing it yourself, get in touch.
Who it's for
Built for Ops-IT teams who need one more recurring task off a human's plate.