# Run a TWWP example workflow in n8n (beginner guide)

Tested on n8n 2.49.7 (27 Nov 2026). Menu names can differ in other versions. Everything here runs on your own computer with made-up data. The workflows themselves make no outside calls. Docker downloads the n8n image the first time you start it, and n8n itself can still go online for some features, such as templates or the n8n Assistant (more on that below).

## What you need
- A computer with Docker Desktop, or `podman` (free). Nothing else.
- About 10 minutes.

## 1. Start n8n on your own computer
Paste this as **one line** into a terminal (PowerShell, Terminal or any shell):

```
docker run -d --name n8n-twwp -p 127.0.0.1:5678:5678 -v n8n_twwp:/home/node/.n8n -e N8N_DIAGNOSTICS_ENABLED=false -e N8N_VERSION_NOTIFICATIONS_ENABLED=false -e N8N_PERSONALIZATION_ENABLED=false -e N8N_SECURE_COOKIE=false docker.io/n8nio/n8n:2.49.7@sha256:17a3e5a8c5e2a7440cc757f5392d57b50eefdfd46eac4532a7dea9bf2735d9ae
```

The image is pinned to the exact release these workflows were tested on (version 2.49.7, plus its digest), so a later n8n release cannot change what you run. Update it on purpose, after reading the n8n release notes, and re-run the tests. (With podman, write `podman` instead of `docker`.) Three of the `-e` settings switch off n8n's usage reports, its update checks and its sign-up questions, so n8n sends less about you to its makers. They do not block all outside traffic, and n8n can still go online for some features; the workflows themselves make no outside calls. The fourth, `N8N_SECURE_COOKIE=false`, lets you log in at a plain `http://localhost` address; keep it only for this setup on your own computer. The `127.0.0.1` part means only your own computer can reach it.

Then open <http://localhost:5678> in your browser.

- If you see the plain text `Cannot GET /`, n8n is still starting. **Wait about 30 seconds and refresh.**
- n8n asks you to **set up an owner account**. It is local: it stays on your machine. Use any email and password, and leave the box about security and product updates unticked.
- A page about the **n8n Assistant** may appear. Do not click Get started (it is an online feature). Click the **Home** icon (the house, on the left) to skip it.

Prefer n8n Cloud? It works too, but your workflow and the data you send go to n8n's servers, so only use the made-up sample data below.

## 2. Import the workflow
1. Download the workflow file from its page on the site (or from the table below).
2. In n8n click **Build a workflow** (or open any empty workflow).
3. Click the **...** (More actions) menu at the top left, next to the workflow name, then **Import**, then **From file**, and choose the downloaded `.json` file.
4. If a pop-up asks about n8n's MCP connector, click **Skip**.
5. Wait a few seconds until the **Publish** button at the top right is dark (n8n saves your import by itself; if it stays grey, press Ctrl+S, or Cmd+S on a Mac). Click **Publish**, then **Publish** again in the box, then **Got it**. (Older n8n versions call this switching the workflow to **Active**.)
6. You will see the flow: a webhook, a step that reads your input, an approval gate (yellow note), and two answers.

## 3. Send the sample input
Each workflow has a sample input file. Download it, then run this in a terminal from the folder where you saved it. It is the same command on macOS, Linux and Windows 10/11 (`curl.exe` comes with Windows):

```
curl -X POST -H "Content-Type: application/json" --data-binary @sample-input.json http://localhost:5678/webhook/WEBHOOK-PATH
```

Replace `sample-input.json` with the sample file of the workflow you imported and `WEBHOOK-PATH` with the path in its table row below.
Use the **Production URL** (`/webhook/...`), not the Test URL (`/webhook-test/...`): the test one only works while you click Execute in the editor.

**If you get 404:** double-click the Webhook box in the editor, open **Production URL** and copy that address instead. It must start with `/webhook/` and end with the path in the table below.

Windows PowerShell alternative: `Invoke-RestMethod -Method Post -Uri http://localhost:5678/webhook/WEBHOOK-PATH -ContentType 'application/json' -InFile sample-input.json`

## 4. What you should see
The sample input is set to `"approved": false`, so the workflow answers with a **held** result: it shows what it would do and waits for a person. Change `false` to `true` (a real `true`, no quotes; `yes` does not count) and send it again to get the **released** result. The expected answers are in the table below and in each `...-tests.json` file.

## The workflows

