# Earthquake alerts near you in Telegram

A bot that tells you within minutes when a strong earthquake hits near a city you follow, with a link to the USGS event page.

## Parts

- Data: [USGS Latest Earthquakes](https://agentgid.com/resources/usgs-earthquakes/agent.md): The US government's live map and catalog of earthquakes worldwide, with minute-by-minute GeoJSON feeds and a searchable query API.
- Messages: [Telegram Bot API](https://agentgid.com/apis/telegram-bot-api/agent.md)
- Bot library: [python-telegram-bot](https://agentgid.com/tools/python-telegram-bot/agent.md)
- Polling once a minute: [APScheduler](https://agentgid.com/tools/apscheduler/agent.md)
- Product recipe: [Telegram AI bot](https://agentgid.com/build/recipes/telegram-ai-bot/agent.md)

## Steps

1. Poll the USGS summary GeoJSON feed for the last hour (no key) once a minute at most.
2. Keep the event ids you have already sent, so an updated event is not posted twice.
3. For each new event, compute the distance to each follower's city and send the ones above their magnitude and inside their radius.
4. Put the magnitude, place, local time and the USGS event link in the message, and credit the U.S. Geological Survey.

## Watch out

- USGS asks automated apps to use the real-time feeds, not the query API.
- This is information, not an official warning system; say so in the bot's description.

Human page: https://agentgid.com/resources/ideas/earthquake-alert-bot/
