See llms.txt for all machine-readable content.

Back to Templates

Triage JMA weather delays with GPT-5-mini, Microsoft Teams and Gmail

Quick Overview

This workflow checks the Japan Meteorological Agency (JMA) weather warning feed every 30 minutes, compares changes per watched prefecture, posts alerts and an approval form to Microsoft Teams, and (after approval) emails affected customers via Gmail while tracking shipment and warning state in n8n Data Tables.

How it works

  1. Runs every 30 minutes and loads workflow settings plus the saved warning state and open shipments from n8n Data Tables.
  2. Downloads the public JMA XML warning feed, posts an error card to Microsoft Teams if the feed request fails, and otherwise parses the feed.
  3. Filters feed entries to the watched prefectures, keeps the newest entry per prefecture, fetches each entry’s detail XML, and extracts the active warning types and headline.
  4. Compares the current warnings to the previously saved warnings per prefecture, routes only newly issued/changed warnings and all-clear events, and upserts the latest state back to the warning state table.
  5. For newly issued warnings, matches the affected prefecture (and the warehouse prefecture) against pending shipments due within the lookahead window in the open shipments table.
  6. Uses OpenAI to draft a Japanese internal alert plus a polite customer email template with placeholders, then posts the alert to Microsoft Teams and, if shipments are affected, posts a Teams card with a “Review and send” link to an n8n approval form.
  7. Waits for staff to approve or skip sending (with a reminder and expiry if no response), then sends one Gmail email per affected order and updates each order record with the send result and posts a send summary to Microsoft Teams.

Setup

  1. Create two n8n Data Tables named weather_alert_state (prefecture, warnings, reported_at) and open_shipments (order_id, customer_name, email, ship_to_prefecture, ship_date, status, notice_sent, notified_at) and populate open_shipments with your pending orders.
  2. Add an OpenAI credential (Chat model) and a Gmail OAuth2 credential for the mailbox that sends customer notices.
  3. Configure a Microsoft Teams Workflows/Incoming Webhook URL and paste it into the teams_webhook_url setting, then update watched prefectures, warehouse prefecture, lookahead days, reminder timing, and company signature in the settings node.