To trigger an n8n workflow using an HTTP POST request, you can use the Webhook Trigger node in your workflow. Here’s how to set it up step by step:
✅ Step 1: Add a Webhook Trigger Node
In your n8n workflow, drag and drop the "Webhook" node.
Set the HTTP Method to POST.
Choose a Path, for example: /my-webhook.
This makes your webhook URL like:
https://<your-n8n-domain>/webhook/my-webhook
(For testing on localhost, it might be: http://localhost:5678/webhook/my-webhook)
✅ Step 2: Save and Activate the Workflow
Click Save.
Set the workflow to Active (top right corner).
✅ Step 3: Send a POST Request
You can now send a POST request to the webhook. For example, using cURL:
curl -X POST https://<your-n8n-domain>/webhook/my-webhook \
-H "Content-Type: application/json" \
-d '{"name": "John", "email": "john@example.com"}'
Or using JavaScript (fetch):
fetch("https://<your-n8n-domain>/webhook/my-webhook", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
name: "John",
email: "john@example.com"
})
});
✅ Step 4: Access the POST Data in n8n
In your workflow, the Webhook node will output the data in:
{{ $json["body"] }} — The POST body
{{ $json["headers"] }} — Request headers
Use this data in the next nodes (e.g., send email, insert into DB, etc.).
✅ Optional: Test Webhook
If your workflow is not active, use the "Test" button in n8n. It gives you a test URL that looks like:
https://<your-n8n-domain>/webhook-test/my-webhook
Let me know if you want to secure the webhook with a secret token or set up authentication headers.