Site icon JD Bots

n8n Tutorial — Part 4: Webhooks: Start a Workflow from Any App

Card titled Start a Workflow from Any App, labelled n8n Tutorial Part 4 Webhooks, showing a lightning bolt, a table and a reply arrow linked in a row, with the notes POST /webhook/orders, Test URL then Production URL, and Replies with the saved order.

An n8n webhook is a web address that starts a workflow. Any app that can send a web request, such as an online shop, a form service or your own code, can call it and hand over its data, and n8n can answer straight back.

In this part you start an n8n workflow from outside n8n with the Webhook node. You build an order webhook for a small bookshop: each order the shop sends is saved in a data table, and n8n replies with the saved order. You test it with the Test URL, publish it, switch to the Production URL, and see why a webhook has both.

This is Part 4 of the n8n Tutorial. The parts in Module B, Workflow Basics:

All parts of the n8n Tutorial

Module A: Start Here

Module B: Workflow Basics

Module C: Working with Data

  • Part 9: Items and JSON: How Data Moves in n8n
  • Part 10: Expressions: Use Data from Earlier Nodes
  • Part 11: Transform Data
  • Part 12: Filter and Compare Data
  • Part 13: Dates and Times
  • Part 14: Files: CSV, Excel and PDF
  • Part 15: Data Tables: Store Data Inside n8n

Module D: Flow Logic

  • Part 16: If and Switch: Make Decisions
  • Part 17: Merge: Combine Branches
  • Part 18: Loops and Batches
  • Part 19: Wait and Human Approval
  • Part 20: Sub-workflows
  • Part 21: Error Handling

Module E: Code and APIs

  • Part 22: HTTP Request: Call Any API
  • Part 23: The Code Node in JavaScript
  • Part 24: The Code Node in Python

Module F: AI with Claude

  • Part 25: Your First AI Agent
  • Part 26: Give Your Agent Tools
  • Part 27: Memory That Lasts
  • Part 28: Answer from Your Documents
  • Part 29: AI Chains: Summarize, Classify and Extract
  • Part 30: Human in the Loop and Guardrails
  • Part 31: MCP in n8n
  • Part 32: Evaluations: Test Your AI Workflows
  • Part 33: Free Local AI with the Self-Hosted AI Starter Kit
  • Part 34: An n8n Agent in Microsoft Teams

Module G: Connect Apps and Extend n8n

  • Part 35: Connect Popular Apps with OAuth2
  • Part 36: Community Nodes
  • Part 37: Build Your Own Node
  • Part 38: Programmatic Nodes and Publishing
  • Part 39: The n8n API and CLI
  • Part 40: Build Workflows in Code with the Workflow SDK

Module H: Self-Hosting for Production

  • Part 41: Configure n8n with Environment Variables
  • Part 42: Run n8n on PostgreSQL
  • Part 43: Queue Mode and Workers
  • Part 44: Task Runners and Security
  • Part 45: Back Up, Restore and Update n8n
  • Part 46: Logs, Metrics and Tracing
  • Part 47: Put n8n Online with HTTPS

Module I: Users and Administration

  • Part 48: Users, Roles and Two-Factor Authentication

Module J: n8n Cloud

  • Part 49: Start an n8n Cloud Free Trial
  • Part 50: AI Workflow Builder, Assistant and Gateway Credits

Module K: Wrap-up

  • Part 51: Final Project, Cheat Sheet and What to Learn Next

Cost: free. Everything here runs on your own n8n Community Edition.

Every command, screen and output on this page is real, run with n8n 2 in Docker on macOS.

Get the Source Code

Get the complete source code of Order Webhook for n8n on Dewiride Store →
It’s the finished, tested version of this part’s order webhook, with a secret key, a check on every order, clear replies, a one-click table setup and n8n in Docker.

What You’ll Build

An order webhook: a workflow at the address /webhook/orders that takes an order sent as JSON (customer, book and quantity), adds it to a data table named Orders, and replies with the saved order and its new id. You send the orders from the terminal with curl, the way a shop’s website would. You start from n8n running on your computer.

Prerequisites

Step 1: Create the Orders Table

Create a data table named Orders with three columns: customer and book of type string, and quantity of type number. How to Create a Data Table in n8n shows each click.

The Orders table, ready for orders.

Step 2: Add a Webhook Trigger

Click + at the top of the left sidebar, then New workflow, and name it New order webhook. Click Add first step, then On webhook call.

The Webhook node opens. Set HTTP Method to POST, the method apps use to send data, and replace the random Path with orders. Leave Respond at Immediately for now; Step 5 changes it.

POST to the path orders, answering immediately for now.

At the top, Webhook URLs shows the address other apps call. It comes in two versions: the Test URL, http://localhost:5678/webhook-test/orders, for building and testing, and the Production URL for the published workflow (Step 7).

Step 3: Send a Test Order with curl

Click Listen for test event. n8n now waits for one call to the Test URL, for up to 120 seconds (n8n’s webhook docs).

Open Terminal (press ⌘ Space, type Terminal and press Return) and send an order with curl, a tool for web requests that comes with macOS:

Terminal

curl -X POST http://localhost:5678/webhook-test/orders -H "Content-Type: application/json" -d '{"customer": "Asha Rao", "book": "A Map of Quiet Places", "quantity": 2}'

In that command, -X POST sends a POST request, -H says the data is JSON, and -d is the order itself. n8n answers at once, because Respond is Immediately:

Output

{"message":"Workflow was started"}

