Skip to main content
0 reactions

n8n Tutorial — Part 2: Build Your First n8n Workflow

Card titled Build Your First n8n Workflow, labelled n8n Tutorial Part 2, with a form node connected to a table node and three steps: n8n Form Trigger, Data table: Insert row, test then publish.

Your first n8n workflow does a real job: a website contact form that saves every message into a table inside n8n. It takes two nodes and no code, and you test it at every step before it goes live.

In this part you build your first n8n workflow from a blank canvas. Along the way you learn the editor’s main pieces: triggers and nodes, test runs, the INPUT and OUTPUT panels, mapping data by dragging it, publishing, and the list of past runs. By the end, a published form saves each message as a new row in a data table.

This is Part 2 of the n8n Tutorial. The parts in Module A, Start Here:

All parts of the n8n Tutorial

Module A: Start Here

Module B: Workflow Basics

  • Part 3: Run a Workflow on a Schedule
  • Part 4: Webhooks: Start a Workflow from Any App
  • Part 5: Forms: Collect Data with n8n Forms
  • Part 6: Credentials: Connect n8n to Your Apps
  • Part 7: Executions, Debugging and Pinned Data
  • Part 8: Organise Your Workflows

Module C: Working with Data

  • Part 9: Items and JSON: How Data Moves in n8n
  • Part 10: Expressions: Use Data from Earlier Nodes
  • Part 11: Transform Data
  • Part 12: Filter and Compare Data
  • Part 13: Dates and Times
  • Part 14: Files: CSV, Excel and PDF
  • Part 15: Data Tables: Store Data Inside n8n

Module D: Flow Logic

  • Part 16: If and Switch: Make Decisions
  • Part 17: Merge: Combine Branches
  • Part 18: Loops and Batches
  • Part 19: Wait and Human Approval
  • Part 20: Sub-workflows
  • Part 21: Error Handling

Module E: Code and APIs

  • Part 22: HTTP Request: Call Any API
  • Part 23: The Code Node in JavaScript
  • Part 24: The Code Node in Python

Module F: AI with Claude

  • Part 25: Your First AI Agent
  • Part 26: Give Your Agent Tools
  • Part 27: Memory That Lasts
  • Part 28: Answer from Your Documents
  • Part 29: AI Chains: Summarize, Classify and Extract
  • Part 30: Human in the Loop and Guardrails
  • Part 31: MCP in n8n
  • Part 32: Evaluations: Test Your AI Workflows
  • Part 33: Free Local AI with the Self-Hosted AI Starter Kit
  • Part 34: An n8n Agent in Microsoft Teams

Module G: Connect Apps and Extend n8n

  • Part 35: Connect Popular Apps with OAuth2
  • Part 36: Community Nodes
  • Part 37: Build Your Own Node
  • Part 38: Programmatic Nodes and Publishing
  • Part 39: The n8n API and CLI
  • Part 40: Build Workflows in Code with the Workflow SDK

Module H: Self-Hosting for Production

  • Part 41: Configure n8n with Environment Variables
  • Part 42: Run n8n on PostgreSQL
  • Part 43: Queue Mode and Workers
  • Part 44: Task Runners and Security
  • Part 45: Back Up, Restore and Update n8n
  • Part 46: Logs, Metrics and Tracing
  • Part 47: Put n8n Online with HTTPS

Module I: Users and Administration

  • Part 48: Users, Roles and Two-Factor Authentication

Module J: n8n Cloud

  • Part 49: Start an n8n Cloud Free Trial
  • Part 50: AI Workflow Builder, Assistant and Gateway Credits

Module K: Wrap-up

  • Part 51: Final Project, Cheat Sheet and What to Learn Next

Cost: free. Everything here runs on your own n8n Community Edition.

Every screen and output on this page is real, run with n8n 2 in Docker on macOS.

What You’ll Build

A Contact us form with three fields, Name, Email and Message, and a workflow that saves each message in a data table named Contact messages. The messages in this part come from fictional customers of a small bookshop. You start from n8n running on your computer, on a blank Overview page.

Prerequisites

  • Part 1: What Is n8n?, for the words this part uses: workflow, trigger, node and item.
  • n8n running, signed in as its owner.

Step 1: Create a Data Table

A data table (opens in a new tab) stores rows of data inside n8n itself, so you don’t need a separate database. Make the table first; the workflow fills it later.

