SFOLN

Demos / Weather Forecast API

Flag next week's jobs that the weather will stop

Tindvik Tak is a roofing company with two crews on the west coast of Norway. Today the dispatcher looks at a weather app on Sunday evening, guesses, and still sends a crew to a site where the roof cannot be opened; the crew drives back and the customer has taken a day off for nothing. Here a nightly run fetches the forecast for the exact position of every job site in the coming week, applies the company's own work rules per type of job and puts a flag and a replacement day on the schedule board before the dispatcher starts on Monday.

Workflow

Where the API sits

  1. Trigger

    Nightly schedule

    At 02:00 the script lists the jobs of the next working week with the coordinates of each site.

  2. API call

    Forecast per site

    One call with all sites and days: 10. Each site comes back with a daily forecast in local time: rain probability, precipitation, gusts, high and low.

    sfoln/weather-forecast

  3. Your logic

    Apply the work rules

    Compare the planned day with the rules for that type of job, then walk the following weekdays to find the first one that passes.

  4. Result

    Flags and a customer message

    The board shows the flag and the proposed day; one click sends the customer a reschedule message with the reason.

Wired as a schedule: every night at 02:00 a script reads the coming jobs from the job system, sends their coordinates to the API in one call and writes the flags back. The same schedule works in Make or n8n with the Apify app. One call carries all sites, so a company with 400 open jobs still makes one request per night.

Result

The schedule board after the nightly check

After the nightly check

DispatchSchedule board · week 47checked Sun 15 Nov 02:00

Jobs checked

5

of 6 planned

Break a work rule

3

Fana: rain · Os: wind · Voss: too cold

Good to go

2

Askøy · Stord

Site not found

1

Address to correct

Week 47 · Mon 16 to Fri 20 Nov · 6 jobs
JobPlannedForecast for the dayRain probabilityStrongest gustLowest temp.CheckNext workable day
4127 · FanaTear-off and underlay · Crew A
Mon 16 NovRain85 %42 km/h5.2 °CRainWed 18 Nov
4131 · AskøyFlat-roof membrane · Crew B
Tue 17 NovCloudy30 %38 km/h6.1 °CGo—
4135 · OsSolar panel mounting · Crew A
Wed 18 NovPartly cloudy15 %61 km/h4.2 °CWindThu 19 Nov
4138 · VossFlat-roof membrane · Crew B
Thu 19 NovClear sky10 %22 km/h-3.4 °CToo coldMon 23 Nov
4140 · StordGutters and flashing · Crew A
Fri 20 NovLight rain showers40 %36 km/h5.2 °CGo—
4142 · Knarrvik sentrumChimney flashing · Crew B
Fri 20 NovSite not found: the address is a free-text place name———Fix address—
Weather data from MET Norway (api.met.no), CC BY 4.0· forecast updated00:31 UTC

Before

DispatchSchedule board · week 47no weather check
Week 47 · Mon 16 to Fri 20 Nov · 6 jobs
JobPlannedForecast for the dayRain probabilityStrongest gustLowest temp.CheckNext workable day
4127 · FanaTear-off and underlay · Crew A
Mon 16 Novnot checked———Scheduled—
4131 · AskøyFlat-roof membrane · Crew B
Tue 17 Novnot checked———Scheduled—
4135 · OsSolar panel mounting · Crew A
Wed 18 Novnot checked———Scheduled—
4138 · VossFlat-roof membrane · Crew B
Thu 19 Novnot checked———Scheduled—
4140 · StordGutters and flashing · Crew A
Fri 20 Novnot checked———Scheduled—
4142 · Knarrvik sentrumChimney flashing · Crew B
Fri 20 Novnot checked———Scheduled—

Six jobs, all marked as scheduled. Whether a crew can work is found out on site.

DispatchJob 4127 · rescheduleCrew A · Tear-off and underlay
4127 · Fana: the forecast against the work rules
DayWeatherRainProbabilityGustRoof work
Mon 16 NovplannedRain14.2 mm85 %42 km/hRain
Tue 17 NovLight rain3.1 mm65 %37 km/hRain
Wed 18 NovPartly cloudy0.2 mm20 %26 km/hWorkable: proposed

