My First n8n Automation Workflow in Under an Hour

n8n Workflow Documentation
n8n Automation · Workflow Documentation

My First Automation:
Schedule Trigger → API Fetch → Webhook Output

A complete end-to-end working workflow with step-by-step explanation
Schedule TriggerEvery 1 minute
🌐HTTP GETFetch random joke
⚙️Code NodeFormat message
📤HTTP POSTSend to webhook

1. Workflow Overview

This document covers the complete n8n automation workflow built during the tutorial. The workflow runs fully end-to-end: it automatically fires on a schedule, fetches live data from a public API, transforms that data using JavaScript, and delivers it to a webhook endpoint.

ℹ️ What this workflow does Every 60 seconds, n8n automatically fetches a new random joke from a free public API, formats the setup and punchline into a single clean message using JavaScript, and POSTs it to webhook.site where the delivery can be verified in real time.
NodeTypePurpose
Schedule TriggerTriggerFires every 1 minute automatically
HTTP Request (GET)ActionFetches a random joke from public API
Code (JavaScript)TransformFormats joke into clean message string
HTTP Request (POST)ActionSends formatted joke to webhook.site

2. Prerequisites

The following are required before running this workflow:

  • Node.js 18 or higher installed on your machine
  • n8n running locally via npx n8n or Docker
  • A free webhook.site account (no sign-up required)
  • Browser access to http://localhost:5678 (the n8n editor)
💻 Quick Install Run this in your terminal to start n8n instantly:

npx n8n

Or with Docker:
docker run -it --rm -p 5678:5678 n8nio/n8n

3. Step-by-Step Explanation

1
Create a New Workflow
Open the n8n editor and set up a blank canvas

Log into your n8n editor at http://localhost:5678. From the left sidebar, click Workflows and then the + New Workflow button. You will be presented with a blank canvas. This is where your automation pipeline is built visually by connecting nodes.

  • Click ‘+ New workflow’ in the top left
  • Name the workflow (e.g., ‘Joke Bot’) by clicking the title at the top
  • Click Save to create it
2
Add the Schedule Trigger
Automatically start the workflow every minute

The Schedule Trigger is the entry point of the workflow. It fires automatically at a set interval without any manual action. This replaces webhooks or external event triggers when you want a time-based automation.

  • Click the large ‘+’ button in the center of the canvas
  • Search for ‘Schedule’ in the node panel
  • Select Schedule Trigger
  • In the node settings, set Trigger Interval to Every 1 Minute
  • Click Save
💡 Why Schedule Trigger? The Schedule Trigger is ideal for polling tasks, periodic reports, and recurring automations. It runs on n8n’s internal clock, requires no external service, and works perfectly for demos and production alike.
3
Add HTTP Request Node (GET)
Fetch a random joke from a free public API

The HTTP Request node is one of n8n’s most versatile nodes. It can call any REST API using GET, POST, PUT, DELETE, and other methods. Here it fetches a random joke from a free, public, no-auth-required endpoint.

  • Click ‘+’ on the right side of the Schedule Trigger node
  • Search for ‘HTTP Request’ and select it
  • Set Method to GET
  • Set URL to the following endpoint:
https://official-joke-api.appspot.com/random_joke
  • Click ‘Test step’ — the output panel will show a JSON response

The API returns a JSON object with the following shape:

{
  "id": 23,
  "type": "general",
  "setup": "Why did the scarecrow win an award?",
  "punchline": "Because he was outstanding in his field."
}
✅ Expected Output After clicking ‘Test step’, you should see 1 item in the output panel with setup and punchline fields. If you see an error, verify your internet connection and that the URL is entered exactly as shown above.
4
Add Code Node (JavaScript)
Transform the API response into a formatted message

The Code node allows you to write custom JavaScript to manipulate data between nodes. It receives the output from the previous node via the built-in $input variable and must return an array of objects with a json key.

  • Click ‘+’ after the HTTP Request node
  • Search for ‘Code’ and select the Code node
  • In the code editor, replace all existing code with the following:
const joke = $input.first().json;
return [{
  json: {
    message: "😂 " + joke.setup + " 👉 " + joke.punchline,
    timestamp: new Date().toISOString()
  }
}];
  • Click ‘Test step’ to verify the output