| Use case | Webhook path | What it does | Approval gate (`"approved": true`) | Files |
|---|---|---|---|---|
| UC-0741 meeting notes into tickets with owners | `twwp-meeting-notes` | The pm approves the list | the PM approves the list (approved=true). Nothing becomes a ticket until then, and an empty list is never approved. | `meeting-notes-to-tickets-0741.json`, `meeting-notes-to-tickets-0741-sample-input.json`, `meeting-notes-to-tickets-0741-tests.json` |
| UC-0887 overdue invoice chaser with tiered reminders | `twwp-overdue-invoice-chaser-0887` | The owner approves every reminder before it is queued | the owner approves every reminder before it is queued (approved=true); nothing is released without it, final notices included. Invoices with an unreadable or impossible date go to a review queue and are never given a tier. | `overdue-invoice-chaser-0887.json`, `overdue-invoice-chaser-0887-sample-input.json`, `overdue-invoice-chaser-0887-tests.json` |
| UC-0189 inbound lead qualifier with reply or decline draft | `twwp-lead-qualification-from-inbound-mail-0189` | The freelancer approves the draft before it goes anywhere | the freelancer approves the draft before it goes anywhere (approved=true). Referrals and existing clients always go to the freelancer. | `lead-qualification-from-inbound-mail-0189.json`, `lead-qualification-from-inbound-mail-0189-sample-input.json`, `lead-qualification-from-inbound-mail-0189-tests.json` |
| UC-0302 supplier invoice capture and PO match | `twwp-accounts-payable-invoice-capture-0302` | The approver signs off | the approver signs off (approved=true). A price or quantity mismatch always needs review, even if approved. | `accounts-payable-invoice-capture-0302.json`, `accounts-payable-invoice-capture-0302-sample-input.json`, `accounts-payable-invoice-capture-0302-tests.json` |
| UC-0979 phone call summary and tagging | `twwp-call-summary-and-tagging-0979` | The support agent skims and approves the tags | the support agent skims and approves the tags (approved=true) before the ticket is updated. Calls that look like they contain payment data (best-effort detection, not a guarantee) are held for human review, and their summary is withheld. | `call-summary-and-tagging-0979.json`, `call-summary-and-tagging-0979-sample-input.json`, `call-summary-and-tagging-0979-tests.json` |

## If you type your own meeting notes (UC-0741)
The notes workflow only recognises lines that start with `ACTION:` (or `TODO:`), then the task, an `@name` for the owner and optionally `by Friday` or `by 2026-11-20`. Example: `ACTION: Update the pricing page @dana by Thursday`. If it finds no such line it says so in the reply (`message`) instead of returning an empty list.

## 5. Make it real: replace the stand-in with an AI
In these files the step that would be an AI is a **simple rule-based stand-in**, so the test needs no key and gives the same answer every time. To use a real model:
1. Add an AI node (for example a chat model with a Basic LLM Chain or AI Agent node) in place of the node named **Extract and decide**. It must return the same data fields as the expected answers, plus `hold_reasons` (a list of reasons a person must look, empty if it has none). **A model may only add reasons to hold. It can never remove the hold, skip the approval or open the gate**: the node after it ignores any `gate_open`, `approved`, `rules_ok` or `needs_approval` the model might return, and treats a missing or malformed `hold_reasons` as a hold.
   **Anything that would send, pay or change data always waits for a person's approval. That is fixed workflow logic, never a model field.** In these files the request field `approved` is only a **demo toggle** so the tests can run without a screen. It is read in one place, the node named **Approval check (demo toggle)**. Before any step that sends, pays, updates a record or emails anyone, replace that node with a real approval: a person's click or a signed event that is **authenticated** (only your approvers can trigger it), **bound to this exact draft** (approving draft A cannot release draft B) and **asked again if the draft changes**. Neither the model's answer nor the caller's request may stand in for it. Keep every step after the gate as a draft or stub until that separate approval exists. A test (`security-model-cannot-approve`, in `run_all.sh`) feeds the gate a deliberately hostile model answer and checks that it still holds.
2. Put the model's API key in **Settings > Credentials** in n8n. Never paste a key into the workflow itself.
3. Keep the **approval gate** (see the paragraph above) and keep the final step a draft or stub until you trust the results over several weeks.
4. Check the cost: each use case page on the site shows an estimated cost per run, with its assumptions (guide: What an agent costs). A real model's wording will differ, so the exact-match test no longer applies: judge the results yourself.

## Stop n8n
```
docker rm -f n8n-twwp
```

This stops and removes the container. Your workflows and settings stay in the `n8n_twwp` volume (the storage Docker keeps for n8n), and the start command above brings them back.

**Optional, and permanent:** to delete everything n8n stored, including any workflows you built and any credentials you saved, also run:
```
docker volume rm n8n_twwp
```
There is no undo. To keep a workflow, download it first: open it in n8n and use the download option in the **...** menu at the top left.

## For developers: run all tests in a container
`./run_all.sh` starts a throwaway n8n container (unique name and a free random port), imports every workflow, posts each case from `tests.json` and compares the answer with the expected output. It needs `podman`. It exits 0 only if every case matches. `./run_ui_test.sh` does the same through the n8n web page in a headless browser (menu, Import, file, Publish) and checks that the webhook path survived: a web import rewrites the path to a random UUID if the webhook id equals the path, which a command-line import never shows. `python3 make_workflows.py` regenerates the workflow files, tests and this README.

## Limits
- Synthetic data only. Nothing here has run on real business data.
- **The call workflow (UC-0979) is not a payment-data control.** It looks for card-like numbers and phrases and holds those calls for review with the summary withheld, but detection is best-effort and will miss things (see MEASURED.md). Before using anything like it on real calls: keep payment data out at intake (for example pause call recording while a card is read out), redact before any summary is made, switch off saving of execution data in n8n (the workflow sets it to not save; check your own instance setting too) and send uncertain calls to a person.
- Invoices whose due date cannot be read (UC-0887) go to a review queue and are never given a reminder tier.
- A workflow that matches its expected outputs and has been reproduced by an independent reviewer is shown on the site as "Workflow tested locally; AI step simulated". That says the flow and the approval gate work, not that a model does the job well.
- The webhook is open on your own computer only. Do not expose it to the internet without authentication.
