Comments (14)
Ah yes n8n can listen to GET or POST request it receives. Simply look under the "Trigger" nodes for "Webhook". It allows you to specify what to listen for exactly and when and how to respond.
It can either respond directly as soon as it receives the webhook (to really just trigger a workflow to start) or it can return the data of the last node (json or binary).
Here a simple example workflow which writes text on an image depending on what was given via the query parameter. Hope it helps. If not simply get back to me. Want to launch the website with more example workflows the next days.
To test it simply press "Execute Workflow" and then visit the test URL which gets displayed in the node under "Webhook URLs". Make sure to save the workflow first as webhooks only work for saved workflows (as the workflow-id is part of the URL).
The URL will look like this:
http://localhost:5678/webhook-test//webhook/test?name=Jim
(You can simply attach the "?name=Jim" yourself.)
Simply copy & paste the following in an empty n8n workflow:
{
"nodes": [
{
"parameters": {
"path": "test",
"reponseMode": "lastNode",
"reponseData": "firstEntryBinary"
},
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
-100,
300
]
},
{
"parameters": {
"url": "https://www.needpix.com/file_download.php?url=//storage.needpix.com/thumbs/newspaper-412809_1280.jpg"
},
"name": "Read File URL",
"type": "n8n-nodes-base.readFileFromUrl",
"typeVersion": 1,
"position": [
100,
300
]
},
{
"parameters": {
"operation": "text",
"text": "=They found the killer it was {{$node[\"Read File URL\"].data[\"query\"][\"name\"]}}!",
"fontSize": "=25",
"positionX": 150,
"positionY": 180,
"lineLength": 18
},
"name": "Edit Image",
"type": "n8n-nodes-base.editImage",
"typeVersion": 1,
"position": [
300,
300
]
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Read File URL",
"type": "main",
"index": 0
}
]
]
},
"Read File URL": {
"main": [
[
{
"node": "Edit Image",
"type": "main",
"index": 0
}
]
]
}
}
}
from n8n.
Hi Jan
Thanks for that. I pasted the code in and it seems to create a workflow.
When I look at the Webhooks URL for test I get this URL:
http://localhost:5678/webhook-test/2/webhook/test
Via Postman I input this as the URL
http://localhost:5678/webhook-test/2/webhook/test?name=Stuart
Auth: None
HTTP Method: Post
Path: test
Response Mode: On Received 200 (how do I change this to give a 201 response to the send of the webhook?
Property Name: name (i changed this manually.
I then get this error on post:
{"code":404,"message":"The requested webhook is not registred.","stack":"ReponseError: The requested webhook is not
registred.\n at TestWebhooks.callTestWebhook
from n8n.
I finally got it to the point of waiting for the webhook-call.....
How do I keep it in persistent listening mode? As soon as it runs once it stops the webhook trigger from listening.
from n8n.
The test webhook does always just listens till it receives the first call and then displays that data in the editor UI as it is only for development and debugging. If you want that it keeps on listening, you have to activate the workflow (top right corner of the window).
If you do that you have to make sure that you use the production webhook URL and not the test one (does not have the "-test" in the URL).
from n8n.
Jan - thanks very much! it works.
Do you know how to change the OnReceived response from 200 to 201?
Do I have to configure it somewhere?
I currently get 200 response with this message:
{
"message": "Workflow got started."
}
from n8n.
On success it always returns 200, changing it to 201 is currently not possible. I can look how complicated it would be to make that configurable for the next release.
When you have "Response Mode" set to "On Received" it will always return just "Workflow got started". If you want to return something else you have to set it to "Last Node" and then make sure that the last node returns the data you want it to return.
from n8n.
Thanks Jan - much appreciated. Any plans to connect with the Quickbooks Online API?
from n8n.
You are welcome. Glad that it works now.
Actually want to have a connection to more or less every online service. Sadly does each integration take some time to create and my time is limited. So hope that the other people from the community (once it exists, some point after the proper launch) create more.
For now have planned to make it possible somewhere for people to suggest integrations and I will then create one after another with the most demand. Can inform you here once I have something in place.
Close the ticket for now as your problem seems to be solved.
from n8n.
Just released a new version of n8n (0.18.1) which includes the functionality to set a custom response code on the Webhook-Node.
from n8n.
Just released a new version of n8n (0.18.1) which includes the functionality to set a custom response code on the Webhook-Node.
Thanks Jan - I am going to test it
from n8n.
hi, it's me again =(
testing this sample, i'm receiving now:
Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:146:25)
at writeGeneric (internal/stream_base_commons.js:137:3)
at Socket._writeGeneric (net.js:698:11)
at Socket._write (net.js:710:8)
at doWrite (_stream_writable.js:428:12)
at writeOrBuffer (_stream_writable.js:412:5)
at Socket.Writable.write (_stream_writable.js:302:11)
at gm._spawn (/Users/gbastos/Development/ThirdParties/n8n/node_modules/gm/lib/command.js:253:18)
at /Users/gbastos/Development/ThirdParties/n8n/node_modules/gm/lib/command.js:140:19
at series (/Users/gbastos/Development/ThirdParties/n8n/node_modules/array-series/index.js:11:36)
am i missing any library for this specific node?
from n8n.
That is possible as the problem is in "gm" which is http://www.graphicsmagick.org/
So you should look that you get graphicsmagick installed and then also that problem is fixed and the "Edit Image" node should work.
from n8n.
thanks, that was what i thought.
now working but not writting the text indeed.
maybe some error in the lib yet?
another doubt, something in the build process should had installed it? do u think is interesting some way to learn node dependencies?
from n8n.
Sorry sadly can not really help there. Must be something graphicsmagick related in combination with MacOS. You can try some of their examples on the website via the commandline and see if they work.
The docker-image has everything included and there everything will run for sure. Self installing is always more problematic especially on systems that run MacOS. Would be suprised if everything would run perfectly as I do not have a Mac and it is known to make problems.
When n8n gets build it installs all the packages but not additional software and that is correct like that. Graphicsmagick is also just needed for that one node and that one is also more to show what can be done and playing around than something people are currently using for anything at all. But have to add somewhere that if people want to use that node they have to make sure that this package is installed.
from n8n.
Related Issues (20)
- This Code always crashes the Workspace - v1.29.1 HOT 3
- Query Parameters in MYSQL HOT 6
- postgresql node error not caught HOT 2
- Basic LLM Chain - Require Specific Output Format as Expression (not Fixed) Causes Crashing HOT 2
- Error Detail Missing in Execution View HOT 6
- bug: in editor-ui i18n dynamicRender isn't working as expected HOT 3
- Airtable Trigger - Fetch Test Event - Does Not Work HOT 5
- HTTP Request decode Mime Type: text/html; charset=ISO-8859-1 HOT 1
- Airtable Update Record - Refresh Column List Not Working - After New Fields Added HOT 1
- Nextcloud Folder List - Incorrect path HOT 2
- Clarify AWS S3 Object Copy popup help HOT 1
- AWS S3 Module Signature Calc Error with non-latin characters in key. Need to encodeURIComponent HOT 2
- Airtable Trigger - 429s Are Not Handled as Errors HOT 3
- AWS SES Template - ERROR: Bad request - please check your parameters HOT 1
- Youtube Upload - 400 Bad Request HOT 2
- Error SIMD unsupported on docker n8n container HOT 1
- Magento node store "view" option HOT 1
- [Docker - self hosted] Password verifies, but app returning "401 Unauthorized" errors HOT 5
- Wordpress create post - errors out on Author name or ID HOT 6
- Can not login with local ip address , had to go back to old version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from n8n.