n8n Webhook Tutorial: Create, Test, and Secure a Webhook
Learn how to create an n8n webhook, send it JSON data, choose between test and production URLs, and connect incoming requests to useful automations.
- Beginner-friendly POST example
- GET, JSON, and response basics
- Security and common fixes
What is an n8n webhook?
A URL that lets another service start your workflow.
An n8n webhook is an HTTP endpoint created by the Webhook node. An external app can send a request to that URL when something happens, and n8n can start a workflow with the request data.
For example, a website form can send a new enquiry to n8n. The workflow can check the fields, save the enquiry to Google Sheets, notify your team in Telegram, or pass selected information to an AI step.
The Webhook node receives the request. If you need to control what the caller gets back, configure its response behavior or add a Respond to Webhook node.
How a webhook workflow works
An event starts the flow; your nodes decide what happens next.
An event occurs
A form is submitted, an order changes, or an external service reports an event.
n8n gets a request
The service calls your webhook URL using the configured HTTP method.
The workflow runs
n8n validates and processes the data, then can perform actions or return a response.
Webhook vs API vs polling
| Term | What happens | Example |
|---|---|---|
| Webhook | A service sends a request when an event occurs. | A form sends a submission to n8n. |
| API | A set of request and response rules lets software exchange information. | n8n requests a customer record from a service. |
| Polling | A workflow checks another service on a schedule for changes. | Check every 10 minutes for new records. |
A webhook is often useful when the other service can push events. Polling can be a fit when it cannot. Webhooks still use HTTP and may work alongside APIs in the same workflow.
What you need to create an n8n webhook
- An n8n Cloud account or a working self-hosted n8n instance.
- Access to create and run a workflow.
- An app or HTTP client that can send a request, such as Postman or cURL.
- A publicly reachable webhook address for requests sent from an external service.
- HTTPS and suitable authentication for real integrations.
If your self-hosted instance is behind a reverse proxy, its public webhook URL must be configured correctly. See our n8n self-hosting tutorial for deployment basics.
Add and configure the Webhook node
Start with a simple POST endpoint for incoming JSON.
- 1
Create a workflow
Open n8n and create a new workflow with a clear name, such as “Contact Form Webhook”.
- 2
Add the Webhook node
Search for Webhook and add it as the first node. It acts as the workflow trigger.
- 3
Choose an HTTP method
Choose POST for the example below. The method must match what the sending app will use.
- 4
Set a path
Use a short path such as
contact-form, or keep the generated path. Copy the complete URL shown in your node. - 5
Choose response behavior
For a first test, use the default response. Later, choose an immediate response, a response after the last node, or Respond to Webhook as needed.
n8n webhook Test URL vs Production URL
Use the URL that matches the workflow state and the kind of test you are running.
| URL | Use it for | How it works |
|---|---|---|
| Test URL | Building and inspecting a workflow. | Start “Listen for test event” or execute the workflow, then send a request. The editor displays the captured data. |
| Production URL | Live integrations. | Publish or activate the workflow according to your n8n version. Review live runs in the Executions view. |
Copy the URL from the Webhook node. Test and production URLs are different. A live service pointed at a test URL may stop working when the test listener is no longer waiting.
Choose GET or POST for your n8n webhook
Follow the method required by the service that calls your endpoint.
| Method | Common purpose | Where data may appear |
|---|---|---|
| GET | Request or retrieve information. | Often query parameters in the URL. |
| POST | Submit information to a workflow. | Often the request body, such as JSON or form data. |
| PUT / PATCH | Create or update resource data, depending on the API. | Often the request body. |
These are common conventions, not strict rules for every service. Match the method and payload format documented by the sending application.
Test your n8n webhook with JSON
Use sample information while building the workflow.
- Open the Webhook node and select its Test URL.
- Choose Listen for test event or the equivalent test action in your n8n version.
- Use Postman or another HTTP client to send a POST request to that URL.
- Set the request content type to
application/json. - Inspect the output shown by the Webhook node.
Example request body:
{
"name": "Alex",
"email": "alex@example.com",
"message": "I would like to learn about workflow automation."
}
Example cURL request (replace the placeholder with your own Test URL):
curl -X POST "YOUR_N8N_TEST_URL" \
-H "Content-Type: application/json" \
-d '{"name":"Alex","email":"alex@example.com","message":"Hello"}'
Use fake or non-sensitive test data. Do not paste real customer details, passwords, or API keys into public examples.
Find incoming webhook data in n8n
Inspect the actual output before writing expressions.
The Webhook node output can contain request body data, headers, query parameters, and route parameters. Where a value appears depends on how the sender formatted the request.
| Incoming value | Typical location | Example expression |
|---|---|---|
| JSON field | Request body | {{ $json.body.name }} |
| Query parameter | Query | {{ $json.query.source }} |
| Route parameter | Parameters | {{ $json.params.id }} |
These paths are examples based on common Webhook node output. Open your node’s data panel and use the field path shown in your own execution; node settings and input formats can affect it.
Use an Edit Fields node to rename or organize incoming values before passing them to other nodes.
Save a form submission to Google Sheets
A practical first n8n webhook automation.
1. Receive
Webhook receives a POST request from the form with name, email, and message fields.
2. Prepare
Edit Fields renames and checks the values. Add an IF node if required fields must be present.
3. Save and notify
Google Sheets appends a row, then an email or Telegram bot workflow can notify your team.
Connect a Webhook → Edit Fields → Google Sheets flow. Map each field to a clearly named column, run it with sample data, and confirm the row appears as expected. For the spreadsheet node setup, see our n8n Google Sheets integration guide.
Return a response from an n8n webhook
By default, a webhook can acknowledge that the workflow started. When a caller needs a specific result, configure the response behavior in the Webhook node.
| Response option | What it does | Useful for |
|---|---|---|
| Immediately | Returns a response as soon as the workflow starts. | Quick acknowledgement. |
| When last node finishes | Returns data from the last node after it completes. | Short flows that produce a result. |
| Respond to Webhook | Lets a dedicated node define the response. | More control over response content and timing. |
For example, a form or API client might expect a confirmation message. Keep responses clear and avoid returning private workflow data. Long-running work may need an early acknowledgement and a separate way to deliver the final result.
Secure an n8n webhook
A production webhook URL can be called by anyone who can reach it unless you restrict access. Choose protection based on the sender’s capabilities and the information your workflow handles.
- Use webhook authentication such as Basic, Header, or JWT where appropriate and supported by the sender.
- Use HTTPS for external traffic and keep your n8n instance and proxy configuration current.
- Validate required fields, data types, and allowed values before taking action.
- Use an IP allowlist only when sender IP addresses are stable and known.
- Keep tokens and credentials out of URLs, workflow screenshots, and public repositories.
- Limit the personal information collected, stored, and returned.
- Consider duplicate requests and retries before sending messages or creating records.
Authentication must match the calling service. Check that it can send the required credentials and headers before enabling protection on a live endpoint.
n8n webhook automation examples
Start with a single event and a clearly defined outcome.
Website form to spreadsheet
Receive a form submission, validate fields, append a row, and notify the team.
Payment status alert
Receive a service event, check its type, and send a notification to an approved channel.
AI request endpoint
Accept a question, pass it to a supported AI node, and return an appropriate result.
Telegram notification
Route a valid event to a private Telegram chat for an operational alert.
Service event router
Inspect an event type and use a Switch node to send it to the right branch.
API response workflow
Receive a request, look up permitted data, and return a carefully scoped response.
For more workflow ideas, browse our n8n automation examples and integration guides.
Common n8n webhook problems and fixes
No request appears
Check that the Test URL is listening, or that the production workflow is published or active. Confirm the sender uses the exact URL.
Test works, production does not
Use the Production URL and publish or activate the workflow. Check the external service configuration and Executions view.
Method not allowed
Make the method selected in the Webhook node match the method sent by the external app.
Incoming fields are empty
Inspect the node output and check whether the sender uses a body, query parameters, or another content format.
Authentication error
Confirm the sender includes the expected credentials and that the selected n8n credential is correct.
Self-hosted URL is wrong
Review your public base URL, reverse proxy, HTTPS, and forwarded request headers with your deployment configuration.
Caller times out
Inspect slow nodes and response mode. Return a quick acknowledgement when the caller should not wait for long processing.
Duplicate actions happen
Check for sender retries or repeated events. Use an event ID or other idempotency check when appropriate.
Invalid JSON
Validate the JSON syntax and content type, then compare the request with a known working sample.
Reliable webhook checklist
Before connecting a live service, check these details.
- Confirm the HTTP method and payload format.
- Test the Test URL with safe sample data.
- Map fields from the actual node output.
- Protect the endpoint with suitable authentication.
- Publish or activate the workflow and switch the sender to the Production URL.
- Configure input validation and error handling.
- Consider retries, duplicate events, and response timeouts.
- Review execution history and monitor failures.
Build the wider workflow foundation in our n8n workflow automation guide or start with the n8n tutorial for beginners.
Frequently asked questions about n8n webhooks
How do I create a webhook in n8n?
Create a workflow, add a Webhook node, choose an HTTP method and path, then copy its Test URL and listen for a test event.
What is the difference between a Test URL and Production URL?
The Test URL is for development while n8n is listening for a test event. The Production URL is registered for a published or active workflow. Production executions can be reviewed in the Executions view.
Can I use GET and POST methods?
Yes. Choose a method supported by the Webhook node and make sure the calling service sends that same method.
How do I send JSON to an n8n webhook?
Send an HTTP request with a JSON body and the appropriate content type. Then inspect the Webhook node output to find the incoming fields.
Can an n8n webhook return data?
Yes. Configure the response behavior in the Webhook node or use Respond to Webhook when you need to control the response.
Do I need a public URL?
An external service must be able to reach the webhook endpoint. For self-hosted n8n, configure the public URL and proxy so requests reach the instance.
How do I secure an n8n webhook?
Use suitable authentication, HTTPS, input validation, and access controls that the calling service can support. Avoid exposing secrets in URLs or examples.
Why is my n8n webhook not working?
Check the URL, test listener or workflow status, HTTP method, authentication, incoming payload, public reachability, and execution history.
Can I connect a webhook to Google Sheets?
Yes. Add a Google Sheets node after the Webhook node and map the incoming values to the appropriate columns.
Can an n8n webhook trigger an AI workflow?
Yes. A workflow can pass selected request data to a supported AI node and return or route the result. Validate inputs and protect sensitive data.
Continue learning
Explore practical n8n workflow automation, connect a webhook to Google Sheets or a Telegram bot, and learn how to add AI agents to a workflow. See more ideas in our automation examples.
n8n Automation AI is an independent learning resource and is not affiliated with, endorsed by, or officially connected to n8n GmbH.
Official webhook resources
Check current options and hosting behavior in the documentation.
- n8n Webhook node documentation
- n8n Respond to Webhook documentation
- Configure webhook URLs with a reverse proxy
- MDN guide to HTTP request methods
n8n’s interface and node options can change between versions. Confirm the settings in your own editor and test your workflow before using it with important data.
Start with one tested request
Build a simple POST webhook, inspect the data, and expand it one step at a time.
