{
  "id": "aKngpoWRoCj7Dgv7",
  "name": "Track Monthly Trending Topics with Exploding Topics API",
  "tags": [],
  "nodes": [
    {
      "id": "12573b9e-07a4-4aeb-b079-276895b24210",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -256
      ],
      "parameters": {
        "width": 384,
        "height": 480,
        "content": "## Monthly Schedule Trigger\n\nRuns the workflow once per month to pull fresh trending topic data."
      },
      "typeVersion": 1
    },
    {
      "id": "6fd22e13-1003-47b2-abfb-a8425ae50e65",
      "name": "Monthly Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -640,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "months",
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "f904c23d-988d-4a13-81af-0a2381ae80c9",
      "name": "Format Trend Rows",
      "type": "n8n-nodes-base.code",
      "position": [
        624,
        0
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json;\n\nlet response = input;\n\n// n8n returned the API response as a JSON string inside `data`\nif (typeof input.data === \"string\") {\n  response = JSON.parse(input.data);\n}\n\nconst trends = response.result || [];\n\nreturn trends.map((trend) => {\n  return {\n    json: {\n      keyword: trend.keyword,\n      path: trend.path,\n      description: trend.description,\n      categories: Array.isArray(trend.categories) ? trend.categories.join(\", \") : \"\",\n      date_added: trend.date_added ? new Date(trend.date_added * 1000).toISOString() : null,\n      search_volume: trend.absolute_volume,\n      growth_12m: trend.search_history && trend.search_history.growth\n        ? trend.search_history.growth[\"12\"]\n        : null,\n      trend_url: `https://explodingtopics.com/topic/${trend.path}`,\n    },\n  };\n});"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "4a05d87c-2996-4603-b5af-742cbe58e26d",
      "name": "Save or Update Trends in Data Table",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1056,
        0
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "keyword",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "keyword",
              "defaultMatch": false
            },
            {
              "id": "path",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "path",
              "defaultMatch": false
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "description",
              "defaultMatch": false
            },
            {
              "id": "categories",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "categories",
              "defaultMatch": false
            },
            {
              "id": "search_volume",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "search_volume",
              "defaultMatch": false
            },
            {
              "id": "growth_12m",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "growth_12m",
              "defaultMatch": false
            },
            {
              "id": "trend_url",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "trend_url",
              "defaultMatch": false
            },
            {
              "id": "date_added",
              "type": "dateTime",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "date_added",
              "defaultMatch": false
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "filters": {
          "conditions": [
            {
              "keyName": "path",
              "keyValue": "={{ $json.path }}"
            }
          ]
        },
        "options": {},
        "operation": "upsert",
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "fxw418QJDQTyTGE6",
          "cachedResultUrl": "/projects/veYLrOrn10awfjZx/datatables/fxw418QJDQTyTGE6",
          "cachedResultName": "Monthly Trending Topics"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "cddf3d1a-80a6-491f-9510-2130e7925492",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1888,
        -256
      ],
      "parameters": {
        "width": 1040,
        "height": 480,
        "content": "## Track Monthly Trending Topics with Exploding Topics API\n\n**Description:**  \nThis workflow automatically pulls trending topics from the Exploding Topics API every month, formats the results, and saves them into an n8n Data Table.\n\n---\n\n## Workflow Summary\n\nThis n8n workflow allows users to:\n\n1. Run automatically every month.\n2. Retrieve trending topic data from the Exploding Topics API.\n3. Format the API response into clean table rows.\n4. Save or update trends in an n8n Data Table.\n5. Avoid duplicate rows by matching topics by `path`.\n\n---\n\n## Setup Required\n\nOpen the **Configure API Parameters** node and replace `YOUR_EXPLODING_TOPICS_API_KEY` with your Exploding Topics Pro API key before running this workflow.\n\nYou can also update the category, trend type, timeframe, sort option, and result limit in the same node."
      },
      "typeVersion": 1
    },
    {
      "id": "1d80bf9d-5c71-4973-ae89-6d1d74f2ebeb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        -256
      ],
      "parameters": {
        "width": 384,
        "height": 480,
        "content": "## Get Trending Topics from Exploding Topics API\n\nSends a GET request to the `/topics` endpoint using your Exploding Topics Pro API key.\n\nReplace `YOUR_EXPLODING_TOPICS_API_KEY` before running."
      },
      "typeVersion": 1
    },
    {
      "id": "20adb606-da6c-40d9-b497-156217b0bad1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -256
      ],
      "parameters": {
        "width": 384,
        "height": 480,
        "content": "## Format Trend Rows\n\nExtracts the main trend fields from the API response and formats them for the data table."
      },
      "typeVersion": 1
    },
    {
      "id": "08954fcb-09fe-4bea-9042-b63bfe2cecf7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        -256
      ],
      "parameters": {
        "width": 384,
        "height": 480,
        "content": "## Save or Update Trends\n\nSaves trends into the `Monthly Trending Topics` data table.\n\nRows are matched by `path`, so repeated runs update existing rows instead of creating duplicates."
      },
      "typeVersion": 1
    },
    {
      "id": "e9d207fe-fb99-4c6e-a317-4e36937945f3",
      "name": "Get Trending Topics from ET API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        208,
        0
      ],
      "parameters": {
        "url": "https://api.explodingtopics.com/api/v1/topics",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "=api_key",
              "value": "={{ $json.api_key }}"
            },
            {
              "name": "type",
              "value": "={{ $json.type }}"
            },
            {
              "name": "categories",
              "value": "={{ $json.categories }}"
            },
            {
              "name": "sort",
              "value": "={{ $json.sort }}"
            },
            {
              "name": "timeframe",
              "value": "={{ $json.timeframe }}"
            },
            {
              "name": "limit",
              "value": "={{ $json.limit }}"
            }
          ]
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "ce042278-e5cd-454d-93fd-e7081d75bc27",
      "name": "Configure API Parameters",
      "type": "n8n-nodes-base.set",
      "position": [
        -224,
        0
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "{\n  \"api_key\":\"YOUR_EXPLODING_TOPICS_API_KEY\",\n  \"type\": \"exploding\",\n  \"categories\": \"technology\",\n  \"sort\": \"growth\",\n  \"timeframe\": 12,\n  \"limit\": 50\n}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "fb1fea28-3760-45fa-b8f1-94d9ce636e2f",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        -256
      ],
      "parameters": {
        "width": 384,
        "height": 480,
        "content": "## Configure API Parameters\n\nUpdate these values before running the workflow:\n\n- `api_key`: Your Exploding Topics Pro API key\n- `type`: Trend type, for example `exploding` or `all`\n- `categories`: Category to monitor, for example `technology`\n- `sort`: Sort order, for example `growth`\n- `timeframe`: Timeframe in months, for example `12`\n- `limit`: Number of trends to return, for example `50`"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "60ff7dfd-b9b9-4804-a669-05529b0e3d33",
  "connections": {
    "Format Trend Rows": {
      "main": [
        [
          {
            "node": "Save or Update Trends in Data Table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configure API Parameters": {
      "main": [
        [
          {
            "node": "Get Trending Topics from ET API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monthly Schedule Trigger": {
      "main": [
        [
          {
            "node": "Configure API Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Trending Topics from ET API": {
      "main": [
        [
          {
            "node": "Format Trend Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}