In n8n, the node’s OUTPUT shows what arrived: the request’s headers, the query parameters (none here), and the order itself under body.

The order arrived under body.

Step 4: Save the Order in the Table

Close the panel. Add a Data table node after the Webhook, choose the Insert row action and pick Orders as the data table. Its three columns appear under Values to insert.

In the INPUT panel, open body and drag customer, book and quantity onto the columns with the same names. n8n turns each into an expression, such as {{ $json.body.customer }}, and shows the value from the test order under it.

Each column reads its value from the body.

Click Execute step. The row is saved, and the OUTPUT shows it with the id the table gave it. Testing this step writes a real row.

The saved order, with the id the table gave it.

Step 5: Reply with the Saved Order

Close the panel and add a Respond to Webhook node after Insert row. This node sends the webhook’s answer. Keep Respond With at First Incoming Item: the answer is the row that the Data table node just saved.

The answer is the first item it receives: the saved row.

The yellow note matters: the Webhook still answers on its own. Close the panel, open the Webhook node and set Respond to Using ‘Respond to Webhook’ Node, as n8n’s Respond to Webhook docs describe.

The Webhook now waits for the Respond to Webhook node.

Step 6: Test the Whole Workflow

Close the panel and click Execute workflow. The Webhook waits for a call to the Test URL:

Execute workflow makes the Webhook wait for one call.

Send a second order:

Terminal

curl -X POST http://localhost:5678/webhook-test/orders -H "Content-Type: application/json" -d '{"customer": "Ravi Menon", "book": "Salt and Starlight", "quantity": 1}'

This time the answer comes from Respond to Webhook: the order as it was saved, with its id. createdAt is the time it was saved, in UTC (the Z at the end).

Output

{"customer":"Ravi Menon","book":"Salt and Starlight","quantity":1,"id":2,"createdAt":"2026-11-21T13:38:12.157Z","updatedAt":"2026-11-21T13:38:12.157Z"}

All three nodes are green, each with 1 item:

Every node ran once.

Step 7: Publish and Use the Production URL

The Test URL only works while the editor listens. For apps to call your webhook at any time, publish the workflow: click Publish, then Publish in the dialog. n8n confirms it and explains where production calls show up:

Production calls go to the execution list.

Open the Webhook node and click Production URL. It’s the same address without -test:

The Production URL drops -test from the address.

Send a third order to it. There’s nothing to click first: a published webhook answers whenever n8n is running.

Terminal

curl -X POST http://localhost:5678/webhook/orders -H "Content-Type: application/json" -d '{"customer": "Leela Iyer", "book": "A Map of Quiet Places", "quantity": 1}'

Output

{"customer":"Leela Iyer","book":"A Map of Quiet Places","quantity":1,"id":3,"createdAt":"2026-11-21T13:40:29.036Z","updatedAt":"2026-11-21T13:40:29.036Z"}

Production runs don’t appear on the canvas. Close the panel and open the Executions tab: the newest run is the production call, and the runs with a flask icon were your tests.

The production run at the top; the flasks mark test runs.

Open the Orders table: the three orders are there, one per row.

One row per order.

Clean Up

Unpublish the workflow so the webhook stops answering, then archive and delete it from its ⋯ menu. Delete the Orders table from the Data tables tab, as the data table guide shows. Deleting either can’t be undone.

Common Mistakes

MistakeWhat happensDo this instead
Calling the Test URL without clicking Listen for test event or Execute workflow firstn8n answers with a 404 error: the webhook isn’t registeredClick one of them, then call within 120 seconds
Giving another app the Test URLIt works for one call while you’re listening, then stopsPublish the workflow and give apps the Production URL
Leaving the random PathThe address ends in a long random IDSet a short path, such as orders

Troubleshooting

ProblemCauseFix
The requested webhook "orders" is not registered. (404)The Test URL isn’t listeningClick Execute workflow and call again, or publish and use the Production URL
The answer is {"message":"Workflow was started"} instead of the orderRespond is set to ImmediatelySet Respond to Using ‘Respond to Webhook’ Node (Step 5)
A production call doesn’t show on the canvasProduction runs aren’t shown in the editorOpen the Executions tab

FAQ

What’s the difference between the Test URL and the Production URL?

The Test URL answers only while the editor listens, for one call, and shows the data on the canvas. The Production URL answers whenever the workflow is published, and its runs appear in the Executions tab. n8n’s common issues page compares the two.

Can apps on other computers call this webhook?

Not with a localhost address: localhost always means the computer the request comes from. To take calls from the internet, n8n has to run at a public address, which a later part of this tutorial covers.

How do I stop strangers from calling my webhook?

Set Authentication on the Webhook node. With Basic auth, Header auth or JWT auth, a call is accepted only when it carries the secret you set, as n8n’s Webhook docs explain.

How much data can a webhook receive?

Up to 16 MB per call by default. On self-hosted n8n, the N8N_PAYLOAD_SIZE_MAX setting changes the limit (n8n’s Webhook docs).

Conclusion

A webhook turns a workflow into an address other apps can call. You built one that saves each order and replies with it, tested it through the Test URL while building, and published it so the Production URL answers on its own. The same pattern works for any app that can send a web request: payments, form services, chat tools or your own code.

← Part 3: Run a Workflow on a Schedule

Coming next: Part 5: Forms: Collect Data with n8n Forms.

Additional Resources

n8n and other names mentioned are trademarks of their respective owners. JD Bots isn’t affiliated with or endorsed by n8n GmbH.

Exit mobile version