Skip to main content
RapidDev - Software Development Agency
n8n-tutorial

How to Create a Webhook in n8n

Create a webhook in n8n by adding a Webhook node as the first node in your workflow. Set the HTTP method, path, and authentication. Use the test URL for development and the production URL for live integrations. Configure the response mode to control when and what the caller receives back.

What you'll learn

  • How to add and configure a Webhook node in n8n
  • The difference between test and production webhook URLs
  • How to set authentication on webhooks for security
  • How to configure response modes to control what the caller receives
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate6 min read10-15 minutesn8n 1.0+, all deployment methodsMarch 2026RapidDev Engineering Team
TL;DR

Create a webhook in n8n by adding a Webhook node as the first node in your workflow. Set the HTTP method, path, and authentication. Use the test URL for development and the production URL for live integrations. Configure the response mode to control when and what the caller receives back.

How Webhooks Work in n8n

A webhook lets external services trigger your n8n workflow by sending an HTTP request to a URL. When the request arrives, n8n starts the workflow and passes the request data (headers, body, query parameters) to the next node. n8n provides two webhook URLs for every webhook node: a test URL that only works while you have the workflow open in the editor, and a production URL that works when the workflow is active. Understanding this distinction is essential for reliable integrations.

Prerequisites

  • A running n8n instance (Docker, npm, or cloud)
  • Access to the n8n editor in your browser
  • A tool to send HTTP requests for testing (curl, Postman, or a browser)

Step-by-step guide

1

Add a Webhook node as the workflow trigger

Open the n8n editor and create a new workflow. Click the plus button to add a node. Search for 'Webhook' and select it. The Webhook node must be the first node in your workflow — it serves as the trigger. Once added, click on the node to configure it.

Expected result: A Webhook node appears on the canvas as the starting node of your workflow.

2

Configure the HTTP method and path

In the Webhook node settings, set the HTTP Method to match what the calling service sends. POST is the most common choice for receiving data. GET works for simple triggers. Set the Path to a descriptive name like /my-webhook or /order-created. This path becomes part of the URL. Avoid special characters and spaces in the path.

Expected result: The Webhook node shows the configured method and path, and displays both the test and production URLs.

3

Understand test versus production URLs

n8n generates two URLs for every webhook. The test URL (containing /webhook-test/) only works when you click 'Listen for test event' in the editor. It is designed for development and debugging. The production URL (containing /webhook/) only works when the workflow is activated (toggled on). Always use the production URL in external service configurations. The test URL stops working the moment you close the editor tab.

Expected result: You understand that /webhook-test/ is for development and /webhook/ is for production, and each requires different conditions to work.

4

Test the webhook with a sample request

Click 'Listen for test event' in the Webhook node. The node enters listening mode. Open a terminal or Postman and send a request to the test URL. For a POST webhook, send a JSON body. Once n8n receives the request, it stops listening and shows the received data in the output panel. Inspect the data to verify headers, body, and query parameters are captured correctly.

typescript
1# Send a test request with curl
2curl -X POST https://your-n8n-domain.com/webhook-test/my-webhook \
3 -H "Content-Type: application/json" \
4 -d '{"name": "Test User", "action": "signup"}'

Expected result: The Webhook node receives the request and displays the JSON body, headers, and query parameters in the output panel.

5

Set the response mode

The Response Mode determines when and what the webhook sends back to the caller. There are three options: 'Immediately' returns a 200 OK right away (the workflow continues in the background), 'When Last Node Finishes' waits for the entire workflow to complete and returns the last node's output, and 'Using Respond to Webhook Node' lets you control the response with a dedicated node anywhere in the workflow. Choose 'Immediately' for fire-and-forget integrations, and 'When Last Node Finishes' when the caller needs the result.

Expected result: The webhook responds to callers according to the selected mode.

6

Activate the workflow for production use

Once your webhook and workflow are tested, toggle the workflow to Active using the switch in the top-right corner of the editor. The production webhook URL is now live and will trigger the workflow on every incoming request. The test URL stops working once you close the editor. Verify the production URL by sending a request and checking the execution history.

Expected result: The workflow is active and the production webhook URL triggers the workflow on each incoming request.

Complete working example

