🎫 Send earthquake safety check alerts from USGS to Slack using Google Sheets

⚡ 0 views · 🎫 Ticket Management & Triage

Description

Quick overview

This workflow runs every 5 minutes, reads your site locations from Google Sheets, checks the USGS GeoJSON earthquake feed, and posts a Slack safety-check message when a qualifying quake occurs near any site, while recording sent alerts back to Google Sheets to avoid duplicates.

How it works

  1. Runs every 5 minutes (or manually) to start an earthquake check cycle.
  2. Reads the list of monitored sites from the Google Sheets “Sites” tab, including latitude/longitude, contact, and optional per-site thresholds.
  3. Fetches recent earthquakes from the USGS real-time GeoJSON feed based on the configured feed type.
  4. Reads previously sent alerts from the Google Sheets “Alerts” tab to prevent re-notifying the same earthquake/site pair.
  5. Calculates great-circle distance from each earthquake to each site, filters by minimum magnitude and radius, and generates a formatted Slack message (and stops with an error if site coordinates are invalid).
  6. Posts one Slack message per matching earthquake listing the nearby sites and contacts to notify.
  7. Writes/updates one row per earthquake/site alert in the Google Sheets “Alerts” tab so the workflow does not send the same pair twice.

Setup

  1. Create or choose a Google Sheet and add Google Sheets OAuth credentials in n8n.
  2. Paste your spreadsheet ID in the “Spreadsheet ID” node and run the “Run once: set up the sheet” path to create the “Sites” and “Alerts” tabs with headers.
  3. In the main path’s Google Sheets nodes, select the same spreadsheet document ID for both “Read Sites tab” and “Read Alerts tab” (and for “Add to Alerts tab” if needed).
  4. Fill the “Sites” tab with columns site, lat, lon, contact, and optionally radius_km and min_magnitude (use a Slack member ID in contact to @mention them).
  5. Add Slack credentials, choose the target channel, and adjust the defaults (feed, min_magnitude, radius_km, language, timezone) in the Config step as needed.

Requirements

Customization

Additional info

What this workflow does and does not tell you:

What I tested: the live USGS feed with two made-up sites (one near Kushiro, Japan, one in Tokyo), using the past week’s feed and a limit of M4.5. The M4.5 “53 km S of Kushiro” event matched the Kushiro site at about 54 km, the Tokyo site did not match, the message reached Slack, and the second run sent nothing. Plus 14 unit checks of the code (distances, invalid coordinates, per-site limits, already-sent pairs, deleted and non-earthquake events, mentions, time zone, both languages). I did not see a real alert for a large nearby earthquake: test with your own sites first.

đź”— Nodes Used

Google Sheets, HTTP Request, Slack, Schedule Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup