Skip to content
NEWMarketplace and the trig8n Agent: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / Email Automation

Email Automation

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

On a schedule, it handles email with OpenAI / ChatGPT using Data Table, Gmail.

What it does

## Alert shipping teams to JMA weather warnings, approve delay notices and email affected customers Heavy rain, storms, and snow in Japan often delay pickups and deliveries. This workflow watches official Japan Meteorological Agency (JMA) warnings for the prefectures you ship from or to, finds the pending shipments that may be affected, and emails those customers after a staff member approves the notice. ### How it works 1. Every 30 minutes, it reads the public JMA warning feed (no API key) and the warnings in effect for each watched prefecture. 2. It compares them with the state saved in an n8n data table, so only changes continue. 3. Find Affected Shipments matches the prefecture against pending orders in the open_shipments table, including all orders when your warehouse is in that prefecture. 4. OpenAI rates severity and drafts an internal alert and a keigo customer email with placeholders. 5. Teams gets a card with the affected orders and a Review and send button. Staff edit and approve the email in an n8n form. If nobody answers in time, a reminder is posted, and the request expires after a second wait. 6. After approval, one Gmail message is sent per order. Each order is marked as notified or failed, and a summary card reports the result. Lifted warnings get an all-clear card. ### Setup steps 1. Create two n8n data tables: 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). All columns are text. 2. Run Load Sample Shipments once to try it, then fill the table from your order system. 3. Edit Set Areas and Settings, including the Teams webhook URL. 4. Connect OpenAI and Gmail credentials.

The steps

  1. Every 30 Minutes
  2. Set Areas and Settings
  3. Load Previous State
  4. Load Open Shipments
  5. Fetch JMA Warning Feed
  6. Parse Feed XML
  7. Split Feed Entries
  8. Read Entry Fields
  9. Keep Watched Prefectures
  10. Sort Newest First
  11. Keep Latest per Prefecture
  12. Fetch Warning Details
  13. Parse Warning XML
  14. Read Active Warnings

44 steps in total.

Similar automations