Facility-aware earthquake alerts to the right Slack channel

By General Input

Watch USGS for quakes near every office and warehouse on your Airtable site list, and ping only the regional Slack channel when shaking actually reaches one of yours.

Integrations

  • USGS Earthquake
  • Airtable
  • Slack

Type

Agentic Task

Categories

  • Operations

Build me an agent workflow that runs on a cron every 15 minutes and alerts the right regional Slack channel when a USGS earthquake actually threatens one of my company's physical sites. The point is signal-to-noise: I only want to hear about quakes that hit places we operate, not every M4.5+ on the planet.

Trigger: cron, every 15 minutes. USGS is not a poll provider, so cron is correct. The USGS Real-time Summary Feed refreshes every minute, so 15 minutes is well inside the freshness window.

Step 1, fetch fresh events. Use the USGS Earthquake integration's Real-time Summary Feed operation. Pull the 'significant' feed for the past day and the magnitude 4.5+ feed for the past day, then merge and de-duplicate by event ID. Each feature in the GeoJSON has an id, properties.mag, properties.place, properties.time, properties.url, properties.tsunami, properties.alert (PAGER level: green, yellow, orange, red), and geometry.coordinates as [longitude, latitude, depth_km].

Step 2, load my facility list. Use the Airtable integration's List Records operation against a base called 'Facilities' (the user will provide the base ID and table name during setup). Each row represents one office, warehouse, plant, or data center, with these fields: Site Name (text), Latitude (number), Longitude (number), Slack Channel (the channel ID for that region's ops channel), and Site Lead (Slack user ID to tag for check-in). Page through all records.

Step 3, compute impact. For each earthquake, calculate the great-circle distance from the epicenter to every facility using the haversine formula (Earth radius ~6371 km). Keep only facilities inside a magnitude-scaled radius that reflects how shaking falls off non-linearly with magnitude: roughly 100 km for M4.5 to M5.4, 300 km for M5.5 to M6.4, and 600 km for M6.5 and above. Treat anything below M4.5 as out of scope. If no facility is within range for a given quake, skip it silently.

Step 4, alert. For each (earthquake, impacted facility) pair, use the Slack integration's Send a Message operation to post one message to that facility's Slack Channel field. The message should include: the site name and how far the epicenter was from it (in km), magnitude, depth in km, PAGER alert level (with a colored emoji prefix mapped from green/yellow/orange/red), whether tsunami is flagged, the human-readable USGS 'place' string, a link to the USGS event URL, and a final line tagging the Site Lead (e.g. '<@U12345> please check in when you can confirm the team is safe'). Use Slack mrkdwn formatting: *bold*, _italic_, <url|text>.

Step 5, de-duplicate across runs. The agent must remember which USGS event IDs it has already alerted on so a single quake never fires twice, even though significant events stay in the feed for hours or days. Persist the set of already-alerted event IDs in the agent's working memory or a small state store. On each run, only process events whose IDs have not been alerted before. If the same quake later impacts a new facility (e.g. a site was added to Airtable after the first alert), that's still considered already-alerted at the event level: alert once per event, not once per facility per event.

Behavior when there's nothing to report: stay completely silent. No 'all clear' messages, no heartbeat pings. Channels stay quiet unless a real impact happens.

Error handling: if the USGS feed is unreachable, log and exit cleanly so the next run retries. If Airtable returns zero facilities, log a warning and exit (don't alert anywhere). If posting to a specific Slack channel fails (channel not found, not in channel), log the failure for that one site and continue with the other impacted sites instead of aborting the whole run.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentWin back LiveChat visitors whose chats went unansweredChat quality review board for LiveChat support leadsWin back no-show and cancelled appointments every morningLive Loop returns analytics with product-level drill-downNewsletter pre-flight and approval board for Mailjet sendsTurn a prospect spreadsheet into personalized sequence enrollmentsMailjet email delivery lookup console for support teamsCatch feature flags that never got switched on in productionKajabi customer support console for member access fixes