{
  "id": "kuQDth9MLLTrgJmM",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "SEO Keyword Research",
  "tags": [],
  "nodes": [
    {
      "id": "d32c9488-3d5a-4e1a-b691-0ac25231ab37",
      "name": "Wait 10s",
      "type": "n8n-nodes-base.wait",
      "position": [
        1216,
        520
      ],
      "parameters": {
        "amount": 15
      },
      "typeVersion": 1.1
    },
    {
      "id": "f4774b81-3879-4f9b-be61-6647b8476b95",
      "name": "Start workflow",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        544,
        520
      ],
      "parameters": {
        "options": {},
        "formTitle": "Seed Keyword",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Keyword"
            }
          ]
        },
        "formDescription": "Please provide a seed keyword. This is the base keyword which will be used to research matching keywords."
      },
      "typeVersion": 2.2
    },
    {
      "id": "e4a7284e-0fe4-4ea0-8c6f-3968002ae37e",
      "name": "Create a data table",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        2112,
        520
      ],
      "parameters": {
        "columns": {
          "column": [
            {
              "name": "term"
            },
            {
              "name": "intent"
            },
            {
              "name": "volume",
              "type": "number"
            },
            {
              "name": "language"
            },
            {
              "name": "difficulty"
            },
            {
              "name": "opportunity"
            },
            {
              "name": "funnel"
            },
            {
              "name": "group"
            },
            {
              "name": "cpc",
              "type": "number"
            }
          ]
        },
        "options": {},
        "resource": "table",
        "operation": "create",
        "tableName": "=Keyword Table:  {{ $(\"Start workflow\").item.json.Keyword }}({{ $('Perform Keyword Research').item.json.data.job_id }})"
      },
      "typeVersion": 1.1
    },
    {
      "id": "e86db863-b0a8-4e88-9a0a-93c269880001",
      "name": "Set Seed Keyword",
      "type": "n8n-nodes-base.set",
      "position": [
        768,
        520
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "websiteId",
              "type": "string",
              "value": "=KEUPERA_WEBSITE_ID"
            },
            {
              "id": "a2",
              "name": "seedKeywords",
              "type": "array",
              "value": "={{ [$json.Keyword] }}"
            },
            {
              "id": "a3",
              "name": "language",
              "type": "string",
              "value": "en"
            },
            {
              "id": "a4",
              "name": "country",
              "type": "string",
              "value": "US"
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "3b07f02b-4d8c-4203-8636-326c20ffe5e7",
      "name": "Perform Keyword Research",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        992,
        520
      ],
      "parameters": {
        "url": "https://app.keupera.com/api/v1/keywords/research",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ JSON.stringify({ seed_keywords: $('Set Seed Keyword').item.json.seedKeywords, website_id: $('Set Seed Keyword').item.json.websiteId, language: $('Set Seed Keyword').item.json.language, country: $('Set Seed Keyword').item.json.country }) }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer KEUPERA_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "46ff8964-bc9f-4e53-aef8-af62984e18eb",
      "name": "Poll Keyword Results",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1440,
        448
      ],
      "parameters": {
        "url": "=https://app.keupera.com/api/v1/keywords/research/{{ $('Perform Keyword Research').item.json.data.job_id }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer KEUPERA_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c6d59502-752a-4977-a58a-a3d3841800e7",
      "name": "Insert row",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        2336,
        520
      ],
      "parameters": {
        "columns": {
          "value": {
            "cpc": "={{ $('Split Keywords').item.json.cpc }}",
            "term": "={{ $('Split Keywords').item.json.term }}",
            "group": "={{ $('Split Keywords').item.json.keyword_group }}",
            "funnel": "={{ $('Split Keywords').item.json.funnel_stage }}",
            "intent": "={{ $('Split Keywords').item.json.intent }}",
            "volume": "={{ $('Split Keywords').item.json.volume }}",
            "language": "={{ $('Split Keywords').item.json.language }}",
            "difficulty": "={{ $('Split Keywords').item.json.difficulty }}",
            "opportunity": "={{ $('Split Keywords').item.json.opportunity }}"
          },
          "schema": [
            {
              "id": "term",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "term",
              "defaultMatch": false
            },
            {
              "id": "intent",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "intent",
              "defaultMatch": false
            },
            {
              "id": "volume",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "volume",
              "defaultMatch": false
            },
            {
              "id": "language",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "language",
              "defaultMatch": false
            },
            {
              "id": "difficulty",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "difficulty",
              "defaultMatch": false
            },
            {
              "id": "opportunity",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "opportunity",
              "defaultMatch": false
            },
            {
              "id": "funnel",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "funnel",
              "defaultMatch": false
            },
            {
              "id": "group",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "group",
              "defaultMatch": false
            },
            {
              "id": "cpc",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "cpc",
              "defaultMatch": false
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "d5856bfc-acbe-49b5-81e0-31d65ab25a89",
      "name": "Split Keywords",
      "type": "n8n-nodes-base.code",
      "position": [
        1888,
        520
      ],
      "parameters": {
        "jsCode": "const keywords = $input.first().json.data.result.keywords;\nreturn keywords.map(kw => ({ json: kw }));"
      },
      "typeVersion": 2
    },
    {
      "id": "8464a019-36ae-48f9-b8bc-f9eab0df1d0f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1824,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 700,
        "height": 488,
        "content": "### Store keyword results\n\nSplits the completed keyword response into individual rows, creates the destination data table, and inserts the parsed keyword records. You can change these nodes to store the keyword results wherever you like."
      },
      "typeVersion": 1
    },
    {
      "id": "63fe26fb-dd6a-4e49-96c7-a09b7ee2e0ce",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 896,
        "height": 488,
        "content": "### Run and poll research\n\nSubmits the keyword research request to the Keupera API, waits between checks, polls for results, and loops until the completion condition is met."
      },
      "typeVersion": 1
    },
    {
      "id": "4dea86f2-da94-4df0-8ae0-15a6e6c3b779",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        304
      ],
      "parameters": {
        "color": 7,
        "width": 436,
        "height": 488,
        "content": "### Capture search parameters\n\nStarts the workflow from a form submission and prepares the website ID, seed keywords, language, and country values used for the keyword research request."
      },
      "typeVersion": 1
    },
    {
      "id": "1e229efd-433b-4815-869a-b2d5399ac9fa",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        256
      ],
      "parameters": {
        "width": 692,
        "height": 604,
        "content": "## Automatic SEO Keyword Research \n\nFor this workflow, you need an active [Keupera \ud83e\udc65](https://keupera.com) account.\n\n\n### How it works\n\nThis automation works by entering a seed keyword into the form that opens once you execute the workflow. This keyword then gets passed to Keupera, an agentic SEO software, that automatically performs a keyword research based on the provided seed keyword. The waiting mechanism waits for a success response and then delivers the data to your desired destination. By default, we set it so that the results get stored inside a data table. You can adjust this step to send the results wherever you want.\n\n\n### Setup\n\n1\ufe0f\u20e3 **STEP:** Go to Settings -> Developers -> Get API Key and Website ID in the [Keupera Dashboard \ud83e\udc65](https://app.keupera.com/settings?tab=developer)\n\n2\ufe0f\u20e3 **STEP:** Update **KEUPERA_API_KEY** and **KEUPERA_WEBSITE_ID** in these nodes: \n- Set Seed Keyword\n- Perform Keyword Research\n- Poll Keyword Results\n\n3\ufe0f\u20e3 **STEP:** Set language (e.g. en) and country (e.g. US)\n\n\n### Ask Support\nNeed help? Contact [ask@support.keupera.com](ask@support.keupera.com)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e3008516-7198-4efa-b3e8-95d6bab72e55",
      "name": "Completed?",
      "type": "n8n-nodes-base.if",
      "position": [
        1664,
        520
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "47c9de28-b645-428c-8f1b-544bbc76710b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "completed"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "9dd7d367-7100-4c79-8604-f65bf3de6f8c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        -48
      ],
      "parameters": {
        "color": 5,
        "width": 528,
        "height": 336,
        "content": "### Video Tutorial\n@[youtube](0GttBu4iBac)"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "5845b27b-b6ed-4e5a-bced-eb609c61bdd3",
  "connections": {
    "Wait 10s": {
      "main": [
        [
          {
            "node": "Poll Keyword Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Completed?": {
      "main": [
        [
          {
            "node": "Split Keywords",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 10s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert row": {
      "main": [
        []
      ]
    },
    "Split Keywords": {
      "main": [
        [
          {
            "node": "Create a data table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start workflow": {
      "main": [
        [
          {
            "node": "Set Seed Keyword",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Seed Keyword": {
      "main": [
        [
          {
            "node": "Perform Keyword Research",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a data table": {
      "main": [
        [
          {
            "node": "Insert row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Poll Keyword Results": {
      "main": [
        [
          {
            "node": "Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perform Keyword Research": {
      "main": [
        [
          {
            "node": "Wait 10s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}