Template Bundles? Exporting and Importing Workflows & Subworkflows

Following on from this conversation on Linkedin, I wondered how we might start sharing workflows with one or more subworkflows? My first thought was to use a simple approach with zip files. Curiosity got the better of me and I went ahead and built a proof of concept.


The Template

This template contains 2 separate workflows: one for exporting templates into a template bundle and the other for importing template bundle into a n8n instance.


How it works

Export Workflow

  1. User selects a template and this workflow finds all associated subworkflow templates
  2. The n8n node is then used to get the template JSONs of all workflows
  3. The JSON files are then bundled them up into a zip file. A metadata.txt is also added to track hierarchy of the main and sub-workflows.

Import Workflow

  1. The user uploads the zip file exported by the export workflow above
  2. This workflow extracts the template JSONs and uses the metadata.txt to figure out which is the main template
  3. All templates are imported into the n8n instance using the n8n node
  4. A second loop is used to link the newly created subworkflows to the newly created main workflow template.

Conclusion

This template was actually pretty simple to put together and I think bundling templates using zip is a very practical way of solving this problem in n8n.

Let me know if you’d use something like this!

If you’ve enjoyed this template, follow me on:

Check out my other posts on the community forum here - https://community.n8n.io/u/jim_le/activity/topics

1 Like