Key concepts in this code:

  • $input.first().json — accesses the first item from the previous node’s JSON output
  • joke.setup and joke.punchline — are fields from the HTTP Request response
  • The message field concatenates both fields with emoji separators
  • timestamp records when the joke was fetched using ISO 8601 format
  • The return array format is required by n8n’s Code node
⚠️ Important: Avoid raw newlines in strings Do not use \n inside the message string. Raw newline characters are invalid in JSON body fields and will cause a ‘Bad control character’ error in the HTTP POST node. Use a space or emoji separator instead.
5
Add HTTP Request Node (POST)
Send the formatted joke to webhook.site

This node sends the formatted joke to an external endpoint using an HTTP POST request. For this demo, webhook.site is used as a free, real-time receiver that confirms delivery without needing a backend server.

  • Go to webhook.site in your browser — copy your unique URL from the top of the page
  • Click ‘+’ after the Code node and add another HTTP Request node
  • Set Method to POST
  • Paste your webhook.site URL into the URL field
  • Under Body Content Type, select JSON
  • Under Specify Body, select Using Fields
  • Add a field: Name = text, Value = {{ $json.message }}
  • Click ‘Test step’

Your webhook.site dashboard will immediately show a new incoming request with the joke in the body. The request body should look like:

{
  "text": "😂 Why did the scarecrow win an award? 👉 Because he was outstanding in his field."
}
💡 Why ‘Using Fields’ instead of ‘Using JSON’? When using ‘Using JSON’ mode, you type raw JSON including the n8n expression {{ $json.message }}. If the message contains special characters, JSON parsing fails. ‘Using Fields’ mode lets n8n handle escaping automatically, making it safer for dynamic content.
ℹ️ About the webhook.site response message webhook.site returns a 200 OK with the message ‘This URL has no default content configured.’ This is expected and normal — it means your data was received successfully. It is not an error.
6
Test the Full Workflow
Run all nodes end-to-end before activating

Before activating the workflow to run automatically, test the entire pipeline manually to confirm every node executes without errors.

  • Click ‘Test workflow’ in the top toolbar (not ‘Test step’)
  • Watch all four nodes light up green in sequence
  • Click each node to inspect its input and output data
  • Verify on webhook.site that a new request appeared with the correct joke

If any node shows a red error indicator:

  • Click the red node to read the error message
  • For HTTP GET errors: verify the API URL is correct and you have internet access
  • For Code node errors: check the JavaScript syntax carefully
  • For HTTP POST errors: confirm your webhook.site URL is pasted correctly
7
Activate the Workflow
Turn on automatic execution every minute

Once the full test passes, activate the workflow so it runs automatically on the configured schedule. No manual intervention is required after this point.

  • Click the toggle switch in the top-right corner of the editor
  • The switch turns green and shows ‘Active’
  • n8n will now fire the workflow every 60 seconds automatically
  • To view execution history, click ‘Executions’ in the left sidebar
  • Each run shows its status, duration, and the data that flowed through each node
🎉 Workflow is now live Your automation is fully active. Every minute it fetches a new joke, formats it, and POSTs it to webhook.site. You can monitor all executions in the Executions panel and deactivate at any time using the same toggle.

4. Troubleshooting Reference

ErrorFix
Bad control character in JSON Remove \n from the Code node message string. Use a space or emoji separator instead of newlines.
This URL has no default content configured Not an error. webhook.site received your data. Check the left panel of webhook.site for the incoming request.
HTTP Request: ENOTFOUND Cannot reach the API. Check your internet connection and verify the URL spelling.
Code node: Cannot read property of undefined $input.first().json is undefined. Run the HTTP GET node first so data flows in before testing the Code node.
Workflow not triggering automatically Confirm the toggle in the top-right is green (Active). Check the Executions panel for failed runs.

5. What to Build Next

Now that the first workflow is running, here are ideas to extend it or build new ones:

🔀 Swap the Destination

  • Replace webhook.site with a Slack node to post jokes to a channel
  • Use the Gmail node to email the joke to yourself daily
  • Use the Telegram node to send to a Telegram bot

⚡ Swap the Trigger

  • Change to a Webhook Trigger to fire on demand via a URL
  • Use the Gmail Trigger to process new emails automatically
  • Use the Cron node for complex schedules (e.g., weekdays at 9am)

🧠 Add Logic

  • Add an IF node to filter jokes by type
  • Add a Google Sheets node to log every joke with its timestamp
  • Add error handling with an alert branch on failure

📚 n8n Resources

Scroll to Top