Add additional logic on POST /flows request


I would like to intercept the POST /flows API request (at runtime) and add additional logic before its sending a respond to the editor.
After looking at the docs I wasn't able to find hooks or other options to active this behavior.

Currently the only way I was able to detect the request is by accessing the RED.server (NodeRed node http server) object like this:

RED.server.on("request", (req, res) => {  ... })

But I'm unable to make it wait for my logic to finish.

Any Ideas will be welcome.

I Found a way to intercept the setFlow action although very hacky

import RED from 'node-red';


const setFlowOrg: Function = (RED as any).runtime.flows.setFlows;
const flowThis: any = (RED as any).runtime.flows;

(RED as any).runtime.flows.setFlows = async ( any[]) => {
  const res = await setFlowOrg.apply(flowThis, data);
  return res; 

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.