On this page
Define the intake contract
A webhook receives data from another application. Before building one, write a small input contract: required fields, accepted types, length limits, and the response expected by the caller. For a fictional inquiry form, require request_id, email, and message. Treat a valid email shape as a format check, not proof that the mailbox exists or belongs to the sender. A public endpoint also needs an appropriate abuse-control plan. Never put secret credentials in public website JavaScript. Use invented test records until you know exactly what is stored in execution history and who can access it.
Configure and inspect the test request
Add a Webhook node with the method your form will use, typically POST. n8n provides separate test and production URLs; listen for a test event before sending data to the test URL. Read the incoming node output to locate the request body rather than guessing the field path. Add Edit Fields to normalize known values, such as trimming surrounding whitespace. Follow it with an If node that checks required values. Use the response mode appropriate to your design and, when necessary, a Respond to Webhook node. Do not describe receipt of a request as completion of the business action.
Separate valid and invalid paths
On the valid route, prepare a clean record for the next step. On the invalid route, return a concise response naming the missing or unacceptable field without revealing system details. A request missing message should not continue to a drafting or sending step. Test the exact response code and body from the caller side; a green node on the canvas does not establish that the form received a useful response. Authentication, cross-origin behavior, and sender verification are separate concerns from field validation. Check the official Webhook documentation for available authentication and response options.
Run an intake acceptance checklist
Try a valid request, an empty body, a missing request ID, a numeric message, an oversized message, and an unexpected extra field. Record whether each should pass and compare the actual result. Include a repeated request ID because retries can cause duplicate work; see duplicate prevention. For deployment, change the external caller to the production URL only after the workflow is ready and published in your n8n environment. Keep the test endpoint out of customer instructions. This tutorial is a design exercise, and its example validation is not a complete security review. Before real traffic, verify the whole form-to-response journey on a phone and desktop.
Name the caller-facing result
Use a test record with email but no message. Before sending it, write down the response your form should display, such as a request to enter a question. Verify that the downstream drafting node never runs. Then restore message and confirm the valid request takes the intended branch without changing the identifier.
Sources and further reading
Created with AI assistance and checked for page structure, links and illustrative calculations. Vendor reviews are documentation-based; hands-on product tests are not claimed. Tutorials are learning guides, not deployed client systems. Examples are fictional unless explicitly identified otherwise. Report a correction through Contact.