Work rulesset by the company

Open-roof work
not when rain probability is 60 % or more
Work at height
not when gusts reach 50 km/h
Membrane welding
not when the day's lowest temperature is under 5 °C
Replacement days
weekdays only, first day that passes every rule

Message to the customerdraft

From
Tindvik Tak · dispatch
To
Sigrun Aasebø
Subject
Your roof work on Mon 16 Nov: new date proposed
Move to Wed 18 Nov and sendKeep the date

Highlighted values are read from the API response. The data is a sample in the API's real output shape; names and figures are illustrative.

Call

The call behind it

One request with this input produces the 6 records the screen above is drawn from. Prices are the ones on the API page; records that fail or come back empty are not charged.

Input · POST /v2/actors/sfoln~weather-forecast/run-sync-get-dataset-items
{
  "locations": [
    {
      "latitude": 60.2936,
      "longitude": 5.3324,
      "name": "Job 4127 · Storhaugveien 14, Fana"
    },
    {
      "latitude": 60.409,
      "longitude": 5.226,
      "name": "Job 4131 · Kleppeveien 201, Askøy"
    },
    {
      "latitude": 60.187,
      "longitude": 5.469,
      "name": "Job 4135 · Hegglandsdalen 62, Os"
    },
    {
      "latitude": 60.628,
      "longitude": 6.415,
      "name": "Job 4138 · Strandavegen 9, Voss"
    },
    {
      "latitude": 59.779,
      "longitude": 5.5,
      "name": "Job 4140 · Borggata 33, Stord"
    },
    "Knarrvik sentrum"
  ],
  "days": 10,
  "units": "metric"
}
First record of 6
Response · record 1 of 6 · sample data
{
  "input": {
    "kind": "coords",
    "latitude": 60.2936,
    "longitude": 5.3324,
    "label": "Job 4127 · Storhaugveien 14, Fana"
  },
  "location": "Job 4127 · Storhaugveien 14, Fana",
  "resolvedPlace": null,
  "latitude": 60.2936,
  "longitude": 5.3324,
  "elevation": 48,
  "timezone": "Europe/Oslo",
  "timezoneAbbreviation": "CET",
  "utcOffsetSeconds": 3600,
  "timezoneSource": "nearest_place",
  "units": {
    "temperature": "°C",
    "windSpeed": "km/h",
    "precipitation": "mm"
  },
  "current": {
    "time": "2026-11-15T02:00",
    "temperature": 6.4,
    "apparentTemperature": 3.1,
    "dewPoint": 4.6,
    "relativeHumidity": 88.4,
    "precipitation": 0.6,
    "weatherCode": 61,
    "symbolCode": "lightrain",
    "weatherText": "Light rain",
    "cloudCover": 92.5,
    "windSpeed": 24.5,
    "windDirection": 214.6,
    "windGusts": 44.3,
    "pressure": 1002.3,
    "uvIndexClearSky": 0,
    "isDay": false
  },
  "daily": [
    {
      "date": "2026-11-15",
      "tempMax": 8.1,
      "tempMin": 5.9,
      "precipitationSum": 9.4,
      "precipitationProbabilityMax": 90,
      "weatherCode": 63,
      "symbolCode": "rain",
      "weatherText": "Rain",
      "windMax": 27.4,
      "windGustMax": 48.2,
      "uvIndexMax": 0.3,
      "sunrise": "2026-11-15T08:38",
      "sunset": "2026-11-15T16:05",
      "hoursCovered": 22
    },
    {
      "date": "2026-11-16",
      "tempMax": 7.6,
      "tempMin": 5.2,
      "precipitationSum": 14.2,
      "precipitationProbabilityMax": 85,
      "weatherCode": 63,
      "symbolCode": "rain",
      "weatherText": "Rain",
      "windMax": 25.9,
      "windGustMax": 42.1,
      "uvIndexMax": 0.3,
      "sunrise": "2026-11-16T08:40",
      "sunset": "2026-11-16T16:03",
      "hoursCovered": 24
    },
    {
      "date": "2026-11-17",
      "tempMax": 7.9,
      "tempMin": 4.8,
      "precipitationSum": 3.1,
      "precipitationProbabilityMax": 65,
      "weatherCode": 61,
      "symbolCode": "lightrain",
      "weatherText": "Light rain",
      "windMax": 21.2,
      "windGustMax": 37.4,
      "uvIndexMax": 0.3,
      "sunrise": "2026-11-17T08:42",
      "sunset": "2026-11-17T16:01",
      "hoursCovered": 24
    },
    {
      "date": "2026-11-18",
      "tempMax": 6.8,
      "tempMin": 3.9,
      "precipitationSum": 0.2,
      "precipitationProbabilityMax": 20,
      "weatherCode": 2,
      "symbolCode": "partlycloudy_day",
      "weatherText": "Partly cloudy",
      "windMax": 14.8,
      "windGustMax": 26.3,
      "uvIndexMax": 0.3,
      "sunrise": "2026-11-18T08:44",
      "sunset": "2026-11-18T15:59",
      "hoursCovered": 24
    },
    {
      "date": "2026-11-19",
      "tempMax": 6.1,
      "tempMin": 3.2,
      "precipitationSum": 0,
      "precipitationProbabilityMax": 10,
      "weatherCode": 1,
      "symbolCode": "fair_day",
      "weatherText": "Fair",
      "windMax": 12.2,
      "windGustMax": 21.6,
      "uvIndexMax": 0.3,
      "sunrise": "2026-11-19T08:46",
      "sunset": "2026-11-19T15:57",
      "hoursCovered": 24
    },
    {
      "date": "2026-11-20",
      "tempMax": 7.2,
      "tempMin": 4.4,
      "precipitationSum": 5.6,
      "precipitationProbabilityMax": 75,
      "weatherCode": 63,
      "symbolCode": "rain",
      "weatherText": "Rain",
      "windMax": 23.8,
      "windGustMax": 41,
      "uvIndexMax": 0.3,
      "sunrise": "2026-11-20T08:48",
      "sunset": "2026-11-20T15:55",
      "hoursCovered": 24
    },
    {
      "date": "2026-11-21",
      "tempMax": 8,
      "tempMin": 5.6,
      "precipitationSum": 11.8,
      "precipitationProbabilityMax": 90,
      "weatherCode": 65,
      "symbolCode": "heavyrain",
      "weatherText": "Heavy rain",
      "windMax": 31.3,
      "windGustMax": 55.4,
      "uvIndexMax": 0.3,
      "sunrise": "2026-11-21T08:50",
      "sunset": "2026-11-21T15:53",
      "hoursCovered": 24
    },
    {
      "date": "2026-11-22",
      "tempMax": 7.4,
      "tempMin": 5.1,
      "precipitationSum": 6.3,
      "precipitationProbabilityMax": 80,
      "weatherCode": 63,
      "symbolCode": "rain",
      "weatherText": "Rain",
      "windMax": 26.6,
      "windGustMax": 47.5,
      "uvIndexMax": 0.3,
      "sunrise": "2026-11-22T08:52",
      "sunset": "2026-11-22T15:51",
      "hoursCovered": 24
    },
    {
      "date": "2026-11-23",
      "tempMax": 6.9,
      "tempMin": 4.6,
      "precipitationSum": 1.2,
      "precipitationProbabilityMax": 45,
      "weatherCode": 80,
      "symbolCode": "lightrainshowers_day",
      "weatherText": "Light rain showers",
      "windMax": 18.7,
      "windGustMax": 33.1,
      "uvIndexMax": 0.3,
      "sunrise": "2026-11-23T08:54",
      "sunset": "2026-11-23T15:49",
      "hoursCovered": 24
    },
    {
      "date": "2026-11-24",
      "tempMax": 6.5,
      "tempMin": 4.1,
      "precipitationSum": 0.4,
      "precipitationProbabilityMax": 30,
      "weatherCode": 3,
      "symbolCode": "cloudy",
      "weatherText": "Cloudy",
      "windMax": 15.5,
      "windGustMax": 27.7,
      "uvIndexMax": 0.3,
      "sunrise": "2026-11-24T08:56",
      "sunset": "2026-11-24T15:47",
      "hoursCovered": 19
    }
  ],
  "forecastDays": 10,
  "forecastStart": "2026-11-15T02:00",
  "forecastEnd": "2026-11-24T19:00",
  "forecastUpdatedAt": "2026-11-15T00:31:12Z",
  "attribution": "Weather data from MET Norway (api.met.no), CC BY 4.0",
  "status": "ok",
  "charged": true,
  "chargedEvent": "weather-forecast",
  "source": "metno",
  "fetchedAt": "2026-11-15T01:00:04.000Z"
}
Charged eventCountPriceTotal
Location forecast
weather-forecast
5$0.001$0.005
This run$0.005

