# Trigger a flow from external call (QUESTION)

**URL:** https://discourse.nodered.org/t/trigger-a-flow-from-external-call-question/9128
**Category:** General
**Created:** [18 March 2019 14:05 UTC](https://discourse.nodered.org/t/trigger-a-flow-from-external-call-question/9128 "2019-03-18T14:05:44Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![defremont](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/defremont/32/6893_2.png) [@defremont](https://discourse.nodered.org/u/defremont)
#### Post date: [18 March 2019 14:05 UTC](https://discourse.nodered.org/t/trigger-a-flow-from-external-call-question/9128/1 "2019-03-18T14:05:44Z")

</div>

Hello everyone, i'm new on node-red and trying to integrate this with a Hyperledger Client (that is baiscally Angular 4) and i need to **send an email** when the user **send a transaction** on hyperledger.

In the docs of Hyperledger ([https://hyperledger.github.io/composer/v0.16/integrating/call-out](https://hyperledger.github.io/composer/v0.16/integrating/call-out) - on example bellow), they say that is possible to "call Node-RED running on Bluemix", well, i run my own instance of local node-red, build a flow that start with a injection but i can't figure out:

**How to trigger that like they do in docs?**

I can't figure out too if is possible and how trigger this flow from Angular client (with something like a GET/POST request from client to node-red.)

Here my flow:  
 ![Screenshot%20from%202019-03-18%2011-03-15](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/093a394fa5dcab1815ae39821e67ed2099231901.png)  
(The flow actually works if clicked)

Thank you all! and sorry if is a bad question.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [18 March 2019 14:11 UTC](https://discourse.nodered.org/t/trigger-a-flow-from-external-call-question/9128/2 "2019-03-18T14:11:14Z")

</div>

Hi @defremont

You can use the HTTP nodes to create a flow that can be triggered by http requests. The cookbook has a number of useful examples: [https://cookbook.nodered.org/http/](https://cookbook.nodered.org/http/)

The problem you may face is whether whatever is making the HTTP request is able to 'see' your instance of Node-RED. If you are running it locally, you presumably mean on your local network. That means it is not visible to the wider internet.

---

<div class="post-metadata">

### Author: ![defremont](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/defremont/32/6893_2.png) [@defremont](https://discourse.nodered.org/u/defremont)
#### Post date: [18 March 2019 14:23 UTC](https://discourse.nodered.org/t/trigger-a-flow-from-external-call-question/9128/3 "2019-03-18T14:23:58Z")

</div>

Thank you @knolleary, reading these docs right now..

About the problem, the HTTP request will be triggered by a function in the smart contract running locally too, so i think this will works even the users trigger from published client of this server.

By the way, is just a proof of work, not production version.

Thanks again!

---

<div class="post-metadata">

### Author: ![defremont](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/defremont/32/6893_2.png) [@defremont](https://discourse.nodered.org/u/defremont)
#### Post date: [19 March 2019 18:10 UTC](https://discourse.nodered.org/t/trigger-a-flow-from-external-call-question/9128/4 "2019-03-19T18:10:33Z")

</div>

Ok, now when i click the test button, nothing happens.

the node-red config

 ![Screenshot%20from%202019-03-19%2015-08-08](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/bbfd5744e820eeb00437c091625d653105d171fb.png)

test button function:

test(){  
this.http.get('[http://127.0.0.1:1880/hello](http://127.0.0.1:1880/hello)');

```
}
```

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [19 March 2019 18:50 UTC](https://discourse.nodered.org/t/trigger-a-flow-from-external-call-question/9128/5 "2019-03-19T18:50:03Z")

</div>

In a situation like this it is very helpful if you [provide your flow](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506), espically as you say this is just a test.

Also provide  
os platform and release  
versions of NR and node.js

Also where is this button you are pressing?

P.S. having just installed the `Create an HTTP Endpoint` flow on my local machine, when I click the link in your post, the `Hello World` is returned

---

<div class="post-metadata">

### Author: ![defremont](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/defremont/32/6893_2.png) [@defremont](https://discourse.nodered.org/u/defremont)
#### Post date: [19 March 2019 19:19 UTC](https://discourse.nodered.org/t/trigger-a-flow-from-external-call-question/9128/6 "2019-03-19T19:19:38Z")

</div>

Using Ubuntu 16.04 LTS  
node 8.15  
npm 6.4,  
Node-RED 0.20.2  
I'm triggering from a Angular 4 app  
The flow:  
`[{"id":"35dcdbd9.a99684","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"dcdb9a4e.db2eb8","type":"debug","z":"35dcdbd9.a99684","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":450,"y":180,"wires":[]},{"id":"aa98d38f.846af","type":"e-mail","z":"35dcdbd9.a99684","server":"smtp.gmail.com","port":"465","secure":true,"tls":true,"name":"andre.def93@gmail.com","dname":"","x":500,"y":320,"wires":[]},{"id":"f1aea493.ec0e78","type":"http response","z":"35dcdbd9.a99684","name":"","statusCode":"","headers":{},"x":670,"y":260,"wires":[]},{"id":"747c3f58.892dd","type":"http in","z":"35dcdbd9.a99684","name":"","url":"/hello","method":"get","upload":false,"swaggerDoc":"","x":120,"y":260,"wires":[["dcdb9a4e.db2eb8","aa98d38f.846af","f1aea493.ec0e78"]]}]`

**My component.ts:**

```auto
[...]

import { Http } from '@angular/http';
[...]
constructor(
        private http: Http,
[...]
    ) { }
[...]
test(){
       this.http.get('http://127.0.0.1:1880/hello');
    }

```

**My component.html:**

```auto
[...]

                <button class="primary" (click)="test()">
            <div *ngIf="!issueInProgress">
                <span>TEST</span>
            </div>
        </button>
[...]

```

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [19 March 2019 21:26 UTC](https://discourse.nodered.org/t/trigger-a-flow-from-external-call-question/9128/7 "2019-03-19T21:26:54Z")

</div>

Well I can't help you with the Angular app, but the flow is working fine. So your reall question should be "In an Angular 4 App, how do I link to an internal/external site." Once you can get thaat going, getting to NR will be easy. But I think you will need to ask that on a n Angular form....

---

<div class="post-metadata">

### Author: ![defremont](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/defremont/32/6893_2.png) [@defremont](https://discourse.nodered.org/u/defremont)
#### Post date: [20 March 2019 00:23 UTC](https://discourse.nodered.org/t/trigger-a-flow-from-external-call-question/9128/8 "2019-03-20T00:23:23Z")

</div>

Thanks for you time. Is great to know that my NR code is fine. all the tips helped me.  
Now i will find some solutions about Angular.
