# Build your first workflow

> Build a small, useful workflow from scratch, a contact form that stores every request in a table, and learn to test and publish it.

Source: https://viralistic.nl/help/n8n/first-workflow

This walkthrough is for anyone who has n8n open for the first time. You build a contact form that saves every submission in an n8n Data Table. It needs no outside accounts or API keys, and it teaches the full cycle: trigger, transform, store, test and publish.

## What you will build

```text
n8n Form Trigger  →  Edit Fields  →  Data Table (insert row)
```

A visitor fills in a form. n8n tidies the answers and adds a timestamp. The result lands as a new row in a table you can view, filter and download.

## Before you start

- A running n8n instance. See [Get n8n: cloud or self-hosted](https://viralistic.nl/help/n8n/get-n8n).
- Ten minutes of quiet. No coding needed.

## Step 1: Create the workflow

1. Select the create button (the plus) in the top left of the side menu and choose Workflow.
2. Click the title at the top and rename it to `Contact form to table`.

## Step 2: Add the form trigger

1. Select **Add first step** and search for `form`.
2. Choose **n8n Form Trigger** (listed as "On form submission").
3. Set **Form Title** to `Contact us`.
4. Add three form elements: `Name` (text), `Email` (email) and `Message` (textarea). Make all three required.
5. Select **Execute step**. n8n opens the test form in a new tab.
6. Fill it in with test data, including an email with a capital letter such as `Jane@Example.com`, and submit.

Back in n8n, the node now shows your answers as output.

> **Tip:** Click the pin icon on the output panel to pin this data. From now on, n8n reuses it on every test run, so you do not have to fill in the form again.

## Step 3: Tidy the data

1. Click the plus to the right of the form node and add **Edit Fields (Set)**.
2. Add four fields of type String, and set their values with expressions. You can drag fields from the input panel on the left, then adjust:

   | Field name   | Value                                    |
   | ------------ | ---------------------------------------- |
   | `name`       | `{{ $json.Name.trim() }}`                |
   | `email`      | `{{ $json.Email.trim().toLowerCase() }}` |
   | `message`    | `{{ $json.Message }}`                    |
   | `receivedAt` | `{{ $now.toISO() }}`                     |

3. Select **Execute step** and check the output. The email should now be in lower case.

## Step 4: Create the table

1. Open your project overview in a new tab and go to the **Data tables** tab.
2. Create a data table called `Contact requests`, starting from scratch.
3. Add four columns of type String: `name`, `email`, `message` and `receivedAt`.

## Step 5: Store each request

1. Back in the workflow, add a **Data Table** node after Edit Fields.
2. Set the resource to **Row** and the operation to **Insert**.
3. Pick `Contact requests` from the list.
4. Set the mapping mode to **Map Automatically**. This works because your field names match the column names exactly.
5. Select **Execute workflow**. Open the data table and confirm your test row is there.

## Step 6: Publish

1. Unpin the test data on the form node if you pinned it. Production runs ignore pinned data, but unpinning keeps things clear.
2. Click **Publish** in the top right and confirm.
3. Open the form node and switch to the **Production URL**. This is the address to share or link from your website.
4. Submit the form once through that URL.
5. Open the **Executions** tab of the workflow. You should see one successful run, and a new row in your table.

> **Note:** The test URL only works while you are testing in the editor. Always share the production URL.

## Make it your own

Some easy next additions:

- Add a **Gmail** or **Send Email** node to notify you of each new request. This needs a credential, see [Connect your apps with credentials](https://viralistic.nl/help/n8n/credentials).
- Add an **IF** node to flag messages that contain words like "urgent" or "quote".
- Add an AI step that drafts a reply for you to review. See [The AI Agent node explained](https://viralistic.nl/help/n8n/ai-agent-node).

> **Warning:** A public form can attract spam. Before you link it from a live site, consider adding a check for empty or suspicious messages, and keep an eye on the table for the first few days.

## Next steps

- [Store data with Data Tables](https://viralistic.nl/help/n8n/data-tables)
- [Connect your apps with credentials](https://viralistic.nl/help/n8n/credentials)
- [Error handling and alerts](https://viralistic.nl/help/n8n/error-handling)
- [Build workflows with Claude](https://viralistic.nl/help/n8n/build-workflows-with-claude)