Fields

Which output fields do the work

Output fieldUsed for
dailyOne entry per calendar day in the site's own time zone: the planned day is looked up by date, the following days are searched for a replacement.
daily[].precipitationProbabilityMax daily[].precipitationSumThe rain rule for open-roof work, and the figures quoted to the customer.
daily[].windGustMax daily[].windMaxThe wind rule for work at height and panel lifts.
daily[].tempMin daily[].tempMaxThe temperature rule for membrane welding.
daily[].weatherTextReadable conditions on the board and in the message.
location latitude longitudeMatches the forecast to the job; the label sent with the coordinates comes back as location.
status errorA site that cannot be located comes back not_found at no charge, and the board asks for a corrected address.
forecastUpdatedAt attributionShown under the board: how fresh the forecast is and the required source credit.

All output fields are listed on the API page.

Build

Build it

The nightly script: one call for all sites, then the company's rules applied to each job's planned day.

Node.js · nightly script
const jobs = await jobSystem.jobsForNextWeek(); // [{ id, date: '2026-11-16', lat, lon, membrane }]

const res = await fetch('https://api.apify.com/v2/actors/sfoln~weather-forecast/run-sync-get-dataset-items', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.APIFY_TOKEN}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ locations: jobs.map((j) => ({ latitude: j.lat, longitude: j.lon, name: String(j.id) })), days: 10 }),
});
const bySite = new Map((await res.json()).map((site) => [site.location, site]));