Open n8n (the install guide runs it at http://localhost:5678). Click + at the top of the left menu, then New data table.

The menu that opens from the plus button at the top of the n8n sidebar, listing New workflow, New agent, New credential, New folder, New data table, New project and New AI chat.
Plus, then New data table.

Name it Contact messages, keep From scratch selected and click Create.

The Create new data table dialog with the name Contact messages, From scratch selected and a Create button.
Name the table Contact messages.

The new table already has three columns n8n fills for you: id, createdAt and updatedAt. Add one column for each form field: click Add Column, type name, keep the type string (text) and click Add Column in the box.

The Add Column box over the data table, with the column name name and the type string, and an Add Column button.
Add the name column as a string.

Add two more string columns the same way, email and message. The table now has the columns the form will fill.

The empty Contact messages data table with the columns id, name, email and message, and the note No rows.
The table is ready for the form’s data.

Step 2: Create a Workflow

Click + at the top of the left menu again, then New workflow. n8n opens an empty canvas named My workflow, with a box that says Add first step…. Note the Publish button at the top right; you’ll use it in Step 9.

A new empty n8n workflow named My workflow, with the Editor, Executions and Evaluations tabs, a Publish button at the top right and an Add first step box on the canvas.
A new workflow starts empty.

Click My workflow, type Contact form to data table and press Enter. There’s no Save button: n8n saves your changes automatically (opens in a new tab) as you edit.

Step 3: Add the Form Trigger

Every workflow starts with a trigger: in n8n’s words, “a step that starts your workflow”. Click the + box. In What triggers this workflow?, click On form submission. This is the n8n Form Trigger (opens in a new tab): it builds a web form for you and starts the workflow each time someone submits it.

The What triggers this workflow? panel listing Trigger manually, On app event, On a schedule, On webhook call, On form submission, When executed by another workflow, On chat message and Other ways.
Choose On form submission.

The node’s settings open. Type Contact us in Form Title and Send us a message. We reply by email. in Form Description. The two addresses under Form URLs come into play in Steps 4 and 10.

The n8n Form Trigger settings showing the Test URL and Production URL tabs with a localhost form address, Authentication set to None, the Form Title Contact us and the Form Description Send us a message. We reply by email.
Give the form a title and a description.

Now add the three fields. For each one, click Add Form Element, type the Label, choose the Element Type, then click Add Attributes › Required Field and turn the switch on:

  1. Name, type Text Input.
  2. Email, type Email, so the form only accepts an email address.
  3. Message, type Textarea, a larger box for longer text.
Three form elements in the n8n Form Trigger: Name as Text Input, Email as Email and Message as Textarea, each with Required Field switched on.
Three required fields: Name, Email and Message.

Advertisement

Step 4: Test the Form

Click Execute step at the top of the node’s settings. It runs just this node: n8n opens the test version of your form in a new tab and waits for a submission. Fill it in and click Submit; this part used a fictional customer, Maya Fernandes.

The test version of the Contact us form, filled in with the name Maya Fernandes, the email maya@example.com and a question about a book, with a Submit button.
The test form opens in a new tab.

The form thanks you with Form Submitted.

The test form’s confirmation page saying Form Submitted, Your response has been recorded.
The form confirms the submission.

Go back to the n8n tab. The OUTPUT panel on the right now shows what the trigger produced: 1 item, n8n’s name for one record of data. It holds your three fields plus two that n8n adds: submittedAt, when the form was sent, and formMode, which says test for a test submission.

The OUTPUT panel showing 1 item in a table with the columns Name, Email, Message, submittedAt and formMode, holding Maya Fernandes’s submission and the form mode test.
The trigger’s output: one item.

Note: submittedAt shows n8n’s default time zone (here -05:00) until you set your own. Part 3 covers time zones.

Close the node’s settings with the × at the top right.

Step 5: Add the Data Table Node

An action node does something with the data a trigger passes on. On the canvas, click the + at the right of the trigger. In What happens next?, type data table and click Data table.

The What happens next? panel with data table typed in the search box and the Data table node in the results, next to the executed form trigger on the canvas.
Search for data table after the trigger.

The node lists everything it can do. Under Row actions, click Insert row.

The Data table node’s twelve actions, with row actions such as Insert row, Get rows and Update rows, and table actions such as Create a data table.
Choose Insert row.

The node’s settings open with a new panel on the left: INPUT, the data arriving from the previous node, here Maya’s form entry. In the middle, under Data table, choose Contact messages from the list. Keep Mapping Column Mode at Map Each Column Manually: n8n shows a box for each of your columns under Values to insert.

The Insert row node with the INPUT panel listing Name, Email, Message, submittedAt and formMode from the form, and settings with Resource Row, Operation Insert, Data table Contact messages, Map Each Column Manually and empty name, email and message boxes.
INPUT on the left, the node’s settings in the middle.

Step 6: Map the Form Fields to the Columns

Mapping tells n8n which piece of incoming data goes into which column. Drag Name from the INPUT panel and drop it on the name box. Do the same with Email onto email and Message onto message.

Each box now holds an expression, and n8n previews its value underneath. The name box reads:

Expression (name column)Plain text
{{ $json.Name }}

It means “the Name field of the item coming in”, so each new form entry fills the column with its own name. Part 10 covers expressions in depth.

The Values to insert section with the expressions $json.Name, $json.Email and $json.Message in the name, email and message boxes, each previewing Maya Fernandes’s values.
Each column now holds an expression.

Step 7: Test the Insert

Click Execute step. The node inserts Maya’s entry, and its OUTPUT shows the new row: your three columns plus id 1 and the time it was created.

The Insert row node’s OUTPUT showing the new row with name, email, message, id 1 and createdAt and updatedAt times.
The row is in the table.

Watch out: testing a step really runs it. This test added a real row to Contact messages; in a workflow that sends emails, a test sends a real email.

Step 8: Run the Whole Workflow

Close the node’s settings. Click Execute workflow on the canvas: this time n8n runs every node in order. The test form opens again; submit a second message (here from Ravi Menon). Back in n8n, both nodes show a green tick and 1 item passed between them.

The workflow on the canvas with the On form submission and Insert row nodes both marked with green ticks and 1 item on each connection, next to the Execute workflow button.
Both nodes ran.

Step 9: Publish the Workflow

So far the form only works while you test it. Publishing makes the workflow live: the form gets a permanent address and runs the workflow on its own. Click Publish at the top right. n8n suggests a Version name; add a short note under Describe changes if you like, then click Publish.

The Publish workflow dialog with a suggested version name, a Describe changes box with a short note, and Cancel and Publish buttons.
Publish makes the workflow live.

n8n confirms Workflow published, and the button at the top right now reads Published. Click Got it.

The Workflow published message saying you can now make calls to your production Form URL and see executions in the execution list, with a Got it button.
The workflow is live.

Step 10: Use the Live Form

Double-click the form trigger to open it, and under Form URLs click Production URL. This is the form’s permanent address, the one you’d share. It looks like the test address without -test.

The Form URLs section of the form trigger with Production URL selected, showing a localhost address that contains form instead of form-test.
The Production URL is the form’s permanent address.

Copy the address, open a new browser tab, paste it and press Enter. The live form has no “test version” banner. Submit a third message (here from Leela Iyer).

The live Contact us form, with no test banner, filled in with the name Leela Iyer, the email leela@example.com and a question about a book.
The live form works without the editor.

Step 11: Check the Executions and the Table

Every run of a workflow is an execution. Back in the workflow, click the Executions tab at the top. The live form’s run is at the top of the list, marked Succeeded with the version you published; your test runs below it carry a small flask icon.

The Executions tab listing four runs that all Succeeded, the newest from the live form with its published version, and three older test runs marked with a flask icon.
Every run is listed under Executions.

Now open the table: click Overview in the left menu, then the Data tables tab, then Contact messages. All three messages are there, one row each.

The Contact messages data table with three rows for Maya Fernandes, Ravi Menon and Leela Iyer, each with an email and a message.
All three messages are in the table.

Clean Up

Nothing here costs anything, so you can keep the workflow. To remove it:

  1. In the workflow, click the arrow next to Published, choose Unpublish, then Unpublish again to confirm. The live form stops working.
  2. Click … next to the workflow’s name and choose Archive. n8n archives it at once and hides it from the list.
  3. To delete it for good, click Update filters in the message Archived workflows are hidden in this view to show it, open the archived workflow’s … menu, choose Delete and confirm with Yes, delete.
  4. In Data tables, open the … menu of Contact messages, choose Delete and confirm. This deletes its rows too, with no undo.
The menu under the Published button with Publish, View timeline and Unpublish.
Unpublish stops the live form.
The Delete Workflow? dialog asking whether to delete Contact form to data table permanently, with Cancel and Yes, delete buttons.
Deleting an archived workflow asks for confirmation.

Common Mistakes

MistakeWhat happensDo this instead
Sharing the Test URLIt only works while n8n is waiting for a test runPublish, then share the Production URL
Editing a published workflow and expecting the live form to changeThe live form keeps running the version you publishedPublish again after your changes
Thinking test runs are a sandboxTests run for real: each one added a row hereTest with sample data you can delete
Typing a value into a column box instead of dragging the fieldEvery row gets that same fixed textDrag the field from INPUT so the box holds an expression

Troubleshooting

ProblemCauseFix
Contact messages isn’t in the Data table listThe table wasn’t created, or has another nameCreate it as in Step 1, then pick it again
The INPUT panel is empty in Insert rowThe trigger hasn’t run yet in this sessionRun the trigger with Execute step (Step 4) first
The live form doesn’t start the workflowThe workflow isn’t publishedCheck that the top-right button says Published

FAQ

What’s the difference between Execute step and Execute workflow?

Execute step runs one node, which is handy while you set it up. Execute workflow runs the whole workflow from its trigger. Both are test runs and show their data in the editor.

Where does a data table store its rows?

Inside n8n’s own database. n8n’s docs (opens in a new tab) describe data tables as suited to light or moderate data, with 200 MiB for all tables together by default; a self-hosted n8n can raise that limit.

Can visitors to my website use this form?

Only if they can reach your n8n. An n8n on your own computer serves the form at a localhost address, which works only on that computer. A later part of this series puts n8n online with HTTPS.

Do I have to publish to keep my work?

No. Your workflow is saved as you edit. Publishing only decides whether its trigger runs on its own.

Conclusion

You built a complete n8n workflow: a form trigger that starts it, a data table node that stores each message, and a published version that runs on its own. You also used the moves every workflow needs: testing one step, reading INPUT and OUTPUT, mapping fields by dragging, and checking executions.

← Part 1: What Is n8n? Workflow Automation Explained

Coming next: Part 3: Run a Workflow on a Schedule.

Additional Resources

n8n and other names mentioned are trademarks of their respective owners. JD Bots isn’t affiliated with or endorsed by n8n GmbH.

0 comments