{
  "id": "d6sFA7oiPUa2x3lL",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Monitor toxic backlinks and receive weekly reports via email with DataForSEO",
  "tags": [],
  "nodes": [
    {
      "id": "c5bf5e7c-2f1c-4b06-b57b-457aba2c1b4b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        -112
      ],
      "parameters": {
        "color": 6,
        "width": 1104,
        "height": 368,
        "content": "## Get spam backlinks with DataForSEO\nCreate a DataForSEO connection, specify a Target Domain, and set up additional parameters if needed."
      },
      "typeVersion": 1
    },
    {
      "id": "1574b2d0-58e7-4b4b-8e25-ab9594fcb9b4",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -384,
        48
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "54ab08f7-38a1-4d5d-8e2b-d21a889a3bff",
      "name": "Create spreadsheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -448,
        512
      ],
      "parameters": {
        "title": "=Spam Backlinks to  {{ $('Get spam backlinks').item.json.tasks[0].data.target }} - {{ $now.format(\"yyyy-MM-dd\") }}",
        "options": {},
        "resource": "spreadsheet",
        "sheetsUi": {
          "sheetValues": [
            {
              "title": "Spam Backlinks"
            }
          ]
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "b5508803-54a2-4310-b34f-2f2e43b4f1b2",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        896,
        512
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Target",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Target",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Backlink",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Backlink",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Spam Score",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Spam Score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Backlink Rank",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Backlink Rank",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Domain from",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Domain from",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Domain from Rank",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Domain from Rank",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL from",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "URL from",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL from Rank",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "URL from Rank",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Backlink Is Broken",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Backlink Is Broken",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Backlinks Is Dofollow",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Backlinks Is Dofollow",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create spreadsheet').item.json.sheets[0].properties.sheetId }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create spreadsheet').item.json.spreadsheetId }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "0a62dc46-24e8-4aca-9649-73c1bfc34fde",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1120,
        512
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "a6d1b8be-4757-4301-a784-be2345355e7d",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1344,
        512
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=<html> <body> <p>Here is your weekly spam backlinks report for {{ $('Get spam backlinks').item.json.tasks[0].data.target }}.</p>  <p>During the past week, we identified {{ $('Get spam backlinks').item.json.tasks[0].result[0].total_count }} potentially harmful backlinks based on the configured spam criteria.</p>  You can review the full list here: <a href=\"{{ $('Create spreadsheet').item.json.spreadsheetUrl }}\">Spam Backlinks to  {{ $('Get spam backlinks').item.json.tasks[0].data.target }} - {{ $now.format(\"yyyy-MM-dd\") }}</a> </body> </html>",
        "options": {},
        "subject": "=Spam Backlinks to {{ $('Get spam backlinks').item.json.tasks[0].data.target }} - {{ $now.format(\"yyyy-MM-dd\") }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "de159a62-9959-4a26-993f-1bd86b576cb0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        336
      ],
      "parameters": {
        "color": 6,
        "width": 2192,
        "height": 368,
        "content": "## Create a Google Sheet with spam backlinks and send it via email\nCreate a Google Sheets connection.\nCreate a Gmail connection and set a receiver."
      },
      "typeVersion": 1
    },
    {
      "id": "143e92fd-4e07-4634-a3f1-575877888330",
      "name": "Initialize \"items\" field",
      "type": "n8n-nodes-base.set",
      "position": [
        -160,
        48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0126c659-03a5-4fc8-bd76-62d2ecea1195",
              "name": "items",
              "type": "array",
              "value": "={{ [] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "025a83b7-f7f8-4818-abab-889246e12332",
      "name": "Set \"items\" field",
      "type": "n8n-nodes-base.set",
      "position": [
        64,
        48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4b3c95a2-4e38-4e37-8e2f-a7e4544808d6",
              "name": "items",
              "type": "array",
              "value": "={{ $json.items }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e1af9f42-03fc-4281-9785-a65b5db34b67",
      "name": "Get spam backlinks",
      "type": "n8n-nodes-dataforseo.dataForSeoBacklinksApi",
      "position": [
        288,
        -32
      ],
      "parameters": {
        "limit": 1000,
        "offset": "={{ $runIndex * 1000 }}",
        "target": "=dataforseo.com",
        "filters": "=[[\"backlink_spam_score\", \">\", 50], \"and\", [\"first_seen\", \">\", \"{{ $now.minus(7, \"days\").format(\"yyyy-MM-dd\") }}\"]]",
        "operation": "get-backlinks",
        "include_indirect_links": false
      },
      "credentials": {
        "dataForSeoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "911e9d7d-d7be-4710-a52a-4f539edc9590",
      "name": "Merge \"items\" with DFS response",
      "type": "n8n-nodes-base.set",
      "position": [
        512,
        -32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ddd82419-e43e-44d8-919c-2d6602704da5",
              "name": "items",
              "type": "array",
              "value": "={{ [ ...$('Set \"items\" field').item.json.items, ...$json.tasks[0].result[0].items] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b61dac6d-6076-49dc-8604-088b4f930a0a",
      "name": "Has more pages?",
      "type": "n8n-nodes-base.if",
      "position": [
        736,
        48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cd5943f7-df0b-4329-8436-9a1af3ec7caf",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $runIndex }}",
              "rightValue": "={{ $('Get spam backlinks').item.json.tasks[0].result[0].total_count / 1000 - 1}}"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "7a07517d-47b3-4af0-a99e-3f9b8f580f34",
      "name": "Filter (has spam backlinks)",
      "type": "n8n-nodes-base.filter",
      "position": [
        -672,
        512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "648f4d1e-367c-41b2-b223-1363dadc2cc8",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $('Get spam backlinks').item.json.tasks[0].result[0].total_count }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "355730f9-841a-4e33-b282-e8982d791068",
      "name": "Set final \"items\" field",
      "type": "n8n-nodes-base.set",
      "position": [
        224,
        512
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1e2c8353-5628-4948-abe6-35f8d0f660a5",
              "name": "items",
              "type": "array",
              "value": "={{ [...$('Set \"items\" field').item.json.items, ... $('Get spam backlinks').item.json.tasks[0].result[0].items]}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8d1c194d-e97a-445a-bab9-98cd5171ae51",
      "name": "Prepare data for Google Sheet",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        512
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={\n  \"Date\": \"{{ $now.format('yyyy-MM-dd') }}\",\n  \"Target\": \"{{ $('Get spam backlinks').item.json.tasks[0].data.target }}\",\n  \"Backlink\": \" {{ $json.url_to }}\",\n  \"Spam Score\": \"{{ $json.backlink_spam_score }}\",\n  \"Backlink Rank\": \"{{ $json.rank }}\",\n  \"Domain from\": \"{{ $json.domain_from }}\",\n  \"Domain from Rank\": \"{{ $json.domain_from_rank }}\",\n  \"URL from\": \"{{ $json.url_from }}\",\n  \"URL from Rank\": \"{{ $json.page_from_rank }}\",\n  \"Backlink Is Broken\":\"{{ $json.is_broken }}\",\n  \"Backlinks Is Dofollow\":\"{{ $json.dofollow }}\"\n}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "0df58d2f-d1c0-43da-8f99-1d49bc5ddfe6",
      "name": "Prepare columns for Google Sheet",
      "type": "n8n-nodes-base.set",
      "position": [
        -224,
        512
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "{\n  \"Date\": \"\",\n  \"Target\": \"\",\n  \"Backlink\": \"\",\n  \"Spam Score\": \"\",\n  \"Backlink Rank\": \"\",\n  \"Domain from\": \"\",\n  \"Domain from Rank\": \"\",\n  \"URL from\": \"\",\n  \"URL from Rank\": \"\",\n  \"Backlink Is Broken\":\"\",\n  \"Backlinks Is Dofollow\":\"\"\n}\n"
      },
      "typeVersion": 3.4
    },
    {
      "id": "062f3280-4aac-4f82-ae35-2b2a8c1abcfe",
      "name": "Append columns",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        0,
        512
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create spreadsheet').item.json.sheets[0].properties.sheetId }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create spreadsheet').item.json.spreadsheetId }}"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "bb6fdaa5-6e1e-4e6d-9528-57cbdedf633a",
      "name": "Split out items",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        448,
        512
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "items"
      },
      "typeVersion": 1
    },
    {
      "id": "735ccf46-4ccd-4872-af80-f96f1fb6c735",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        -96
      ],
      "parameters": {
        "width": 448,
        "height": 528,
        "content": "This workflow runs weekly and uses the DataForSEO Backlinks API to automatically retrieve suspicious backlinks (filtered by a spam score threshold) pointing to your domain, then it generates a toxic backlink report and emails the results to you for a quick review.\n\n## How it works\n1. Triggers automatically on a weekly schedule.\n2. Fetches backlinks for your domain or URL using the DataForSEO Backlinks API.\n3. Filters backlinks by spam score threshold (default: >50).\n4. Extracts suspicious backlinks and key metrics (source URL, spam score, DR, etc.).\n5. Builds a structured weekly report in Google Sheets.\n6. Emails you the report via Gmail.\n\n## Setup steps\n1. Create or select your DataForSEO connection (use [your API login and password](https://app.dataforseo.com/api-access)).\n2. Indicate your target domain.\n3. Connect Google Drive and choose a folder. \n4. Connect Gmail and choose who gets the message.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5b501b23-2f7b-445c-b375-c251a90e95f5",
  "connections": {
    "Aggregate": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append columns": {
      "main": [
        [
          {
            "node": "Set final \"items\" field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has more pages?": {
      "main": [
        [
          {
            "node": "Set \"items\" field",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Filter (has spam backlinks)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split out items": {
      "main": [
        [
          {
            "node": "Prepare data for Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Initialize \"items\" field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set \"items\" field": {
      "main": [
        [
          {
            "node": "Get spam backlinks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create spreadsheet": {
      "main": [
        [
          {
            "node": "Prepare columns for Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get spam backlinks": {
      "main": [
        [
          {
            "node": "Merge \"items\" with DFS response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set final \"items\" field": {
      "main": [
        [
          {
            "node": "Split out items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialize \"items\" field": {
      "main": [
        [
          {
            "node": "Set \"items\" field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter (has spam backlinks)": {
      "main": [
        [
          {
            "node": "Create spreadsheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare data for Google Sheet": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge \"items\" with DFS response": {
      "main": [
        [
          {
            "node": "Has more pages?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare columns for Google Sheet": {
      "main": [
        [
          {
            "node": "Append columns",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}