{
  "name": "LinkBit — Shorten URL",
  "nodes": [
    {
      "parameters": {},
      "id": "a1b2c3d4-0001-4000-8000-000000000001",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [0, 0]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "dest",
              "name": "destination",
              "value": "https://example.com/campaign",
              "type": "string"
            },
            {
              "id": "slug",
              "name": "slug",
              "value": "",
              "type": "string"
            },
            {
              "id": "utm_source",
              "name": "utm_source",
              "value": "n8n",
              "type": "string"
            },
            {
              "id": "utm_medium",
              "name": "utm_medium",
              "value": "automation",
              "type": "string"
            },
            {
              "id": "utm_campaign",
              "name": "utm_campaign",
              "value": "",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000002",
      "name": "Set URL fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [240, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://linkbit.live/api/v1/links",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "slk_YOUR_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"destination\": {{ JSON.stringify($json.destination) }},\n  \"slug\": {{ $json.slug ? JSON.stringify($json.slug) : \"null\" }},\n  \"utm_source\": {{ $json.utm_source ? JSON.stringify($json.utm_source) : \"null\" }},\n  \"utm_medium\": {{ $json.utm_medium ? JSON.stringify($json.utm_medium) : \"null\" }},\n  \"utm_campaign\": {{ $json.utm_campaign ? JSON.stringify($json.utm_campaign) : \"null\" }}\n}",
        "options": {}
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000003",
      "name": "Shorten URL",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [480, 0],
      "notesInFlow": true,
      "notes": "Replace slk_YOUR_API_KEY with your LinkBit API key from linkbit.live → API Keys."
    }
  ],
  "connections": {
    "When clicking ‘Test workflow’": {
      "main": [[{ "node": "Set URL fields", "type": "main", "index": 0 }]]
    },
    "Set URL fields": {
      "main": [[{ "node": "Shorten URL", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
