1. Opening Problem Statement
Meet Sarah, an astronomy enthusiast who manages a Telegram channel dedicated to sharing amazing space photos. Every day, Sarah visits NASA’s Astronomy Picture of the Day (APOD) website, downloads the stunning images, and then uploads them along with captions to her Telegram channel. She spends roughly 15 minutes daily on this repetitive task, and honestly, it’s easy to forget or delay posting. Missing a day risks losing her channel’s audience engagement and affects her credibility.
Imagine the frustration of having to manually track, download, and post content every single day—time-consuming, prone to human error, and a drain on energy that Sarah could use for more valuable community interaction or content creation.
2. What This Automation Does
This n8n workflow completely automates Sarah’s daily task by fetching NASA’s Astronomy Picture of the Day and sending it directly to her Telegram channel. Here’s what happens each day at 8 PM automatically:
- Trigger at 8 PM: The workflow starts automatically using a Cron node at exactly 8 PM daily.
- Retrieve APOD Data: It pulls the Astronomy Picture of the Day image URL and title metadata from NASA’s official API via the NASA node.
- Send Photo to Telegram: The image, along with its caption (the picture title), is sent as a photo message to a specified Telegram channel using the Telegram node.
- Eliminates Manual Work: No need to remember or manually upload images every day, saving Sarah at least 15 minutes daily.
- Ensures Consistent Community Engagement: Regular daily content posting keeps her audience engaged and her channel active without fail.
- Supports Media Links Securely: Uses n8n’s credential management for secure NASA API and Telegram bot authentication.
3. Prerequisites ⚙️
- n8n account: A platform to run the automation. Self-hosting is optional but recommended for more control (learn more).
- NASA API Key: Sign up for NASA’s free API access at https://api.nasa.gov/.
- Telegram Bot and Channel: You need a Telegram bot token linked to a bot added as an admin in your target Telegram channel.
- Basic familiarity with n8n nodes: Cron, NASA, and Telegram nodes.
4. Step-by-Step Guide to Build This Workflow
Step 1: Create Cron Node for Daily Trigger
In your n8n editor, click + Add Node → search and select Cron.
Set the trigger time to daily at 20:00 (8 PM): under Trigger Times, select Hour and enter 20.
You should see the Cron node set to fire once each day at 8 PM. This ensures the workflow runs daily, automatically.
Common mistake: Forgetting to set the hour correctly or AM/PM confusion.
Step 2: Add NASA Node to Retrieve APOD
Click + Add Node, search for NASA. Choose the node named “NASA”.
Under the Parameters, ensure Download is set to false because you just want the URL and metadata, not the file itself.
Link this node to the Cron node with drag and drop from the Cron node’s output.
In Credentials, select your configured NASA API credentials.
After saving, test this node. You should see JSON output including an url for the image and a title describing it.
Common mistake: Not entering the NASA API key correctly will cause the node to fail.
Step 3: Configure Telegram Node to Send Photo
Add a new node and select Telegram from the node list.
Set the Operation to sendPhoto.
For File enter the expression: {{$node["NASA"].json["url"]}} to use the URL from the NASA node.
Set the ChatId to your Telegram channel’s unique chat ID, e.g., -485365454.
Under Additional Fields, set Caption to {{$node["NASA"].json["title"]}} so the image title appears as the photo caption.
Link the NASA node output to this Telegram node.
Test the Telegram node: you should see the latest APOD photo posted in your Telegram channel.
Common mistakes: Using the wrong chat ID format or missing the bot admin permission in the Telegram channel.
5. Customizations ✏️
- Change Posting Time: Adjust the Cron node’s hour field to post the Astronomy Picture at any time that better suits your audience.
- Add a Text Message Before the Photo: Insert a Telegram node with the operation `sendMessage` before the photo node to send a greeting or context message.
- Download and Attach Locally: Enable Download in the NASA node and use a file node to send a locally stored file instead of a URL.
- Customize Caption: Modify the caption template in the Telegram node to add hashtags or additional info like the date.
6. Troubleshooting 🔧
Problem: “Telegram node fails with Invalid Chat ID error”
Cause: The bot is not an admin or the chat ID is incorrect.
Solution: Double-check the chat ID format with a leading hyphen for channels, and ensure your bot is added as an admin.
Problem: “NASA node returns authentication error”
Cause: Wrong or missing NASA API key.
Solution: Verify your API key in Credentials and regenerate a key from https://api.nasa.gov/ if needed.
7. Pre-Production Checklist ✅
- Verify Cron node schedule is accurate and timezone-aware.
- Test NASA node independently to ensure API response contains
urlandtitle. - Confirm Telegram bot permissions and correct chat ID.
- Run workflow manually once to confirm the entire flow works end-to-end.
- Back up your workflow configuration before deploying live.
8. Deployment Guide
Once verified, activate the workflow by toggling the Active switch at the top right in n8n editor.
Monitor the workflow execution in n8n’s Executions panel to ensure it triggers daily and posts correctly.
Set up error notifications or logging if needed for production reliability, especially to catch API downtime or Telegram issues.
9. FAQs
Q: Can I use a different messaging platform instead of Telegram?
A: Yes, but you’ll need nodes compatible with that platform. The current workflow uses the specialized Telegram node for seamless operation.
Q: Does sending images consume NASA API credits?
A: The NASA API usage is generally generous and free, but check limits at https://api.nasa.gov/.
Q: Is my Telegram bot secure?
A: Yes, n8n stores credentials securely, and the bot only interacts with your authorized channel.
10. Conclusion
By setting up this n8n workflow, you have automated the posting of NASA’s Astronomy Picture of the Day directly into your Telegram channel every day at 8 PM. This automation saves you significant time (about 15 minutes daily), eliminates manual errors, and keeps your channel content fresh and engaging consistently.
Next, consider extending this automation with additional educational space facts, or integrating user polls and feedback into your Telegram channel. Happy automating!