{
  "name": "Weather API \u2192 SMS Alert",
  "nodes": [
    {
      "parameters": {
        "url": "https://api.openweathermap.org/data/2.5/weather?q=YourCity&appid=YOUR_KEY",
        "options": {}
      },
      "id": "http",
      "name": "Fetch Weather",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const w=$input.first().json;\nconst severeIds=[200,201,202,210,211,212,221,230,231,232,502,503,504,511,781];\nif(severeIds.includes(w.weather[0].id)){return {alert:true,city:w.name,cond:w.weather[0].description,temp:(w.main.temp-273.15).toFixed(1)}};\nreturn {alert:false};"
      },
      "id": "check",
      "name": "Check Severity",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "if(!$input.first().json.alert) return [];\nconst a=$input.first().json;\nreturn [{json:{body:a.city+': '+a.cond+' at '+a.temp+'C. Take precautions.'}}];"
      },
      "id": "filter",
      "name": "Only Alerts",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "to": "+15550000000",
        "message": "={{ $json.body }}"
      },
      "id": "sms",
      "name": "Send SMS",
      "type": "n8n-nodes-base.twilio",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    }
  ],
  "connections": {
    "Fetch Weather": {
      "main": [
        [
          {
            "node": "Check Severity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Severity": {
      "main": [
        [
          {
            "node": "Only Alerts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only Alerts": {
      "main": [
        [
          {
            "node": "Send SMS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}