Webhooks Overview¶
Trigger workflows via HTTP requests.
What are Webhooks?¶
Webhooks allow external systems to trigger workflows:
Creating a Webhook¶
Add a Webhook node as the workflow trigger:
{
"nodes": [
{
"id": "webhook",
"name": "Webhook Trigger",
"type": "n8n-nodes-base.webhook",
"position": [250, 300],
"parameters": {
"path": "/my-webhook",
"httpMethod": "POST"
}
}
]
}
Webhook URL¶
After activating the workflow, the webhook is available at:
Production URL:
Triggering Webhooks¶
POST Request¶
curl -X POST http://localhost:8080/webhook/my-webhook \
-H "Content-Type: application/json" \
-d '{"event": "user_created", "user_id": 123}'
GET Request¶
Webhook Configuration¶
Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
string | Required | URL path for webhook |
httpMethod |
string | POST |
HTTP method to accept |
responseMode |
string | onReceived |
When to respond |
responseData |
string | allEntries |
What to return |
HTTP Methods¶
Response Mode¶
| Mode | Description |
|---|---|
onReceived |
Respond immediately (default) |
lastNode |
Respond after workflow completes |
Accessing Webhook Data¶
In downstream nodes:
Request Body¶
Query Parameters¶
Headers¶
Request Info¶
Response Configuration¶
Immediate Response¶
{
"parameters": {
"responseMode": "onReceived",
"responseCode": 200,
"responseData": "allEntries"
}
}
Custom Response¶
Then add a Set node at the end:
{
"name": "Response",
"type": "n8n-nodes-base.set",
"parameters": {
"assignments": [
{"name": "status", "value": "success"},
{"name": "message", "value": "Processed"}
]
}
}
Webhook Types¶
Production Webhook¶
Active when workflow is activated:
Test Webhook¶
For testing without activation:
Common Use Cases¶
GitHub Webhooks¶
Filter by event:
Stripe Webhooks¶
Access event:
Slack Events¶
Handle challenge:
Webhook Management¶
List Active Webhooks¶
Webhook Status¶
Best Practices¶
1. Use Descriptive Paths¶
2. Validate Input¶
Add a Filter node after webhook:
{
"type": "n8n-nodes-base.filter",
"parameters": {
"conditions": [
{
"leftValue": "={{ $json.body.event }}",
"operator": "exists"
}
]
}
}
3. Respond Quickly¶
For slow workflows, use immediate response:
4. Handle Errors¶
Return appropriate status codes:
5. Log Requests¶
Add a Code node to log:
Error Handling¶
Invalid Webhook¶
Invalid Method¶
Processing Error¶
Rate Limiting¶
Configure rate limits:
Returns 429 Too Many Requests when exceeded.
Next Steps¶
- Webhook Authentication - Secure webhooks
- API Reference - Webhook API
- Workflows - Creating workflows