{
  "name": "Track new backlinks to your site and your competitors every week in Sheets and Slack",
  "nodes": [
    {
      "parameters": {
        "content": "## Track new backlinks to your site and your competitors every week in Google Sheets and Slack\n\n### Who's it for\nSEO consultants, link builders and site owners who want to know who started linking to them, and to their competitors, without an Ahrefs or Semrush seat. Competitors' new links are ready-made outreach targets.\n\n### How it works\n1. Every Monday at 8:00 the Schedule Trigger starts the workflow (or run it by hand).\n2. The **Settings** node holds your domain and your competitors, the look-back window in days and the minimum rank of a linking domain.\n3. The **Backlink Checker** Actor on Apify (`plainrows/backlink-checker`) returns only each target's backlinks first seen in the look-back window (`linkChange: new`), so you pay only for new links: linking page, anchor, dofollow, linking domain rank, spam score, first and last seen. One link per linking domain keeps the list readable.\n4. A Code node keeps links first seen inside the window, above your rank threshold and below your spam limit, and marks each one as yours or a competitor's.\n5. Every new link is appended to the `Backlinks` tab, and one Slack message summarises the week: your new links, then your competitors' (the outreach ideas). No new link, no message.\n\n### Requirements\n- An Apify account and its API token (the free Apify plan works but limits each run; a paid plan is recommended for weekly tracking).\n- A Google Sheets account and a spreadsheet with a tab named `Backlinks`.\n- A Slack workspace and the Slack credential in n8n.\n- The Apify node is the verified community node `@apify/n8n-nodes-apify` (available on n8n Cloud; on self-hosted n8n install it from Settings > Community nodes).\n\n### How to customize\n- Change `yourDomain`, `competitors` (comma-separated), `lookbackDays`, `minDomainRank` and `maxSpamScore` in **Settings**.\n- Raise `linksPerTarget` for big sites (each extra row has a small price; see the Actor's Pricing tab).\n- Replace Slack with e-mail, or drop the Slack branch to only keep the sheet.\n\n**Cost:** a fee per domain checked plus a price per new backlink (see the Actor's Pricing tab; about $1 a month for one site with up to 100 new links a week); the Apify node caps each run with *Maximum Cost per Run*.",
        "height": 760,
        "width": 520
      },
      "id": "fd6f1156-4daa-58b8-a1b1-607c33bb5024",
      "name": "Description",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -660,
        -340
      ]
    },
    {
      "parameters": {
        "content": "### Setup\\n1. Spreadsheet with a tab named `Backlinks` (headers are written on the first run).\\n2. Connect Google Sheets in *Append new links* and paste the spreadsheet URL.\\n3. Add your Apify credential to *Get newest backlinks*.\\n4. Connect Slack and pick the channel in *Post to Slack*.\\n5. In **Settings**, put `yourDomain` and `competitors` (comma-separated).\\n\\n**Cost:** a price per backlink row plus a fee per domain checked (see the Actor's Pricing tab); the node caps each run with *Maximum Cost per Run*.",
        "height": 360,
        "width": 420,
        "color": 7
      },
      "id": "59479cdc-a7de-5c1e-a19c-1cb797336912",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        440,
        -340
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 8
            }
          ]
        }
      },
      "id": "f7761fc9-4de3-5b25-a316-b17efabf8c14",
      "name": "Every Monday 8:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        120
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2bc1eac1-f6cd-54f2-ba80-fa667a519625",
              "name": "yourDomain",
              "value": "example.com",
              "type": "string"
            },
            {
              "id": "b2b51ece-5dab-55f5-b7f6-94dd361c1f00",
              "name": "competitors",
              "value": "competitor-one.com, competitor-two.com",
              "type": "string"
            },
            {
              "id": "3e2d7b19-2d02-5801-89c3-0400f5c0c00f",
              "name": "lookbackDays",
              "value": 7,
              "type": "number"
            },
            {
              "id": "4703a7fd-a31d-5086-b164-6b2d22b7673d",
              "name": "minDomainRank",
              "value": 10,
              "type": "number"
            },
            {
              "id": "d3fda88f-87c2-53c6-8483-c800a6e8801d",
              "name": "maxSpamScore",
              "value": 30,
              "type": "number"
            },
            {
              "id": "419b6b0c-0f54-5575-8b24-1a69a55776c6",
              "name": "linksPerTarget",
              "value": 100,
              "type": "number"
            }
          ]
        },
        "options": {}
      },
      "id": "46cd4202-0859-5f0d-a950-9c0f3f62485c",
      "name": "Settings",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        120
      ]
    },
    {
      "parameters": {
        "resource": "Actors",
        "operation": "Run actor and get dataset",
        "actorId": "plainrows~backlink-checker",
        "customBody": "={{ JSON.stringify({ targets: [$json.yourDomain, ...$json.competitors.split(',')].map((d) => d.trim()).filter(Boolean), mode: 'backlinks', sortBy: 'newest', onePerDomain: true, linkChange: 'new', changedWithinDays: Math.min(365, Math.max(1, Number($json.lookbackDays) || 7)), maxResultsPerTarget: $json.linksPerTarget }) }}",
        "maxTotalChargeUsd": 1
      },
      "id": "af7ecbd8-63d1-524c-a94f-356a8311ae26",
      "name": "Get newest backlinks",
      "type": "@apify/n8n-nodes-apify.apify",
      "typeVersion": 1,
      "position": [
        440,
        120
      ],
      "credentials": {
        "apifyApi": {
          "id": "",
          "name": "Apify account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Keep links first seen inside the window, from a strong enough, non-spammy linking domain.\nconst s = $('Settings').first().json;\nconst since = Date.now() - (Number(s.lookbackDays) || 7) * 86400000;\nconst minRank = Number(s.minDomainRank) || 0;\nconst maxSpam = s.maxSpamScore === '' || s.maxSpamScore == null ? 100 : Number(s.maxSpamScore);\nconst own = String(s.yourDomain).trim().toLowerCase().replace(/^https?:\\/\\//, '').replace(/^www\\./, '').replace(/\\/.*$/, '');\nconst date = new Date().toISOString().slice(0, 10);\nconst out = [];\nfor (const { json: l } of $input.all()) {\n  if (l.found === false || !l.firstSeen) continue;\n  if (Date.parse(l.firstSeen) < since) continue;\n  if ((l.sourceDomainRank ?? 0) < minRank) continue;\n  if ((l.spamScore ?? 0) > maxSpam) continue;\n  const target = String(l.target || '').toLowerCase().replace(/^www\\./, '');\n  out.push({ json: {\n    date, whose: target === own ? 'yours' : 'competitor', target: l.target,\n    linkingDomain: l.sourceDomain, linkingPage: l.sourceUrl, pageTitle: l.sourceTitle ?? null,\n    anchor: l.anchor ?? null, dofollow: l.dofollow, domainRank: l.sourceDomainRank ?? null,\n    spamScore: l.spamScore ?? null, firstSeen: String(l.firstSeen).slice(0, 10), linksTo: l.targetUrl,\n  } });\n}\nreturn out;"
      },
      "id": "336151dd-c193-5183-8db8-ee9a4b432779",
      "name": "Keep new links",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        120
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "Backlinks",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      },
      "id": "b839fc1b-2b86-5a6d-8944-5779da728755",
      "name": "Append new links",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        880,
        0
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// One Slack message for the week; nothing is sent when there is no new link.\nconst links = $input.all().map((i) => i.json).sort((a, b) => (b.domainRank ?? 0) - (a.domainRank ?? 0));\nif (!links.length) return [];\nconst line = (l) => `• <${l.linkingPage}|${l.linkingDomain}> (rank ${l.domainRank ?? '?'}${l.dofollow ? '' : ', nofollow'}) → ${l.linksTo}${l.anchor ? ` _\"${String(l.anchor).slice(0, 60)}\"_` : ''}`;\nconst mine = links.filter((l) => l.whose === 'yours');\nconst theirs = links.filter((l) => l.whose === 'competitor');\nconst parts = [`:link: *New backlinks this week*: ${mine.length} to you, ${theirs.length} to competitors`];\nif (mine.length) parts.push(`*Yours*\\n${mine.slice(0, 15).map(line).join('\\n')}`);\nif (theirs.length) parts.push(`*Competitors (outreach ideas)*\\n${theirs.slice(0, 15).map((l) => `${line(l)} [${l.target}]`).join('\\n')}`);\nparts.push('Full list in the Backlinks sheet.');\nreturn [{ json: { text: parts.join('\\n\\n') } }];"
      },
      "id": "c9150ccc-ad2f-5db3-a991-352090080682",
      "name": "Build Slack summary",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        240
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "",
          "mode": "list"
        },
        "text": "={{ $json.text }}",
        "otherOptions": {}
      },
      "id": "ce4d2d24-bc25-57f6-924f-c1c0cae51d10",
      "name": "Post to Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        1100,
        240
      ],
      "credentials": {
        "slackApi": {
          "id": "",
          "name": "Slack account"
        }
      }
    }
  ],
  "connections": {
    "Every Monday 8:00": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Settings": {
      "main": [
        [
          {
            "node": "Get newest backlinks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get newest backlinks": {
      "main": [
        [
          {
            "node": "Keep new links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep new links": {
      "main": [
        [
          {
            "node": "Append new links",
            "type": "main",
            "index": 0
          },
          {
            "node": "Build Slack summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Slack summary": {
      "main": [
        [
          {
            "node": "Post to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
