# How we can invoke/trigger the Node Red flow programmatically from Node JS app?

**URL:** https://discourse.nodered.org/t/how-we-can-invoke-trigger-the-node-red-flow-programmatically-from-node-js-app/85267
**Category:** General
**Tags:** http-request
**Created:** [6 February 2024 19:48 UTC](https://discourse.nodered.org/t/how-we-can-invoke-trigger-the-node-red-flow-programmatically-from-node-js-app/85267 "2024-02-06T19:48:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![akshay](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@akshay](https://discourse.nodered.org/u/akshay)
#### Post date: [6 February 2024 19:48 UTC](https://discourse.nodered.org/t/how-we-can-invoke-trigger-the-node-red-flow-programmatically-from-node-js-app/85267/1 "2024-02-06T19:48:03Z")

</div>

Hi there,

We have embedded the Node-Red into existing Node JS with an express framework app & we wanted to make a sync call to the flow programmatically (without HTTP call) from the same app. Is this something possible?

If Not, then what is the right approach to make a sync call to Node-Red flow?

Thanks.

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [6 February 2024 22:06 UTC](https://discourse.nodered.org/t/how-we-can-invoke-trigger-the-node-red-flow-programmatically-from-node-js-app/85267/2 "2024-02-06T22:06:15Z")

</div>

Welcome to the forums @akshay

You might need to explain what you mean by **sync call to the flow programmatically**  
the methods are already provided.

- HTTP
- MQTT
- TCP
- etc etc

all of which will trigger a process in your flow.

Having the flow call into your host application however, is achievable enough (I think)

Your Node Application :

```auto

const Bridge = () => {
    return {
        someMethod: function() {}
    }
}

const settings = {
    ...
    functionGlobalContext: {
        Host: Bridge()
    }
};

...
RED.init(server,settings);
...

```

Some Function Node in Node RED :

```auto
global.get('Host').someMethod()

```

**EDIT**  
You could use the above approach to pass to the host application a method provided by a `function` node (to be called by your Host app), but it could get messy really quickly.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [6 May 2024 22:06 UTC](https://discourse.nodered.org/t/how-we-can-invoke-trigger-the-node-red-flow-programmatically-from-node-js-app/85267/3 "2024-05-06T22:06:24Z")

</div>

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