Skip to content
Daily API Digest

Module 02 · foundations · beginner

starter.json

In n8n, copy this file and paste it onto the canvas, or use Import from File.

{
  "name": "02 - Daily API Digest (starter)",
  "nodes": [
    {
      "parameters": {
        "path": "digest",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "m02-webhook",
      "name": "Digest API",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        200
      ],
      "webhookId": "course-02-digest"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "s1",
              "name": "min_points",
              "value": "={{ Number($json.query?.min_points ?? 100) }}",
              "type": "number"
            },
            {
              "id": "s2",
              "name": "top_n",
              "value": "={{ Number($json.query?.top ?? 5) }}",
              "type": "number"
            }
          ]
        },
        "options": {}
      },
      "id": "m02-settings",
      "name": "Settings",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        100
      ]
    },
    {
      "parameters": {
        "url": "https://hn.algolia.com/api/v1/search",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "tags",
              "value": "front_page"
            },
            {
              "name": "hitsPerPage",
              "value": "50"
            }
          ]
        },
        "options": {}
      },
      "id": "m02-http",
      "name": "Fetch Front Page",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        100
      ]
    },
    {
      "parameters": {
        "content": "## Your task\n1. Run **Fetch Front Page** and look at its output: one item with a `hits` array.\n2. Split `hits` into one item per story.\n3. Sort by points, keep stories with points >= `min_points`, keep the top `top_n`.\n4. Shape each story (title, url, points, comments, line).\n5. Aggregate into one digest and respond with JSON.\n\nTest: `curl 'http://localhost:5678/webhook-test/digest?top=3'`",
        "height": 260,
        "width": 420
      },
      "id": "starter-task-note",
      "name": "Your Task",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -340
      ]
    }
  ],
  "connections": {
    "Digest API": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Settings": {
      "main": [
        [
          {
            "node": "Fetch Front Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Front Page": {
      "main": [
        []
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  }
}