How to add custom workflow into workflow template as default workflow

Hi @marcus,
we want to add our workflow into workflow templates.
I am attaching the image for reference.
Please can you tell how can we add our workflow into workflow template as collections.

Thanks
Abhilash

Hi @abhilash,
to add your own collection of workflow templates you would need to recreate our workflow template api, meaning developing your own template api. We can find some documentation about the process here.

To look into what our template api is returning you can checkout these urls

If you do that you can set your own template host url using the Environment Variable N8N_TEMPLATES_HOST.

An alternative would be looking into our editor-ui client code that is loading the template workflows, collections and categories from our api. You could inject your custom workflows here if you don’t want to develop your own template backend.

1 Like

Thanks @marcus for quick reply.
I will check the above links.

1 Like

Hi @marcus,
Can you please provide if any document is there, for editor-ui code. It will be helpful how we can inject our custom workflow without creating own template backend.
Or any document which you think is helpful.

Thanks & Regards,
Abhilash

Hi @marcus,
Suppose I want to disable few workflows and nodes from that default workflows present in n8n template and n8n, how can I do?
please share document if any.

Thanks & Regards
Abhilash

Hi @abhilash,
for my proposal to use n8n/packages/editor-ui/src/api/templates.ts to inject your own workflow json we do not have any documentation available. If you would go down that road I would start with one workflow.json file added to the repository and trying to inject it into the necessary api responses. Some things you need to be aware of

  • Your workflow template ids shouldn’t collide with ours
  • You need to add your workflow to multiple responses like getWorkflows() or getTemplateById()
  • You may want your workflow to be searchable - see getWorkflows(search: string)
  • You may want to add your workflow to collections and categories

This might be an alternative for you if you only want add a couple of workflows to our template api.

To disable nodes you can use the Env Variable NODES_EXCLUDE to list all the nodes you want to exclude.

An example docker run command would look like this

docker run -it --rm -p 5678:5678 --name n8n -e NODES_EXCLUDE='["n8n-nodes-base.executeCommand","n8n-nodes-base.ssh"]' n8nio/n8n:0.190.0

This would disable the “Execute Command” and “SSH” nodes. You can find the values in the codex json files here and here.

If you want to disable workflows templates you would need to remove the according response entries from our /templates api calls.

(post deleted by author)