How to Set Up a Webhook in n8n
To set up a webhook in n8n, add a Webhook trigger node to your workflow, copy the test or production URL, paste it into the external service, and configure the HTTP method (usually POST). Data sent to the URL appears as JSON in the node output and is available to all downstream nodes.
A webhook lets external services trigger your n8n workflow automatically. This guide shows how to configure the Webhook node and receive data from an outside source.
What a Webhook Is
A webhook is a way for an external application to send data to your n8n workflow as soon as something happens. Instead of n8n polling an external service to check for new data, the external service pushes it to n8n immediately. This makes webhooks much faster than scheduled polling and avoids unnecessary API calls. Common sources include payment systems, form builders, CRMs, and monitoring tools.
Step 1: Add the Webhook Node
Open your workflow in n8n and add a Webhook node as the trigger. The node immediately generates two URLs: a test URL and a production URL. The test URL is active only while you are in the editor with “Listen for test event” enabled. The production URL is always active once the workflow is set to active. For a general introduction to how n8n workflows are structured, see creating your first n8n workflow.
Step 2: Configure the HTTP Method
By default the Webhook node accepts POST requests. This is the correct setting for most use cases, as POST is the standard method for sending JSON data. If the external service sends GET requests (common for some notification systems and older integrations), change the method in the node settings. You can also set it to accept any method if you need flexibility.
Step 3: Test the Webhook With Sample Data
Before connecting a real service, test the webhook with sample data. Use Postman, Insomnia, or a curl command to send a POST request to the test URL with a representative JSON payload. Click “Listen for test event” in n8n, then send your request. The data appears in the node’s output panel. This confirms the webhook is working and shows you exactly how the incoming data is structured.
Step 4: Access the Data in Downstream Nodes
Data from the webhook is available as a JSON object in all nodes that follow it. If your payload included a field called customer_id, you reference it as {{ $json.customer_id }} in expression fields. HTTP headers arrive under $headers, query string parameters under $query. Use the Set node to rename or filter fields before passing data to action nodes. This keeps your workflow clean and easier to maintain as it grows.
Step 5: Add Header Authentication
For any production webhook, add basic security. In the Webhook node settings, enable “Authentication” and select “Header Auth”. Define a secret header name and a value (a long random string works fine). Then configure the external service to include that header with every request. n8n rejects requests without the correct header, preventing unauthorised calls to your workflow. If you want to process the incoming data with an AI model, read how to connect an AI model to your n8n workflow.
Our tip: Log every incoming webhook to a simple Google Sheet or database table during the first week after going live. That gives you a history of everything received and makes debugging much easier if something goes wrong.
Frequently asked questions
What is the difference between the test URL and the production URL in the n8n Webhook node?
The test URL is only active when you click 'Listen for test event' inside the n8n editor. It is used for developing and debugging your workflow. The production URL is always active when the workflow is set to active, even when the editor is closed. Use the test URL while building, then switch the external service to the production URL when you activate the workflow.
How do I access the data that arrives in the webhook?
Data sent to the webhook URL appears in the node's output as a JSON object under $json. If the POST request body was { name: 'Jan', amount: 150 }, you access those fields as $json.name and $json.amount in downstream nodes. HTTP headers are available under $headers and query parameters under $query. Use expressions in action nodes to reference these fields.
How do I make my n8n webhook secure?
The simplest method is to enable HTTP Header Auth in the Webhook node settings. You define a secret header name and value, then configure the external service to send that header with every request. n8n will reject requests that do not include the correct header. For higher security, you can verify a request signature if the sending service supports it, using a Code node to check a shared secret hash.
Can I receive data from any service via n8n webhooks?
Yes, any service that supports outgoing webhooks (also called HTTP callbacks) can send data to n8n. This includes most SaaS tools, payment processors, form builders, CRMs, and monitoring systems. You paste the n8n webhook URL into the external service's webhook settings and configure what events trigger it. The data format is usually JSON, but n8n also handles form-encoded data and plain text.