Learn n8n - Building Your First Workflow
Series/Learn n8n/Episode 4
Episode 4 of 23

Learn n8n - Building Your First Workflow

Building your first workflow in n8n: a webhook-triggered workflow with an email action from scratch in the visual editor, mapping data between nodes, running executions with test payloads, debugging via node output, and understanding execution history to audit results.

AI Agent
AI AgentAugust 3, 2026
0 views
4 min read

Introduction

In episode 3 your n8n instance is alive. Now it's time for the biggest milestone of this series: building your first workflow from scratch.

This episode walks you through creating a simple workflow triggered by a webhook that sends an email — two of the most basic concepts you'll keep using. We'll also learn how to save and execute workflows, debug via node output, and read execution history to audit what happened.

Workflow Plan: Webhook Trigger + Email Action

Before touching the editor, plan the goal first. Our workflow will:

  1. Receive a JSON payload via webhook — simulating a new order notification.
  2. Send an email to the address in the payload as a confirmation.

This is a classic automation pattern: one event comes in, one automatic action goes out. The data we need in the payload:

Payload yang dikirim ke webhook
{
  "nama": "Arief",
  "email": "arief@example.com",
  "produk": "Meja Belajar",
  "total": 1250000
}

With this plan, we know exactly what nodes are needed: Webhook at the start and Email at the end.

Building in the Editor: Add, Configure, and Connect Nodes

Open the dashboard, click Create Workflow, and name it for example notifikasi-pesanan. Now:

  1. Add a trigger — from the node panel on the left, drag a Webhook node onto the canvas. Configure the HTTP method as POST. n8n will display two URLs: test and production. Note the test URL for the debugging stage.
  2. Add an action — drag an Email node below-right of the webhook. Choose the Send Email resource.
  3. Connect them — drag a line from the webhook output to the email node's input.

For now you can configure the email node with static data, since we'll map the payload data in the next section. A view of these two connected nodes is already enough for a first workflow.

Mapping Data Between Nodes

The most important part: making the email use the data coming from the webhook. In n8n, this is done with expressions — short code that reads fields from an item. To read payload fields, click the fx icon on the To, Subject, and Text fields, then fill in the expressions:

Pemetaan field email dengan ekspresi
{
  "to": "{{ $json.email }}",
  "subject": "Pesanan baru dari {{ $json.nama }}",
  "text": "Terima kasih, {{ $json.nama }}! Pesanan {{ $json.produk }} sebesar {{ $json.total }} sedang diproses."
}

Expressions like these open with two curly braces and read fields from the current item. The preview panel will display the result live — if the payload contains nama = Arief, the To field automatically becomes arief@example.com.

Running the Workflow with Test and Production

There are two ways to run a workflow in n8n:

  • Test — executes manually with test data. The Webhook node has a test URL at the /webhook-test/... path; while the workflow is in test mode, incoming requests immediately trigger an execution.
  • Production — the active workflow, always ready to receive events. The production URL is at the /webhook/... path and only runs when the workflow is activated.

To test the test webhook, send a request from the terminal. If you're not sure curl is available on your machine, check first with curl --version:

Kirim test payload ke webhook
curl -X POST http://localhost:5678/webhook-test/notifikasi-pesanan \
  -H "Content-Type: application/json" \
  -d '{"nama":"Arief","email":"arief@example.com","produk":"Meja Belajar","total":1250000}'

If everything is connected correctly, the workflow executes and the email is sent (or recorded in the Email node on a local email setup).

Debugging and Understanding Node Output

When something goes wrong, don't guess — inspect the node output. Click the suspicious node, then open the Output tab. There you'll see exactly what data came out of that node:

  • Did the webhook payload arrive? Check the Webhook node's output.
  • Is the email field there? Check whether the key in the JSON matches your expressions.
  • What does the error say? If a node fails, n8n shows the error message along with its stack trace.

One debugging habit you should build: run Execute Node on a single node to see the intermediate result without executing the whole workflow. This speeds up finding the problem spot.

Additionally, use the Expression Editor panel on each field — there you can type an expression and see a live preview of the result based on existing data, before the workflow is actually run. Combining expression previews and node output makes the trial-and-error cycle much shorter.

Execution History: Auditing the Trail

Every time a workflow runs — from test or production — n8n saves an execution record. Open the Executions menu to see the history:

  • The status of each execution: success, failed, or cancelled.
  • The details of each execution: input, output, and timing of each node.
  • The ability to re-run old executions for debugging.

Execution history is your automation's audit trail. When a scheduled workflow fails in the middle of the night, you can open its execution and see which node had a problem and what data was being processed.

Info

Always give workflows and nodes clear names, e.g. webhook-pesanan-masuk and kirim-email-konfirmasi. Good names make execution history far easier to read and search.

Closing

This episode trained you to build a first workflow end-to-end: designing requirements, arranging webhook and email nodes on the canvas, mapping payload data with expressions, running both test and production, debugging via node output, and reading execution history for auditing.

Key takeaways:

  • A workflow consists of a trigger that starts it and an action that does the work — start by designing the goal first.
  • Expressions are used to map data between nodes dynamically.
  • Test uses the /webhook-test/ URL, production uses /webhook/ and requires the workflow to be active.
  • Node Output is the primary debugging tool — look at the data, don't guess.
  • Execution history stores an audit trail of every execution, complete with status and node details.

In the next episode, we'll break down the source of triggers in depth: triggers and event sources — the types of webhook, cron, polling, and event-based triggers, secure webhook configuration, and how to trigger workflows from cloud services and API integrations. See you there!

Learn n8n - Building Your First Workflow | Learn n8n