Earthquake alerts in Slack from USGS feeds
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.
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.
Additional information
What does this prompt do?
- Watches the official USGS earthquake feeds every 15 minutes and posts an alert to your chosen Slack channel for each new significant event.
- Leads each alert with magnitude and place name, then adds depth, severity (PAGER green to red), shaking intensity, tsunami status, and a direct link to the USGS event page.
- Suppresses noise by skipping small quakes below your minimum magnitude, unless an event has been flagged yellow or higher for impact.
- Collapses aftershocks from the same sequence into a single Slack thread so your channel does not get spammed during an active swarm.
What do I need to use this?
- A Slack workspace where you can install Geni and choose the channel that should receive alerts.
- The name of the Slack channel you want alerts posted in (for example, #ops-alerts).
- Your preferred minimum magnitude for routine alerts (for example, 4.5).
How can I customize it?
- Change the channel, or have alerts go to multiple channels for different regions or severities.
- Raise or lower the minimum magnitude, or tighten the rule that lets lower-magnitude but high-impact quakes still get through.
- Adjust how often it checks. Every 15 minutes is the default, but you can run it more or less often.
- Filter by region if you only care about quakes in a specific country, state, or radius around a location.
Frequently asked questions
Where does the earthquake data come from?
How fast will I see an alert after a quake?
Will I get spammed during aftershock sequences?
Can I change which Slack channel gets the alerts?
What is the PAGER alert level in the message?
Does this cost anything to run?
Stop refreshing the USGS map during an event.
Connect Slack once and Geni will quietly watch the world's seismic activity and ping your team the moment something matters.