const breaks = (job, day) => [
  day.precipitationProbabilityMax >= 60 && 'rain',
  day.windGustMax >= 50 && 'wind',
  job.membrane && day.tempMin < 5 && 'cold',
].filter(Boolean);
const isWeekday = (date) => ![0, 6].includes(new Date(date).getUTCDay());

for (const job of jobs) {
  const site = bySite.get(String(job.id));
  if (site?.status !== 'ok') { await jobSystem.flag(job.id, 'fix-address'); continue; }
  const planned = site.daily.find((d) => d.date === job.date);
  const reasons = breaks(job, planned);
  if (!reasons.length) continue;
  const next = site.daily.find((d) => d.date > job.date && isWeekday(d.date) && !breaks(job, d).length);
  await jobSystem.flag(job.id, reasons.join('+'), { proposedDate: next?.date ?? null });
}
  • Rain probability and gusts are available for the Nordic countries; elsewhere those two fields are null, so base the rules on precipitationSum and windMax there.
  • The forecast reaches about ten days. Run the check every night: a job nine days out is judged again as its day comes closer.
  • Send coordinates when you have them. Place names are geocoded to the best match, which can be the wrong village of the same name.

Authentication, the MCP endpoint and the asynchronous variant are on the API page.

More

Other things teams build with it

  • Delivery and concrete-pour planning that avoids frost and heavy rain
  • Event organisers who warn ticket holders two days before an outdoor date
  • Solar and wind maintenance crews that pick calm, dry days for site visits
  • Travel apps that add a daily forecast to each stop of an itinerary

Related demos

All demos · Weather Forecast API: prices, input and output · /actors/weather-forecast.json carries this demo as demo