Back to Templates

Send asteroid alerts from NASA to LINE using OpenAI and DeepL

Created by

Created by: 寳田 武 || teateatea

寳田 武

Last update

Last update a day ago

Share


Turn your n8n instance into a personal "Planetary Defense System." This workflow monitors NASA's data daily for hazardous asteroids, generates sci-fi style warnings using OpenAI, translates them via DeepL, and notifies you through LINE.

Who is it for

This template is perfect for space enthusiasts, sci-fi fans, or anyone interested in learning how to combine data analysis with AI text generation and translation services in n8n.

What it does

  1. Fetches Data: Retrieves the daily "Near Earth Objects" list from the NASA NeoWs API.
  2. Analyzes Threats: A Code node filters for "potentially hazardous" asteroids and calculates their distance relative to the Moon.
  3. Smart Branching:
    • If a threat exists: OpenAI generates a dramatic, sci-fi style warning based on the asteroid's size and distance. DeepL translates this alert into your preferred language (default: Japanese).
    • If no threat exists: A pre-set "Peace Report" is prepared.
  4. Notifies: Sends the final message to your LINE account via LINE Notify.

How to set up

  1. NASA API: Sign up for a free API key at api.nasa.gov and configure the Get Asteroid Data node credential.
  2. OpenAI & DeepL: Add your API keys to the respective nodes.
  3. LINE Notify: Generate an access token from the LINE Notify website and add it to the Send Danger Alert and Send Peace Report nodes.
  4. Configure Language: In the Translate Alert node, set the "Translate To" field to your desired language code (e.g., JA, EN, DE).

Requirements

  • n8n version 1.0 or later
  • NASA API Key (Free)
  • OpenAI API Key (Paid)
  • DeepL API Key (Free or Pro)
  • LINE Account & Notify Token

How to customize

  • Change the Vibe: Edit the System Prompt in the Generate SF Alert node to change the persona (e.g., "Scientific Analyst" instead of "Sci-Fi System").
  • Switch Messenger: Replace the LINE nodes with Slack, Discord, or Email nodes to receive alerts on your preferred platform.
  • Adjust Thresholds: Modify the JavaScript in the Filter & Calculate Distance node to change the definition of a "threat" (e.g., closer than 10 lunar distances).