AutomationFlowsGeneral › Weather-Based Customer Segmentation

Weather-Based Customer Segmentation

Original n8n title: Weather Customer Segmentation

Weather Customer Segmentation. Uses httpRequest. Scheduled trigger; 5 nodes.

Cron / scheduled trigger★★★★☆ complexity5 nodesHTTP Request
General Trigger: Cron / scheduled Nodes: 5 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Weather Customer Segmentation",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      },
      "id": "1",
      "name": "Every 6 Hours",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://localhost:3001/api/user-locations"
      },
      "id": "2",
      "name": "Get User Locations",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://api.openweathermap.org/data/2.5/weather",
        "options": {
          "queryParameters": {
            "parameters": [
              {
                "name": "q",
                "value": "Auckland,NZ"
              },
              {
                "name": "appid",
                "value": "4621d4ed0b8ebe0607575eed1ffca8b7"
              },
              {
                "name": "units",
                "value": "metric"
              }
            ]
          }
        }
      },
      "id": "3",
      "name": "Get Auckland Weather",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// Customer segmentation based on weather\nconst locationData = $('Get User Locations').first().json;\nconst weatherData = $input.all()[0].json;\n\n// Simplified segmentation analysis\nfunction analyzeCustomerSegments(weather) {\n  const temp = weather.main.temp;\n  const condition = weather.weather[0].main;\n  \n  const segments = {\n    weatherSensitive: {\n      size: 35,\n      characteristics: ['Responsive to weather changes', 'Weather-driven purchases'],\n      recommendations: ['Target with weather-specific products', 'Send weather alerts']\n    },\n    opportunistic: {\n      size: 30,\n      characteristics: ['Takes advantage of good weather', 'Outdoor focused'],\n      recommendations: ['Promote outdoor products', 'Increase good weather marketing']\n    },\n    stable: {\n      size: 35,\n      characteristics: ['Consistent regardless of weather', 'Routine purchases'],\n      recommendations: ['Maintain consistent messaging', 'Focus on essentials']\n    }\n  };\n  \n  return segments;\n}\n\nconst segmentation = {\n  location: 'Auckland, NZ',\n  weather: {\n    temperature: weatherData.main.temp,\n    condition: weatherData.weather[0].description,\n    humidity: weatherData.main.humidity\n  },\n  segments: analyzeCustomerSegments(weatherData),\n  usersAffected: locationData.locations ? locationData.locations.reduce((sum, loc) => sum + loc.user_count, 0) : 2896,\n  timestamp: new Date().toISOString(),\n  confidence: 0.85\n};\n\nreturn [{ json: segmentation }];"
      },
      "id": "4",
      "name": "Generate Segmentation",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://localhost:3001/api/customer-segments",
        "requestMethod": "POST",
        "jsonParameters": true,
        "bodyParametersJson": "={{ JSON.stringify($json) }}",
        "options": {
          "headers": {
            "Content-Type": "application/json"
          }
        }
      },
      "id": "5",
      "name": "Store Segments",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1120,
        300
      ]
    }
  ],
  "connections": {
    "Every 6 Hours": {
      "main": [
        [
          {
            "node": "Get User Locations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get User Locations": {
      "main": [
        [
          {
            "node": "Get Auckland Weather",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Auckland Weather": {
      "main": [
        [
          {
            "node": "Generate Segmentation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Segmentation": {
      "main": [
        [
          {
            "node": "Store Segments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Weather Customer Segmentation. Uses httpRequest. Scheduled trigger; 5 nodes.

Source: https://github.com/Christo-Brits/AttributeAI/blob/b54f058384b3ac8d6d23b02265a682ebf68e5746/n8n-workflows/segmentation-fixed.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

WF-Main - XHS 主控制器. Uses scheduleTrigger, httpRequest, executeWorkflow, noOp. Scheduled trigger; 21 nodes.

HTTP Request
General

Dm-Profile-Visitors. Uses httpRequest, googleSheets. Scheduled trigger; 21 nodes.

HTTP Request, Google Sheets
General

RSS to Multi-Channel Social (X / LinkedIn / Discord). Uses stickyNote, scheduleTrigger, httpRequest. Scheduled trigger; 19 nodes.

HTTP Request
General

YouTube Channel to Notion. Uses stickyNote, scheduleTrigger, httpRequest, noOp. Scheduled trigger; 18 nodes.

HTTP Request
General

Automate Droplet Snapshots On Digitalocean. Uses httpRequest, stickyNote. Scheduled trigger; 17 nodes.

HTTP Request