CRM and automation

Webhooks: what they are and how to use them with n8n to connect your tools

By Edgar Jaimes 4 min read

Yellow fiber optic cables connected to a network rack

What a webhook is, how the test URL and the production URL differ in n8n, and how to respond properly to connect your website, your CRM and your payments.

A customer pays in your store at 11 p.m. At that hour nobody is watching email, but the customer expects their confirmation on WhatsApp and your team needs to see it in the CRM the next day. What makes all of that happen on its own, without anyone copying data, is almost always a webhook.

What is a webhook?

It's a web address that receives data automatically the moment something happens in another tool. Instead of your system asking every five minutes "is there anything new?", the other application lets you know on its own: "a payment just came in", "a form was submitted", "a lead was created".

The n8n documentation explains it like this: the Webhook node receives data from apps and services when an event happens and uses it to start a workflow. It can also return data at the end of the workflow, so it works almost like your own API. If you're just getting started, first read what n8n is.

Laptop with programming code open on a dark desk
A webhook is the door through which one tool tells another that something happened. Photo: Unsplash

What would I use it for in my business?

So that one tool notifies another without human intervention. These are common uses:

Event in a toolWhat the n8n workflow does
An approved payment in your payment gatewayConfirms to the customer and updates the CRM
A form submitted on your websiteCreates the lead and notifies the sales rep
A stage change in the CRMSends the next communication
A booked appointmentSchedules the reminder

Speed matters: a lead that gets a reply within minutes is more likely to convert, as we explain in replying quickly to your leads.

What is the difference between the test URL and the production URL?

They are two different addresses, and the production one only works once you publish the workflow. According to n8n, the test URL is registered when you choose to listen for a test event or run the workflow from the editor, and the incoming data shows up right there. The production URL is registered when you publish the workflow, and its data doesn't appear in the editor: you review it in the executions tab.

Common mistake: pasting the test URL into your payment gateway or your form. It works while you have the editor open and stops working afterwards. The external tool always gets the production URL, with the workflow published.

What should I configure in the Webhook node?

The HTTP method, the path, the authentication and the way it responds. The n8n documentation states that the node accepts the DELETE, GET, HEAD, PATCH, POST and PUT methods. The path is generated at random to avoid conflicts, but you can set your own, even with parameters like /:variable.

For security, the node supports basic auth, header auth or JWT auth. The maximum size of each request is 16 MB, and on self-hosted instances it can be changed with the N8N_PAYLOAD_SIZE_MAX variable.

Blue network cable plugged into a panel of numbered ports
Every webhook is a connection point: it pays to know who can use it. Photo: Unsplash

Heads up: a webhook without authentication accepts data from anyone who knows the URL. If the workflow creates records or sends messages, protect it with one of the methods n8n offers.

How do I respond to whoever calls the webhook?

The Webhook node lets you choose between responding immediately, when the last node finishes or with the Respond to Webhook node. If you respond immediately, n8n returns the response code with the message "Workflow got started". If you wait for the last node, it returns what that node produced.

With the Respond to Webhook node you have full control: you can return JSON, text, a file, a JWT token, a redirect or nothing, and set the status code and headers. The documentation notes that if the workflow fails before reaching that node, an error with status 500 is returned. That's why it's worth setting up alerts when an n8n workflow fails.

What should I check before putting it to work?

Test with real data, publish the workflow and review the executions during the first few days. Confirm that the external tool has the production URL, that authentication matches on both sides and that you know where to see an error. If you connect your website to the CRM, this piece fits with a capture funnel with a page, a form and a booking calendar.

In short

Back to the 11 p.m. payment: with a well configured webhook in n8n, the confirmation goes out on its own, the CRM gets updated and your team wakes up with everything in order. The key is to use the production URL, protect it and respond properly. If you want us to connect your tools for you, see our n8n automation service.

Frequently asked questions

What is a webhook in simple terms?

It's a web address that receives data automatically when an event happens in another application, such as an approved payment or a new lead, without you having to go and check.

Why does my n8n webhook work in testing but not in production?

Because they are two different URLs. According to n8n, the test URL is registered when you listen for a test event in the editor, and the production URL is only registered when you publish the workflow.

How much data does the n8n webhook accept?

The n8n documentation states a maximum of 16 MB per request. On self-hosted instances it can be changed with the N8N_PAYLOAD_SIZE_MAX variable.

How do I protect a webhook so not just anyone can use it?

The n8n Webhook node supports basic auth, header auth or JWT auth. If you leave it without authentication, anyone who knows the URL can send it data.

Can I return a custom response to whoever calls the webhook?

Yes. With the Respond to Webhook node you can return JSON, text, a file, a redirect or no response, with the status code you choose.

Do not stop at the theory: apply it to your business

We implement n8n automation end to end, with your real operation. The first conversation is free.

Keep reading