n8n Training Hub
Back to home

Collect data and reply automatically

Forms and notifications

You need to collect requests from a form and react automatically: save the data and send a confirmation email. In this track you build a form that takes in data and kicks off an automatic notification.

Download test data
n8n nodes involved
  • Form Trigger
  • Webhook
  • Edit Fields (Set)
  • IF
  • Send Email
0/5 done
Step C1

Expose a form

Goal

Build a workflow that exposes a form with the fields name, email, request type, message. You can use the native n8n Form Trigger or a Webhook that receives the submit from the site Form Submitter.

Done criteria

Get help
Node flow
Form Triggeror Webhook

You have two clean ways in. The n8n Form Trigger builds a hosted form page for you: set the Form Title and Form Description, then add your Form Elements (name as Text, email as Email, request type as Dropdown, message as Textarea). n8n gives you a URL to share, and a submit starts the workflow.

If you would rather drive it from this site, use a Webhook set to POST and fill the Form Submitter below: the data arrives nested under body, for example {{ $json.body.email }}.

Either way, the thing that matters is the same: every form field becomes a field in the payload n8n receives, ready for the next steps to read.

Step C2

Validate the incoming data

Goal

Add validation: the email must be formally valid and the required fields (name, email, request type) must not be empty. Use the invalid dataset examples to test.

Done criteria

Get help
Node flow
Form Trigger
IFvalidate

After the trigger, add an IF node and stack the checks you need. The IF node joins multiple conditions with an AND/OR combinator, so you can require, in one node, that name is not empty, email is not empty, and request type is not empty.

For the email, validate the shape: a simple regex, or at least the presence of an @ and a dot in the domain. Valid submits leave the true output, invalid ones leave the false output, where you can reply with an error or log them.

Load the invalid examples in the Form Submitter to test. Validating input is the first move of any automation that takes data from outside: never trust the payload.

From the n8n docs

Step C3

Save the request

Goal

For valid submits, save the request somewhere. Reuse the Track B Data Table, or create a new one (requests) with the form fields plus a timestamp.

Done criteria

Get help
Node flow
IFtrue
Data TableInsert

Connect the true (valid) branch to a Data Table node set to Insert. Reuse the table from Track B, or create a fresh one called requests with the form fields plus a timestamp.

Add a created_at column and fill it with the expression {{ $now }} so every row records when it arrived. Map the rest from the payload: {{ $json.body.name }}, {{ $json.body.email }}, and so on.

This is where Track C meets Track B: the form quietly feeds your mini CRM, and nothing gets lost.

Step C4

Send a confirmation email

Goal

After saving, send an automatic confirmation email to the address given in the form, with text that recaps the request.

Done criteria

Get help
Node flow
Data Table
Send EmailSMTP

Add a Send Email node after the save. It sends through an SMTP credential, so set that up once (host, port, user, password) and reuse it. The recipient is the form address, {{ $json.body.email }}.

Personalize the subject and body with the fields you received, for example: Hi {{ $json.body.name }}, we received your {{ $json.body.type }} request. The node's Send and Wait for Response operation exists too, but plain Send is all you need here.

No SMTP handy for the event? Configure the node and test against your own address. The idea to feel is simple: an incoming event triggers an outgoing message, with no human in the loop.

Step C5Stretch

Different replies per request type

Goal

Personalize the email (or the action) based on the request type selected in the form, for example information versus support versus quote.

Done criteria

Get help
Node flow
Switchrequest type
Send Email
  • information
  • support
  • quote

Add a Switch node on the request type field before the email, in Rules mode with one output per type (information, support, quote). Use "Rename Output" so each branch is readable, and prepare a different message on each.

Each branch can end in its own Send Email, or set a different subject and body that one shared Send Email then uses. Same routing pattern as Track A, pointed at the output this time.

The automation no longer just receives and stores: it reads the context and replies in the way that context deserves.

Test tool

Form Submitter

Fill the form and send it to your webhook, or load a valid or invalid example to test validation without typing.

Paste your webhook URL above first.

What you sent

Nothing yet. Send a test call.

What you got back

Nothing yet. Send a test call.