{
  "name": "TrendTrack — Brand Lookup → Webhook",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "trendtrack-brand-lookup",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "25f33a95-8f0c-4803-a661-366af762af02",
      "name": "Brand Lookup Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [240, 320]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "bde75a7e-2aa5-478a-ac0b-0e62c9058b26",
              "name": "query",
              "type": "string",
              "value": "={{ $json.body?.q || $json.body?.query || $json.body?.brand || $json.query?.q || \"\" }}"
            },
            {
              "id": "63c89eea-5934-4b74-83b0-234f7f93aab6",
              "name": "lookupType",
              "type": "string",
              "value": "={{ $json.body?.type || $json.query?.type || \"auto\" }}"
            },
            {
              "id": "a786588a-5a66-4658-a702-2776ea5913c6",
              "name": "limit",
              "type": "number",
              "value": "={{ Number($json.body?.limit || $json.query?.limit || 3) }}"
            }
          ]
        },
        "options": {}
      },
      "id": "dba6a139-cbea-43ab-8d6a-3a1902f64d6e",
      "name": "Normalize Input",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [480, 320]
    },
    {
      "parameters": {
        "url": "https://api.trendtrack.io/v1/lookup",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $json.query }}"
            },
            {
              "name": "type",
              "value": "={{ $json.lookupType }}"
            },
            {
              "name": "limit",
              "value": "={{ $json.limit }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $env.TRENDTRACK_API_KEY }}"
            }
          ]
        },
        "options": {}
      },
      "id": "bf915560-38e4-486f-8a22-97ad05441ffe",
      "name": "Lookup Brand",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [720, 320]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($json) }}",
        "options": {
          "responseCode": 200
        }
      },
      "id": "fcd7e11b-a87a-4dab-a88d-119bc2416539",
      "name": "Respond With Lookup",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [960, 320]
    }
  ],
  "connections": {
    "Brand Lookup Webhook": {
      "main": [
        [
          {
            "node": "Normalize Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Input": {
      "main": [
        [
          {
            "node": "Lookup Brand",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lookup Brand": {
      "main": [
        [
          {
            "node": "Respond With Lookup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "tags": []
}
