How to share sub-flows as Pallet?

Hi our team is currently working on a project where we have created few sub-flows for specific functions. We share sub-flows through JSON as of now.
But we are thinking to move to sharing the sub-flows where it cannot be edited/changed to prevent any issue.
So I am curious to know if there is any way we can share them by converting it to a pallet (such as function, http etc.) without publishing it publicly as of now.
Or is there any imminent feature to be added in Node-RED which might help in this regard?

Welcome to the forum @Arnab

Generally it is best to start with the official Node-RED documentation.

https://nodered.org/docs/creating-nodes/subflow-modules

1 Like

Hi @TotallyInformation Thank you.
I have tried to convert a sub-flow to a node with this method.

The issue i am facing is that the input and output nodes are not showing on the converted node.
image
Can you please help me with what I have to do to have the input/output working?

Previously it was like this:
image

Hi,

I've never tried to share sub-flows that way but have used them extensively.

The input / output 'ports' (connection points) are controlled in the subflow properties dialog:

Set input = 1 and output = however many are needed / relevant.

I hope that helps.

Cheers,

Paul

You shouldn't need to anything beyond what the docs describe.

Can you share a copy of the subflow json you've created using the instructions in the docs?

Here it it, stripped down the code a little bit:

{
  "id": "31ac1d10.6d4e72",
  "type": "function",
  "z": "a426e26b.67424",
  "name": "Create Postprocessing Info",
  "func": "return msg;",
  "outputs": 1,
  "noerr": 0,
  "initialize": "",
  "finalize": "",
  "libs": [],
  "x": 320,
  "y": 80,
  "wires": [[]],
  "flow": [
    {
      "id": "a426e26b.67424",
      "type": "subflow",
      "name": "Create Postprocessing Info",
      "info": "",
      "category": "SPPA",
      "in": [{ "x": 40, "y": 80, "wires": [{ "id": "31ac1d10.6d4e72" }] }],
      "out": [
        { "x": 580, "y": 80, "wires": [{ "id": "31ac1d10.6d4e72", "port": 0 }] }
      ],
      "env": [{ "name": "Name", "type": "str", "value": "Processor" }],
      "meta": {
        "module": "create-postprocessing-info",
        "version": "1.1.0",
        "author": "...",
        "desc": "A node to stack up the msg.Message.IoT structure with a describing name and timestamp when the node was passed."
      },
      "color": "#6090ff"
    }
  ]
}


Hi @Arnab

that JSON is not correct. You have a function node at the top level and the subflow node inside the flow property. It should be the other way around.

1 Like

Hi @knolleary it worked! Thank you a lot.