{
  "id": "9FRbZwuP5S45cQ3N",
  "name": "Stream Tech Trends to SwiftBar macOS Menu Bar via n8n Webhook (Requires Collector)",
  "tags": [],
  "nodes": [
    {
      "id": "6834ed43-0b48-49dd-ab5f-5a1529c89669",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -208
      ],
      "parameters": {
        "width": 480,
        "height": 736,
        "content": "## Stream Tech Trends to SwiftBar macOS Menu Bar via n8n Webhook (Requires Collector)\n\n### How it works\n\n1. The workflow is triggered via a webhook when a request is made to GET /tech-trends-swiftbar.\n2. Today's technology trends are retrieved and processed using the 'Get Todays Trends SwiftBar' node.\n3. The raw data is then formatted into a SwiftBar compatible output by the 'Format SwiftBar Output' node.\n4. The processed data is sent in response to the initial webhook request as JSON format suitable for SwiftBar.\n\n### Setup steps\n\n- [ ] Configure the GET /tech-trends-swiftbar webhook endpoint in your n8n instance.\n- [ ] Ensure the 'Get Todays Trends SwiftBar' node is correctly set up to pull the latest trends data.\n- [ ] Set up a custom function in 'Format SwiftBar Output'.\n- [ ] Verify that the final response in 'Respond with SwiftBar JSON' matches SwiftBar's expected format.\n\n### Customization\n\nAdjust the 'Format SwiftBar Output' node to change how trends are represented in the SwiftBar menu."
      },
      "typeVersion": 1
    },
    {
      "id": "53622bc6-0dec-43f2-9533-07148165282f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -208
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 384,
        "content": "## Webhook trigger initiation\n\nInitiates the workflow when a request is received at GET /tech-trends-swiftbar."
      },
      "typeVersion": 1
    },
    {
      "id": "4886f41d-08c3-4eee-8043-07b60132b81a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 304,
        "content": "## Fetch and process trends data\n\nRetrieves today's trends and formats them into SwiftBar output."
      },
      "typeVersion": 1
    },
    {
      "id": "f497dfac-722e-4a55-9bf6-08bc55fa0a3e",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 240,
        "height": 336,
        "content": "## Respond with formatted data\n\nSends the formatted trends data to SwiftBar."
      },
      "typeVersion": 1
    },
    {
      "id": "ffd9a975-e28a-4f89-9233-1ffedd503c98",
      "name": "Trigger Tech Trends Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        0
      ],
      "parameters": {
        "path": "141c67d5-2f52-4f95-83c0-56e0e990da0e",
        "options": {},
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "431c0372-8584-4edd-b642-8817682109f4",
      "name": "Fetch Trends DataTable",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        272,
        0
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "keyName": "date",
              "keyValue": "=2026-07-22"
            }
          ]
        },
        "matchType": "allConditions",
        "operation": "get",
        "returnAll": true,
        "dataTableId": {
          "__rl": true,
          "mode": "name",
          "value": "tech_trends"
        }
      },
      "typeVersion": 1.1,
      "alwaysOutputData": true
    },
    {
      "id": "1e857ed6-39ed-424f-8caa-27150412cefe",
      "name": "Format Trends for SwiftBar",
      "type": "n8n-nodes-base.code",
      "position": [
        496,
        0
      ],
      "parameters": {
        "jsCode": "const all = $input.all();\nconst rows = [];\nfor (let i = 0; i < all.length; i++) {\n  const item = all[i].json;\n  if (item && item.source) { rows.push(item); }\n}\nrows.sort(function(a, b) { return (b.score || 0) - (a.score || 0); });\nconst top = rows.slice(0, 10);\nconst lines = [\n  \"\ud83d\udcca DAILY TECH TRENDS | size=14 weight=bold color=#000000\",\n  \"---\",\n  \"\u2b50 TOP DISCOVERIES | size=12 weight=bold color=#FF4500\"\n];\nif (top.length === 0) {\n  lines.push(\"No data yet \u2014 run the Tech Trends Collector workflow first | size=13 color=#aaaaaa\");\n} else {\n  for (let i = 0; i < top.length; i++) {\n    const t = top[i];\n    const title = (t.title || \"Untitled\").replace(/|/g, \"-\");\n    lines.push((i + 1) + \". \" + title + \" | size=13 color=white\");\n  }\n}\nlines.push(\"---\");\nlines.push(\"\u2139\ufe0f System Details | size=11 color=#aaaaaa\");\nlines.push(\"\u2022 Powered by n8n | size=11 color=#aaaaaa\");\nreturn [{ json: { output: JSON.stringify(lines) } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "e1428299-05d3-402c-b4cb-0c1fb22422b0",
      "name": "Send JSON Response to SwiftBar",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        720,
        0
      ],
      "parameters": {
        "options": {
          "responseCode": 200,
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "application/json"
              },
              {
                "name": "Access-Control-Allow-Origin",
                "value": "*"
              }
            ]
          }
        },
        "respondWith": "text",
        "responseBody": "="
      },
      "typeVersion": 1.5
    }
  ],
  "active": true,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "43933795-1da8-4394-ada2-94848e0b69b4",
  "nodeGroups": [],
  "connections": {
    "Fetch Trends DataTable": {
      "main": [
        [
          {
            "node": "Format Trends for SwiftBar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Trends for SwiftBar": {
      "main": [
        [
          {
            "node": "Send JSON Response to SwiftBar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Tech Trends Webhook": {
      "main": [
        [
          {
            "node": "Fetch Trends DataTable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}