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.

Hi @marcus ,
@abhilash and i have tried this approach but still it not working. so, can you please check the below approach and suggest me if i am making any mistake while adding custom workflows.
I am attaching workflow.json file:

{
  "name": "My workflow 3",
  "nodes": [
    {
      "parameters": {},
      "id": "f1286566-42e8-4be2-acfe-4fe3defe2d09",
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {},
      "id": "f7de5b6b-af43-44da-8fd6-57a268c2cbde",
      "name": "ExecuteBot",
      "type": "n8n-nodes-base.ExecuteBot",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {},
      "id": "770a63b8-f975-49e0-b8ae-4099a8fc23cf",
      "name": "GetBotStatus",
      "type": "n8n-nodes-base.GetBotStatus",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "ExecuteBot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ExecuteBot": {
      "main": [
        [
          {
            "node": "GetBotStatus",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {},
  "id": 4,
  "meta": {
    "instanceId": "b306a0f91122f56a8d0effb72ac0c68ea442a554aab598a5ae1eb61a82de2132"
  },
  "tags": []
}```

Thanks & Regards
Tanay

Hey @Tanay_Acro,

Welcome to the community :cake:

Would you be able to open a new thread and fill out the template provided so we can get all of the information we need. It could be that there has been some changes in the last 3 months to how this would be solved.