{ "kind": "open-flow-workflow", "version": 1, "name": "Weather Temperature to SIGNL4 Alert", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_d9a312b0d0582844": { "name": "Check weather now", "kind": "start", "inputDefs": [] }, "n_ffaea2a731695cbd": { "name": "Daily at 06:15 UTC", "kind": "cron", "cronTimes": [ { "type": "cron", "expression": "15 6 * * *", "timezone": "UTC" } ] }, "n_4c3e5069e17b6dec": { "inputs": { "q": { "kind": "value", "value": "Berlin" }, "units": { "kind": "value", "value": "metric" } }, "name": "Get current weather", "kind": "task", "task": { "inputs": [ { "description": "The city name, optionally followed by state code and country code, such as London,GB.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The city name, optionally followed by state code and country code, such as London,GB." }, "nullable": true, "handle": "q", "value": null }, { "description": "The OpenWeather city identifier.", "jsonSchema": { "type": "integer", "minimum": 0, "description": "The OpenWeather city identifier." }, "nullable": true, "handle": "id", "value": null }, { "description": "The ZIP or postal code followed by country code, such as 94040,US.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The ZIP or postal code followed by country code, such as 94040,US." }, "nullable": true, "handle": "zip", "value": null }, { "description": "The latitude in decimal degrees.", "jsonSchema": { "type": "number", "minimum": -90, "maximum": 90, "description": "The latitude in decimal degrees." }, "nullable": true, "handle": "lat", "value": null }, { "description": "The longitude in decimal degrees.", "jsonSchema": { "type": "number", "minimum": -180, "maximum": 180, "description": "The longitude in decimal degrees." }, "nullable": true, "handle": "lon", "value": null }, { "description": "The units of measurement for the response.", "jsonSchema": { "type": "string", "enum": [ "standard", "metric", "imperial" ], "description": "The units of measurement for the response." }, "nullable": true, "handle": "units", "value": null }, { "description": "The response language code in ISO 639-1 format.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The response language code in ISO 639-1 format." }, "nullable": true, "handle": "lang", "value": null } ], "outputs": [ { "description": "The current weather payload returned by OpenWeather.", "jsonSchema": { "type": "object", "properties": { "coord": { "type": "object", "properties": { "lon": { "type": "number", "description": "The longitude in decimal degrees." }, "lat": { "type": "number", "description": "The latitude in decimal degrees." } }, "required": [ "lon", "lat" ], "additionalProperties": true, "description": "The coordinates for the requested place." }, "weather": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "description": "The weather condition identifier." }, "main": { "type": "string", "description": "The group of weather parameters." }, "description": { "type": "string", "description": "The localized condition description." }, "icon": { "type": "string", "description": "The weather icon code." } }, "required": [ "id", "main", "description", "icon" ], "additionalProperties": true, "description": "A weather condition entry returned by OpenWeather." }, "description": "The weather conditions for the requested place." }, "base": { "type": "string", "description": "The internal base parameter returned by OpenWeather." }, "main": { "type": "object", "properties": { "temp": { "type": "number", "description": "The measured temperature." }, "feels_like": { "type": "number", "description": "The human-perceived temperature." }, "temp_min": { "type": "number", "description": "The minimum observed temperature." }, "temp_max": { "type": "number", "description": "The maximum observed temperature." }, "pressure": { "type": "number", "description": "The atmospheric pressure in hPa." }, "humidity": { "type": "number", "description": "The humidity percentage." }, "sea_level": { "type": "number", "description": "The sea-level pressure in hPa." }, "grnd_level": { "type": "number", "description": "The ground-level pressure in hPa." }, "temp_kf": { "type": "number", "description": "The internal forecast temperature correction." } }, "required": [ "temp", "feels_like", "temp_min", "temp_max", "pressure", "humidity" ], "additionalProperties": true, "description": "The main weather metrics." }, "visibility": { "type": "number", "description": "The visibility distance in metres." }, "wind": { "type": "object", "properties": { "speed": { "type": "number", "description": "The wind speed." }, "deg": { "type": "number", "description": "The wind direction in degrees." }, "gust": { "type": "number", "description": "The wind gust speed." } }, "required": [ "speed" ], "additionalProperties": true, "description": "The wind metrics." }, "rain": { "type": "object", "properties": { "1h": { "type": "number", "description": "The precipitation volume for the last hour." }, "3h": { "type": "number", "description": "The precipitation volume for the last three hours." } }, "additionalProperties": true, "description": "The rain volume summary." }, "snow": { "type": "object", "properties": { "1h": { "type": "number", "description": "The precipitation volume for the last hour." }, "3h": { "type": "number", "description": "The precipitation volume for the last three hours." } }, "additionalProperties": true, "description": "The snow volume summary." }, "clouds": { "type": "object", "properties": { "all": { "type": "number", "description": "The cloudiness percentage." } }, "required": [ "all" ], "additionalProperties": true, "description": "The cloud coverage summary." }, "dt": { "type": "integer", "minimum": 0, "description": "The calculation time as a Unix UTC timestamp." }, "sys": { "type": "object", "properties": { "type": { "type": "integer", "description": "The internal system type." }, "id": { "type": "integer", "description": "The internal system identifier." }, "country": { "type": "string", "description": "The ISO 3166 country code." }, "sunrise": { "type": "integer", "minimum": 0, "description": "The sunrise time as a Unix UTC timestamp." }, "sunset": { "type": "integer", "minimum": 0, "description": "The sunset time as a Unix UTC timestamp." } }, "required": [ "country", "sunrise", "sunset" ], "additionalProperties": true, "description": "The current weather system metadata." }, "timezone": { "type": "integer", "description": "The shift in seconds from UTC." }, "id": { "type": "integer", "description": "The OpenWeather city identifier." }, "name": { "type": "string", "description": "The place name returned by OpenWeather." }, "cod": { "type": "integer", "description": "The internal response code returned on success." } }, "required": [ "coord", "weather", "base", "main", "wind", "clouds", "dt", "sys", "timezone", "id", "name", "cod" ], "additionalProperties": true, "description": "The current weather payload returned by OpenWeather." }, "nullable": false, "handle": "output" } ], "name": "Get current weather", "executor": { "kind": "connector", "action": "openweather_api.get_current_weather", "outputMode": "value" } } }, "n_c0f2ca04f3d6920a": { "inputs": { "weather": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4c3e5069e17b6dec", "output": "output" } ] } }, "name": "Check the temperature", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object", "properties": { "coord": { "type": "object", "properties": { "lon": { "type": "number", "description": "The longitude in decimal degrees." }, "lat": { "type": "number", "description": "The latitude in decimal degrees." } }, "required": [ "lon", "lat" ], "additionalProperties": true, "description": "The coordinates for the requested place." }, "weather": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "description": "The weather condition identifier." }, "main": { "type": "string", "description": "The group of weather parameters." }, "description": { "type": "string", "description": "The localized condition description." }, "icon": { "type": "string", "description": "The weather icon code." } }, "required": [ "id", "main", "description", "icon" ], "additionalProperties": true, "description": "A weather condition entry returned by OpenWeather." }, "description": "The weather conditions for the requested place." }, "base": { "type": "string", "description": "The internal base parameter returned by OpenWeather." }, "main": { "type": "object", "properties": { "temp": { "type": "number", "description": "The measured temperature." }, "feels_like": { "type": "number", "description": "The human-perceived temperature." }, "temp_min": { "type": "number", "description": "The minimum observed temperature." }, "temp_max": { "type": "number", "description": "The maximum observed temperature." }, "pressure": { "type": "number", "description": "The atmospheric pressure in hPa." }, "humidity": { "type": "number", "description": "The humidity percentage." }, "sea_level": { "type": "number", "description": "The sea-level pressure in hPa." }, "grnd_level": { "type": "number", "description": "The ground-level pressure in hPa." }, "temp_kf": { "type": "number", "description": "The internal forecast temperature correction." } }, "required": [ "temp", "feels_like", "temp_min", "temp_max", "pressure", "humidity" ], "additionalProperties": true, "description": "The main weather metrics." }, "visibility": { "type": "number", "description": "The visibility distance in metres." }, "wind": { "type": "object", "properties": { "speed": { "type": "number", "description": "The wind speed." }, "deg": { "type": "number", "description": "The wind direction in degrees." }, "gust": { "type": "number", "description": "The wind gust speed." } }, "required": [ "speed" ], "additionalProperties": true, "description": "The wind metrics." }, "rain": { "type": "object", "properties": { "1h": { "type": "number", "description": "The precipitation volume for the last hour." }, "3h": { "type": "number", "description": "The precipitation volume for the last three hours." } }, "additionalProperties": true, "description": "The rain volume summary." }, "snow": { "type": "object", "properties": { "1h": { "type": "number", "description": "The precipitation volume for the last hour." }, "3h": { "type": "number", "description": "The precipitation volume for the last three hours." } }, "additionalProperties": true, "description": "The snow volume summary." }, "clouds": { "type": "object", "properties": { "all": { "type": "number", "description": "The cloudiness percentage." } }, "required": [ "all" ], "additionalProperties": true, "description": "The cloud coverage summary." }, "dt": { "type": "integer", "minimum": 0, "description": "The calculation time as a Unix UTC timestamp." }, "sys": { "type": "object", "properties": { "type": { "type": "integer", "description": "The internal system type." }, "id": { "type": "integer", "description": "The internal system identifier." }, "country": { "type": "string", "description": "The ISO 3166 country code." }, "sunrise": { "type": "integer", "minimum": 0, "description": "The sunrise time as a Unix UTC timestamp." }, "sunset": { "type": "integer", "minimum": 0, "description": "The sunset time as a Unix UTC timestamp." } }, "required": [ "country", "sunrise", "sunset" ], "additionalProperties": true, "description": "The current weather system metadata." }, "timezone": { "type": "integer", "description": "The shift in seconds from UTC." }, "id": { "type": "integer", "description": "The OpenWeather city identifier." }, "name": { "type": "string", "description": "The place name returned by OpenWeather." }, "cod": { "type": "integer", "description": "The internal response code returned on success." } }, "required": [ "coord", "weather", "base", "main", "wind", "clouds", "dt", "sys", "timezone", "id", "name", "cod" ], "additionalProperties": true, "description": "The current weather payload returned by OpenWeather." }, "nullable": false, "handle": "weather" } ], "outputs": [ { "jsonSchema": { "type": "boolean" }, "nullable": false, "handle": "send" }, { "jsonSchema": { "type": "object", "additionalProperties": true }, "nullable": false, "handle": "body" } ], "name": "Check the temperature", "moduleId": "n_70d838782144fc20", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_393a2348e529cece": { "inputs": {}, "name": "Below 25°C?", "kind": "condition", "matchMode": "first", "cases": [ { "output": "yes", "groups": [ { "expressions": [ { "left": { "kind": "source", "source": { "kind": "node", "nodeId": "n_c0f2ca04f3d6920a", "output": "send" } }, "operator": "isTrue" } ] } ] } ] }, "n_b172cd82eea3fd4b": { "inputs": { "url": { "kind": "unset" }, "body": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_c0f2ca04f3d6920a", "output": "body" } ] } }, "name": "Send SIGNL4 alert", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "url" }, { "jsonSchema": {}, "nullable": true, "handle": "body" } ], "outputs": [ { "jsonSchema": {}, "nullable": true, "handle": "body" }, { "jsonSchema": { "type": "integer" }, "nullable": false, "handle": "statusCode" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "headers" } ], "name": "Send SIGNL4 alert", "executor": { "method": "POST", "query": { "mode": "fields", "names": [] }, "headers": { "mode": "fields", "names": [] }, "bodyFormat": "json", "authentication": { "type": "none" }, "responseFormat": "json", "statusPolicy": "success", "kind": "http-request" } } } }, "edges": [ { "source": "n_d9a312b0d0582844", "target": "n_4c3e5069e17b6dec" }, { "source": "n_ffaea2a731695cbd", "target": "n_4c3e5069e17b6dec" }, { "source": "n_4c3e5069e17b6dec", "target": "n_c0f2ca04f3d6920a" }, { "source": "n_c0f2ca04f3d6920a", "target": "n_393a2348e529cece" }, { "source": "n_393a2348e529cece", "target": "n_b172cd82eea3fd4b", "sourceHandle": "yes" } ] } }, "modules": { "n_70d838782144fc20": { "name": "Check the temperature", "imports": [], "source": "export default function weatherAlert({weather}) {\n const temp=weather?.main?.temp;\n if(typeof temp!=='number'||!Number.isFinite(temp))throw new Error('OpenWeather response has no numeric temperature');\n if(temp>=25)return {send:false,body:{}};\n const lat=weather?.coord?.lat,lon=weather?.coord?.lon;\n if(typeof lat!=='number'||!Number.isFinite(lat)||lat < -90||lat > 90||typeof lon!=='number'||!Number.isFinite(lon)||lon < -180||lon > 180)throw new Error('OpenWeather response has invalid coordinates');\n return {send:true,body:{message:`Weather alert ❄️ Temperature: ${temp} °C`,title:'Weather Alert from n8n','X-S4-Location':`${lat},${lon}`,'X-S4-ExternalID':'weather-alert','X-S4-Status':'new','X-S4-SourceSystem':'n8n'}};\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }