Earthquake alerts in Slack from USGS feeds

By General Input

Get a Slack message within minutes whenever a significant earthquake hits, with magnitude, location, severity, tsunami status, and a link to the USGS event page.

Integrations

  • USGS Earthquake
  • Slack

Type

Agentic Task

Categories

  • Operations
  • Engineering

Build me an agent workflow that watches for significant earthquakes and posts contextualized alerts to a Slack channel so my ops team sees them within minutes.

Trigger: cron, every 15 minutes.

Parameters on the prompt (configurable per install):

- slack_channel: the Slack channel ID or name to post alerts in (e.g. #ops-alerts). Required.

- min_magnitude: minimum magnitude for routine alerts. Default 4.5.

- min_pager_override: the PAGER alert level (green, yellow, orange, red) that lets a sub-threshold event through anyway. Default yellow.

On each run, the agent should:

1. Use the USGS Earthquake integration's Real-time Summary Feed operation to read both the 4.5+/day GeoJSON feed and the significant/day GeoJSON feed. These are static files refreshed every minute, which is the right surface for "what just happened" (do not run a fresh catalog query on every tick).

2. Merge the two feeds and deduplicate by USGS event id. Maintain a small persistent record across runs of which event ids have already been alerted so we never re-alert the same event.

3. Apply the noise filter: an event qualifies for alerting if its magnitude is at least min_magnitude, OR its PAGER alert level is at least min_pager_override (yellow, orange, or red by default). Events that fail both checks are skipped.

4. Collapse aftershocks. If a new event looks like an aftershock of an event we've already alerted on (same general region within roughly 100 km and within ~48 hours of the parent, lower magnitude), post it as a threaded reply to the original alert message instead of a new top-level message. Track the parent Slack message timestamp alongside the parent event id so threading works across runs.

5. For each qualifying new event, use Slack's Send a Message operation to post to slack_channel. Lead with magnitude and place name (e.g. "M5.8 — 14 km SSW of Acari, Peru"). Then include depth in km, PAGER alert level (with a colored emoji: 🟢🟡🟠🔴), MMI shaking intensity if present, tsunami flag if the event has tsunami=1, and a direct link to the USGS event page (https://earthquake.usgs.gov/earthquakes/eventpage/<id>). Use Slack mrkdwn formatting (*bold*, <url|text>).

6. For aftershock threaded replies, keep the message terser: magnitude, distance/bearing from the mainshock, depth, time, and the USGS link.

Use the slack integration (user OAuth) for Send a Message, not the deprecated slack-bot integration. The USGS Earthquake integration requires no auth. Be defensive about USGS returning 204 No Content (no new events) and handle the case where a feed is briefly unreachable by skipping that tick rather than crashing.

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