NASAの近地小惑星警报システム
上級
これはSocial Media分野の自動化ワークフローで、16個のノードを含みます。主にIf, Code, Nasa, Slack, SplitOutなどのノードを使用。 NASA API、Slack、Google Calendarを使用した自動小惑星アラート
前提条件
- •Slack Bot Token または Webhook URL
カテゴリー
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"id": "qxBmyFKAUjkuc2Wx",
"meta": {
"instanceId": "15d6057a37b8367f33882dd60593ee5f6cc0c59310ff1dc66b626d726083b48d",
"templateCredsSetupCompleted": true
},
"name": "NASA Near-Earth Asteroid Alert System",
"tags": [],
"nodes": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "スケジュールトリガー",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
224,
304
],
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 12
}
]
}
},
"typeVersion": 1.2
},
{
"id": "note1a2b3c4d-5678-90ab-cdef-1234567890ab",
"name": "ワークフロー概要",
"type": "n8n-nodes-base.stickyNote",
"position": [
160,
16
],
"parameters": {
"color": 5,
"width": 300,
"height": 264,
"content": "## NASA Asteroid Alert Workflow\n\nThis workflow automatically checks for near-Earth asteroids twice daily using NASA's API and sends alerts to Slack and Google Calendar.\n\n**Process:**\n1. Runs on a 12-hour schedule.\n2. Fetches asteroid data for the next 14 days.\n3. Filters for significant objects.\n4. Notifies via Slack & creates Calendar events."
},
"typeVersion": 1
},
{
"id": "b2c3d4e5-f678-90ab-cdef-234567890abc",
"name": "日付範囲の計算",
"type": "n8n-nodes-base.code",
"position": [
464,
304
],
"parameters": {
"jsCode": "// Calculate date range for API request\nconst today = new Date();\nconst nextWeek = new Date();\nnextWeek.setDate(today.getDate() + 14);\n\n// Format dates as YYYY-MM-DD\nconst formatDate = (date) => {\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n return `${year}-${month}-${day}`;\n};\n\nreturn [{\n json: {\n start_date: formatDate(today),\n end_date: formatDate(nextWeek),\n today: formatDate(today),\n next_week: formatDate(nextWeek)\n }\n}];"
},
"typeVersion": 2
},
{
"id": "note2b3c4d5e-6789-0abc-def1-234567890abc",
"name": "API キーノート",
"type": "n8n-nodes-base.stickyNote",
"position": [
560,
16
],
"parameters": {
"color": 6,
"width": 280,
"height": 260,
"content": "## ⚙️ NASA API Configuration\n\n**Action Required:** Replace the default `DEMO_KEY` with your own NASA API key in the 'Get an asteroid neo feed' node.\n\n1. **Get a free key at:** [api.nasa.gov](https://api.nasa.gov/)\n2. **Why?** The demo key has very strict rate limits and is not suitable for regular use."
},
"typeVersion": 1
},
{
"id": "d4e5f678-90ab-cdef-1234-567890abcdef",
"name": "小惑星のフィルタリングと処理",
"type": "n8n-nodes-base.code",
"position": [
992,
304
],
"parameters": {
"jsCode": "// Get all individual asteroid items from the input\nconst allAsteroidItems = $input.all();\n\n// Configuration thresholds (テスト用の緩い値)\nconst MAX_DISTANCE_KM = 75000000000; // 75 billion km\nconst MIN_DIAMETER_METERS = 1; // 1 meter\n\nconst filteredAsteroids = [];\n\n// Loop through each asteroid item that was passed to this node\nfor (const item of allAsteroidItems) {\n const asteroid = item.json; // Get the actual asteroid data from the item\n\n // Ensure the necessary data exists before trying to process it\n if (asteroid && asteroid.close_approach_data && asteroid.close_approach_data.length > 0) {\n const missDistance = parseFloat(asteroid.close_approach_data[0].miss_distance.kilometers);\n const maxDiameter = asteroid.estimated_diameter.meters.estimated_diameter_max;\n const minDiameter = asteroid.estimated_diameter.meters.estimated_diameter_min;\n const avgDiameter = (maxDiameter + minDiameter) / 2;\n\n // Apply filters\n if (missDistance <= MAX_DISTANCE_KM && avgDiameter >= MIN_DIAMETER_METERS) {\n filteredAsteroids.push({\n name: asteroid.name,\n id: asteroid.id,\n approach_date: asteroid.close_approach_data[0].close_approach_date,\n approach_date_full: asteroid.close_approach_data[0].close_approach_date_full,\n miss_distance_km: Math.round(missDistance),\n miss_distance_lunar: parseFloat(asteroid.close_approach_data[0].miss_distance.lunar).toFixed(2),\n diameter_min_m: Math.round(minDiameter),\n diameter_max_m: Math.round(maxDiameter),\n diameter_avg_m: Math.round(avgDiameter),\n velocity_km_h: Math.round(parseFloat(asteroid.close_approach_data[0].relative_velocity.kilometers_per_hour)),\n is_potentially_hazardous: asteroid.is_potentially_hazardous_asteroid,\n nasa_jpl_url: asteroid.nasa_jpl_url,\n absolute_magnitude: asteroid.absolute_magnitude_h\n });\n }\n }\n}\n\n// Sort by closest approach distance\nfilteredAsteroids.sort((a, b) => a.miss_distance_km - b.miss_distance_km);\n\n// Return the final list of asteroids that met the criteria\nreturn filteredAsteroids.map(asteroid => ({ json: asteroid }));"
},
"typeVersion": 2
},
{
"id": "note3c4d5e6f-7890-abcd-ef12-34567890abcd",
"name": "フィルター設定",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
-16
],
"parameters": {
"color": 3,
"width": 280,
"height": 280,
"content": "## ⚙️ Filtering Criteria\n\nThis node filters asteroids to find only significant ones. **You should adjust these values.**\n\n**Default (Test) Values:**\n- `MAX_DISTANCE_KM = 75000000000` (very far)\n- `MIN_DIAMETER_METERS = 1` (very small)\n\n**Recommended Values:**\n- `MAX_DISTANCE_KM = 7500000` (7.5 million km)\n- `MIN_DIAMETER_METERS = 100` (100 meters)\n\n**Action:** Edit the code in this node to customize your alert sensitivity."
},
"typeVersion": 1
},
{
"id": "e5f67890-abcd-ef12-3456-7890abcdef12",
"name": "小惑星発見の確認",
"type": "n8n-nodes-base.if",
"position": [
1376,
304
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567891",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $items().length }}",
"rightValue": 0
}
]
}
},
"typeVersion": 2
},
{
"id": "f6789012-3456-7890-abcd-ef1234567890",
"name": "アラートメッセージのフォーマット",
"type": "n8n-nodes-base.code",
"position": [
1648,
192
],
"parameters": {
"jsCode": "// Format message for Slack/Email\nconst asteroids = $input.all();\nconst messageLines = [];\n\nmessageLines.push('🚨 *NEAR-EARTH ASTEROID ALERT* 🚨');\nmessageLines.push('');\nmessageLines.push(`Found ${asteroids.length} asteroid(s) meeting alert criteria:`);\nmessageLines.push('');\n\nasteroids.forEach((item, index) => {\n const asteroid = item.json;\n const hazardIcon = asteroid.is_potentially_hazardous ? '⚠️' : '✓';\n \n messageLines.push(`*${index + 1}. ${asteroid.name}* ${hazardIcon}`);\n messageLines.push(` • Approach Date: ${asteroid.approach_date}`);\n messageLines.push(` • Distance: ${asteroid.miss_distance_km.toLocaleString()} km (${asteroid.miss_distance_lunar} lunar distances)`);\n messageLines.push(` • Size: ${asteroid.diameter_min_m}-${asteroid.diameter_max_m} meters`);\n messageLines.push(` • Speed: ${asteroid.velocity_km_h.toLocaleString()} km/h`);\n messageLines.push(` • Details: ${asteroid.nasa_jpl_url}`);\n messageLines.push('');\n});\n\nmessageLines.push('_Data source: NASA Near Earth Object Web Service_');\n\nreturn [{\n json: {\n slackMessage: messageLines.join('\\n'),\n emailSubject: `🚨 Asteroid Alert: ${asteroids.length} Near-Earth Object(s) Detected`,\n emailBody: messageLines.join('\\n').replace(/\\*/g, '').replace(/_/g, ''),\n asteroidCount: asteroids.length,\n asteroids: asteroids.map(a => a.json)\n }\n}];"
},
"typeVersion": 2
},
{
"id": "78901234-5678-90ab-cdef-123456789012",
"name": "Slack アラート送信",
"type": "n8n-nodes-base.slack",
"position": [
1840,
64
],
"webhookId": "927fb2da-a34d-40b5-a589-e67716049dd1",
"parameters": {
"text": "={{ $json.slackMessage }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C09KTEYDKDY",
"cachedResultName": "サポートチーム"
},
"otherOptions": {
"mrkdwn": true
},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"id": "BX5igCUXrjyHLAU1",
"name": "Slack account 5"
}
},
"typeVersion": 2.2
},
{
"id": "note4d5e6f78-90ab-cdef-1234-567890abcdef",
"name": "Slack セットアップ",
"type": "n8n-nodes-base.stickyNote",
"position": [
1504,
-80
],
"parameters": {
"color": 4,
"width": 280,
"height": 244,
"content": "## ⚙️ Slack Configuration\n\n**Setup Required:**\n1. Select the 'Send Slack Alert' node.\n2. Add your Slack OAuth2 credentials.\n3. Choose the channel for alerts (e.g., `#asteroid-alerts`).\n\nEnsure the n8n app has permission to post in the selected channel."
},
"typeVersion": 1
},
{
"id": "90123456-7890-abcd-ef12-345678901234",
"name": "個別小惑星の分割",
"type": "n8n-nodes-base.splitOut",
"position": [
1840,
304
],
"parameters": {
"include": "selectedOtherFields",
"options": {},
"fieldToSplitOut": "asteroids",
"fieldsToInclude": "emailSubject, slackMessage"
},
"typeVersion": 1
},
{
"id": "note6f78901a-bcde-f123-4567-890abcdef123",
"name": "カレンダーセットアップ",
"type": "n8n-nodes-base.stickyNote",
"position": [
1920,
512
],
"parameters": {
"width": 280,
"height": 264,
"content": "## ⚙️ Google Calendar Setup\n\nThis branch creates a calendar event for *each* asteroid found.\n\n**Setup Required:**\n1. Select the 'Create an event' node.\n2. Add your Google Calendar OAuth2 credentials.\n3. Select your desired calendar.\n\n**Customization:** You can modify the event title, description, and even add color-coding based on hazard level."
},
"typeVersion": 1
},
{
"id": "note7890abcd-ef12-3456-7890-abcdef123456",
"name": "結果なしノート",
"type": "n8n-nodes-base.stickyNote",
"position": [
1296,
480
],
"parameters": {
"color": 7,
"width": 280,
"height": 224,
"content": "## No Asteroids Branch\n\nThis is the 'false' branch of the IF node. It's triggered when no asteroids meet the filtering criteria.\n\nThe **NoOp** node does nothing, ending the workflow silently.\n\n**Idea:** Replace this with a node that sends a daily \"All Clear\" message."
},
"typeVersion": 1
},
{
"id": "8da8e937-6acf-43d7-8a7e-43635b7abfde",
"name": "小惑星NEOフィードの取得",
"type": "n8n-nodes-base.nasa",
"position": [
720,
304
],
"parameters": {
"resource": "asteroidNeoFeed",
"additionalFields": {}
},
"credentials": {
"nasaApi": {
"id": "gvg1cGvjElgkwNpP",
"name": "NASA account 2"
}
},
"typeVersion": 1
},
{
"id": "9c7340e9-6b56-4888-8180-373942e5d1d7",
"name": "イベントの作成",
"type": "n8n-nodes-base.googleCalendar",
"position": [
2064,
304
],
"parameters": {
"start": "={{ $json.asteroids.approach_date_full }}",
"calendar": {
"__rl": true,
"mode": "list",
"value": "t.minamig20@gmail.com",
"cachedResultName": "t.minamig20@gmail.com"
},
"additionalFields": {
"summary": "小惑星接近アラート",
"description": "=接近距離: {{ $json.asteroids.miss_distance_km.toLocaleString() }} km \n直径: 約{{ $json.asteroids.diameter_avg_m }} m \n速度: {{ $json.asteroids.velocity_km_h.toLocaleString() }} km/h \n詳細URL: {{ $json.asteroids.nasa_jpl_url }}"
}
},
"credentials": {
"googleCalendarOAuth2Api": {
"id": "5lKtFJo2lfQL9TkJ",
"name": "Google Calendar account 12"
}
},
"typeVersion": 1.3
},
{
"id": "89d59b68-b6a1-43c3-8968-c6710a561032",
"name": "操作なし(何もしない)",
"type": "n8n-nodes-base.noOp",
"position": [
1616,
400
],
"parameters": {},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"timezone": "America/New_York",
"errorWorkflow": "",
"executionOrder": "v1",
"saveManualExecutions": true,
"saveExecutionProgress": true,
"saveDataErrorExecution": "all",
"saveDataSuccessExecution": "all"
},
"versionId": "80885207-ba21-410d-b306-fc5bc0e8e339",
"connections": {
"a1b2c3d4-e5f6-7890-abcd-ef1234567890": {
"main": [
[
{
"node": "b2c3d4e5-f678-90ab-cdef-234567890abc",
"type": "main",
"index": 0
}
]
]
},
"b2c3d4e5-f678-90ab-cdef-234567890abc": {
"main": [
[
{
"node": "8da8e937-6acf-43d7-8a7e-43635b7abfde",
"type": "main",
"index": 0
}
]
]
},
"f6789012-3456-7890-abcd-ef1234567890": {
"main": [
[
{
"node": "78901234-5678-90ab-cdef-123456789012",
"type": "main",
"index": 0
},
{
"node": "90123456-7890-abcd-ef12-345678901234",
"type": "main",
"index": 0
}
]
]
},
"e5f67890-abcd-ef12-3456-7890abcdef12": {
"main": [
[
{
"node": "f6789012-3456-7890-abcd-ef1234567890",
"type": "main",
"index": 0
}
],
[
{
"node": "89d59b68-b6a1-43c3-8968-c6710a561032",
"type": "main",
"index": 0
}
]
]
},
"8da8e937-6acf-43d7-8a7e-43635b7abfde": {
"main": [
[
{
"node": "d4e5f678-90ab-cdef-1234-567890abcdef",
"type": "main",
"index": 0
}
]
]
},
"d4e5f678-90ab-cdef-1234-567890abcdef": {
"main": [
[
{
"node": "e5f67890-abcd-ef12-3456-7890abcdef12",
"type": "main",
"index": 0
}
]
]
},
"90123456-7890-abcd-ef12-345678901234": {
"main": [
[
{
"node": "9c7340e9-6b56-4888-8180-373942e5d1d7",
"type": "main",
"index": 0
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
上級 - ソーシャルメディア
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
AIを活用した会議調査とデイリーアジェンダ(Googleカレンダー、Attio CRM、Slack)
AIを活用した会議調査とデイリーアジェンダ:Googleカレンダー、Attio CRM、Slackを使用
If
Set
Code
+
If
Set
Code
30 ノードHarry Siggins
AI要約
パフォーマンス評価スケジューリングとアラート
Google Sheets、カレンダー、メール、Slackを使ってパフォーマンス評価プロセスを自動化
If
Set
Code
+
If
Set
Code
16 ノードOneclick AI Squad
人事
Groq、Gemini、Slack承認システムを使用してRSSからMediumへの公開を自動化
Groq、Gemini、Slack承認システムを用いたRSSからMediumへの自動公開プロセス
If
Set
Code
+
If
Set
Code
41 ノードObisDev
コンテンツ作成
アクセルレーション隊スプリント計画の自動化
OpenAI、Googleカレンダー、Gmailを使ってアジャイルチームのスプリント計画を自動化
If
Set
Code
+
If
Set
Code
52 ノードWillemijn
プロダクト
会議準備の自動化
GPT-5 と Gemini でカレンダーから Slack まで、Attio CRM を通じて自動のにミーティングを準備する
If
Set
Code
+
If
Set
Code
39 ノードHarry Siggins
AI要約
n8nノードの探索(可視化リファレンスライブラリ内)
n8nノードを可視化リファレンスライブラリで探索
If
Ftp
Set
+
If
Ftp
Set
113 ノードI versus AI
その他
ワークフロー情報
難易度
上級
ノード数16
カテゴリー1
ノードタイプ9
作成者
Yusuke Yamamoto
@yusuke-yamamotoBusiness creator from Tokyo. Designing AI-driven automations that enhance marketing, reporting, and daily operations. I turn complex workflows into simple, elegant automations with n8n.
外部リンク
n8n.ioで表示 →
このワークフローを共有