Automated asteroid alerts with NASA API, Slack & Google Calendar
This n8n template creates an automated alert system that checks NASA's data for near-Earth asteroids twice a day. When it finds asteroids meeting specific criteria, it sends a summary alert to Slack and creates indivi...
Template notes
This n8n template creates an automated alert system that checks NASA's data for near-Earth asteroids twice a day. When it finds asteroids meeting specific criteria, it sends a summary alert to Slack and creates individual events in Google Calendar for each object.
Use cases
- Automated Monitoring: Keep track of potentially hazardous asteroids without manually checking websites. - Team or Community Alerts: Automatically inform a team, a group of friends, or a community about significant celestial events via Slack. - Personalized Space Calendar: Populate your Google Calendar with upcoming asteroid close approaches, creating a personal "what's up in space" agenda. - Educational Tool: Use this as a foundation to learn about API data fetching, data processing, and multi-channel notifications in n8n.
Good to know
- This workflow runs on a schedule (every 12 hours by default) and does not require a manual trigger. - NASA API Key is highly recommended. The default DEMOKEY has strict rate limits. Get a free key from [api.nasa.gov](https://api.nasa.gov/). - The filtering logic for what constitutes an "alert-worthy" asteroid (distance and size) is fully customizable within the "Filter and Process Asteroids" Code node.
How it works
1. A Schedule Trigger starts the workflow every 12 hours. 2. The "Calculate Date Range" Code node generates the start and end dates for the API query (today to 14 days from now). 3. The NASA node uses these dates to query the Near Earth Object Web Service (NeoWs) API, retrieving a list of all asteroids that will pass by Earth in that period. 4. The "Filter and Process Asteroids" Code node iterates through the list. It filters out objects that are too small or too far away, based on thresholds defined in the code. It then formats and sorts the remaining "interesting" asteroids by their closest approach distance. 5. An If node checks if any asteroids were found after filtering. - If true (asteroids were found), the flow continues to the alert steps. - If false, the workflow ends quietly via a NoOp node. 6. The "Format Alert Messages" Code node compiles a single, well-formatted summary message for Slack and prepares the data for other notifications. 7. The workflow then splits into two parallel branches: - Slack Alert: The Slack node sends the summary message to a specified channel. - Calendar Events: The Split Out node separates the data so that each asteroid is processed individually. For each asteroid, the Google Calendar node creates an all-day event on its close-approach date.
How to use