{
  "id": "tCu3Jd22KswAFsvp",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "SE Ranking AI Search Overview with Summarizer using OpenAI GPT 4.1-mini",
  "tags": [],
  "nodes": [
    {
      "id": "9ee6b226-3cb9-4489-80c4-9ed72492abf4",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -960,
        32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "80cd18f5-7ff1-4d1c-9c35-ba1582b7af0d",
      "name": "Set the Input Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -736,
        32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "51fefe77-637c-456c-b037-e53b76e74fc5",
              "name": "target_site",
              "type": "string",
              "value": "seranking.com"
            },
            {
              "id": "24725cc6-edeb-4c8d-b8e7-31d58ae53822",
              "name": "engine",
              "type": "string",
              "value": "ai-overview"
            },
            {
              "id": "cf825d67-60e7-4505-b6be-d67d0fb8f98f",
              "name": "source",
              "type": "string",
              "value": "us"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5219c606-c6e5-4a5d-a705-886d163b27b7",
      "name": "SE Ranking AI Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -512,
        32
      ],
      "parameters": {
        "url": "https://api.seranking.com/v1/ai-search/overview/by-engine/time-series",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "target",
              "value": "={{ $json.target_site }}"
            },
            {
              "name": "source",
              "value": "={{ $json.source }}"
            },
            {
              "name": "engine",
              "value": "={{ $json.engine }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 4.3
    },
    {
      "id": "41f92bdd-f89d-43d7-8d37-0674e89b7188",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -256,
        240
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "5b85bcfd-3a65-491f-bf91-52f324ea2918",
      "name": "SE Ranking AI Summarizer",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -256,
        32
      ],
      "parameters": {
        "text": "=Use the following JSON to come up with an overview. Provide a human friendly descrptive and comprehensive summary\n{{ $json.time_series.toJsonString() }}",
        "options": {},
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"comprehensive_summary\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n      \"abstract_summary\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 1.2
    },
    {
      "id": "5bd11d2e-32fa-4628-bfcb-89a5d7cc0218",
      "name": "Enrich Data",
      "type": "n8n-nodes-base.code",
      "position": [
        96,
        32
      ],
      "parameters": {
        "jsCode": "return [{\n  \"time_series\": $('SE Ranking AI Request').first().json.time_series,\n  \"summary\": $input.first().json.output\n}]"
      },
      "retryOnFail": false,
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "c227432f-a1f3-46ca-bb5b-a96db7dc7161",
      "name": "Write File to Disk",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        544,
        32
      ],
      "parameters": {
        "options": {},
        "fileName": "=C:\\\\SERanking_Search.json",
        "operation": "write",
        "dataPropertyName": "=data"
      },
      "typeVersion": 1
    },
    {
      "id": "5903cba2-09ed-4d64-a94f-494d04a53683",
      "name": "Create a Binary Data",
      "type": "n8n-nodes-base.function",
      "position": [
        320,
        32
      ],
      "parameters": {
        "functionCode": "items[0].binary = {\n  data: {\n    data: new Buffer(JSON.stringify(items[0].json, null, 2)).toString('base64')\n  }\n};\nreturn items;"
      },
      "typeVersion": 1
    },
    {
      "id": "a3e6729c-e35e-42b6-a975-306e552985c2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 496,
        "content": "## Data Enrichment\n\nCombines raw SE Ranking metrics with OpenAI-generated summaries. Transforms analytical data into human-readable insights."
      },
      "typeVersion": 1
    },
    {
      "id": "59feb86e-335f-449f-8b8a-79384bbe1bf1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 496,
        "content": "## Export Data Handling\n\nConverts enriched results into structured JSON output. Stores the final data for reporting and downstream automation."
      },
      "typeVersion": 1
    },
    {
      "id": "e4eee63e-85ab-4143-939f-2b5d595632db",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 464,
        "height": 496,
        "content": "## AI Search with SE Ranking\n\nFetches AI search visibility and time-series data from SE Ranking based on target site and region. Acts as the primary data source for AI-powered search insights."
      },
      "typeVersion": 1
    },
    {
      "id": "ee9f932c-c86a-4a9a-9557-843a0dae1275",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -80
      ],
      "parameters": {
        "width": 496,
        "height": 720,
        "content": "## **How It Works**\n\nThis workflow automates AI-powered search insights by combining SE Ranking AI Search data with OpenAI summarization. It starts with a manual trigger and fetches the time-series AI visibility data via the SE Ranking API. The response is summarized using OpenAI to produce both detailed and concise insights. \n## **Setup Instructions**\n\n1. Import the workflow JSON into your n8n instance.\n2. Configure credentials:\n\n   * **SE Ranking API** via HTTP Header Authentication.\n   * **OpenAI API** for the summarization node.\n3. Update the input fields (target site, engine, source) in the \u201cSet the Input Fields\u201d node as needed.\n4. Verify the file path in the \u201cWrite File to Disk\u201d node matches your environment.\n5. Click **Execute Workflow** to run the pipeline.\n\n## **Customize**\n\n* Change the `target_site`, `engine`, or `source` to analyze different domains, AI engines, or regions.\n* Adjust the OpenAI prompt or schema to generate different summary formats or additional insights.\n* Replace the file output node with database, cloud storage, or webhook nodes for integration with dashboards or BI tools.\n* Schedule the workflow to run periodically for automated SEO and AI search monitoring.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "de41f1c0-c715-453a-ab6f-f382e161d248",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -336
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 240,
        "content": "![Logo](https://media.licdn.com/dms/image/v2/D4D0BAQHBbVpuDD3toA/company-logo_200_200/company-logo_200_200/0/1725976307233/se_ranking_logo?e=1768435200&v=beta&t=_HSGZks62sL6rTXwuo0U21QCKBCNzVT_8OkeIPUr4N8)\n\nOpenAI GPT-4o-mini for the Structured Data Extraction and Data Mining Purposes"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "768dc84a-4533-414b-81b0-51b4e5234834",
  "connections": {
    "Enrich Data": {
      "main": [
        [
          {
            "node": "Create a Binary Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "SE Ranking AI Summarizer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create a Binary Data": {
      "main": [
        [
          {
            "node": "Write File to Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the Input Fields": {
      "main": [
        [
          {
            "node": "SE Ranking AI Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SE Ranking AI Request": {
      "main": [
        [
          {
            "node": "SE Ranking AI Summarizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SE Ranking AI Summarizer": {
      "main": [
        [
          {
            "node": "Enrich Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Set the Input Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}