test-webhook.sh
1#!/bin/bash
2# Test script for n8n webhook
3# Replace YOUR_N8N_URL with your actual n8n instance URL
4
5N8N_URL="https://your-n8n-domain.com"
6WEBHOOK_PATH="my-webhook"
7
8# --- Test URL (only works with editor open + listening) ---
9echo "Testing webhook-test URL..."
10curl -s -X POST "${N8N_URL}/webhook-test/${WEBHOOK_PATH}" \
11 -H "Content-Type: application/json" \
12 -d '{
13 "event": "test",
14 "user": {
15 "name": "Jane Doe",
16 "email": "jane@example.com"
17 },
18 "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
19 }'
20
21echo ""
22echo "---"
23
24# --- Production URL (only works with workflow active) ---
25echo "Testing production webhook URL..."
26curl -s -X POST "${N8N_URL}/webhook/${WEBHOOK_PATH}" \
27 -H "Content-Type: application/json" \
28 -d '{
29 "event": "order_created",
30 "order_id": 12345,
31 "items": [
32 {"product": "Widget A", "quantity": 2},
33 {"product": "Widget B", "quantity": 1}
34 ],
35 "total": 59.97
36 }'
37
38echo ""
39echo "Done."

Common mistakes when creating a Webhook in n8n

Why it's a problem: Using the test URL (/webhook-test/) in production integrations

How to avoid: The test URL only works while the editor is open and listening. Use the production URL (/webhook/) and activate the workflow.

Why it's a problem: Sending requests to the production URL before activating the workflow

How to avoid: Toggle the workflow to Active in the top-right corner of the editor. The production URL only responds when the workflow is active.

Why it's a problem: Not setting the WEBHOOK_URL environment variable behind a reverse proxy

How to avoid: Set WEBHOOK_URL to your public URL (e.g., https://n8n.yourdomain.com) so n8n generates correct webhook URLs.

Why it's a problem: Expecting the webhook to return workflow results with Response Mode set to 'Immediately'

How to avoid: Change the Response Mode to 'When Last Node Finishes' or add a Respond to Webhook node to return specific data.

Best practices

  • Always use the production URL (/webhook/) in external service configurations, never the test URL
  • Set a descriptive webhook path like /order-created or /github-push instead of random strings
  • Use POST for webhooks that receive data and GET for simple ping or health check triggers
  • Add authentication (Basic Auth, Header Auth, or JWT) for any webhook exposed to the internet
  • Set the WEBHOOK_URL environment variable so n8n generates correct URLs behind reverse proxies
  • Use 'Respond Immediately' for integrations that require a fast acknowledgment (like Slack or GitHub)
  • Log incoming webhook data to help debug integration issues
  • Test with the test URL first, then activate and verify the production URL

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

How do I create a webhook in n8n that receives POST requests with JSON data? I need to understand the difference between test and production URLs and how to configure the response mode.

n8n Prompt

Create an n8n workflow with a Webhook trigger node that accepts POST requests at /order-created. Set the response mode to 'When Last Node Finishes' so the caller gets the processed result. Add Basic Auth for security.

Frequently asked questions

Why does my webhook return 404 Not Found?

The production URL returns 404 if the workflow is not active. Activate the workflow first. The test URL returns 404 if you are not in listening mode. Click 'Listen for test event' in the Webhook node.

Can I have multiple webhooks in one workflow?

No. Each workflow can have only one Webhook trigger node. If you need multiple endpoints, create separate workflows and use the Execute Workflow node to share logic between them.

How do I access query parameters from the webhook URL?

Query parameters are available at {{ $json.query }} in the Webhook node output. For example, a request to /webhook/path?status=active makes {{ $json.query.status }} equal to 'active'.

Can I change the webhook path after the workflow is active?

Yes, but you must update all external services that send requests to the old URL. The old path stops working immediately when you save the change.

What happens if the webhook receives a request while the workflow is executing a previous one?

Each webhook request creates a new independent execution. n8n handles concurrent requests. If you need to limit concurrency, use queue mode with the N8N_CONCURRENCY_PRODUCTION_LIMIT setting.

Does the webhook URL change if I restart n8n?

No. The webhook URL is based on the path you configure. It remains the same across restarts as long as the WEBHOOK_URL environment variable and path are unchanged.

Can RapidDev help me set up webhook integrations with n8n?

Yes. RapidDev can design and implement webhook-based workflows in n8n, including authentication, error handling, and integration with external APIs and services.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.