AI-Powered NASA Space Postcard Creator for Slack - n8n Workflow

Use this powerful n8n workflow to automatically fetch NASA photos, generate poetic AI captions using OpenAI, edit the image with text overlay, and share the unique space postcard instantly via Slack.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Content Curators seeking unique, automated content for social media or internal channels.
Developers and Hobbyists interested in combining public APIs, image processing, and AI in a single n8n workflow.
Automation Specialists looking for advanced n8n templates involving dynamic data manipulation and conditional logic.
Users needing a scheduled n8n trigger to post daily unique content.

Overview

This automation solves the problem of generating visually engaging, personalized content using publicly available data and artificial intelligence. By utilizing a specific n8n workflow, you can fetch high-quality space images from the NASA Astronomy Picture of the Day (APOD) API. Instead of simply posting the raw image, this n8n automation passes the data to an AI Agent (powered by OpenAI) to craft a short, poetic caption and calculate its optimal placement on the image. The resulting 'postcard' is a unique asset, automatically edited with a text overlay, and immediately shared with your team or community via Slack. This advanced n8n workflow demonstrates complex integration between external APIs, image manipulation, and generative AI.

How it Works

The process begins with the When clicking 'Test workflow' n8n trigger. While currently manual, this could easily be converted to a schedule n8n trigger for daily runs.


  1. Fetch Data: The Get NASA APOD n8n node pulls a randomly selected Astronomy Picture of the Day from the last 10 years.

  2. Validate Media: The Check if Media Type is Image If n8n node ensures the entry is a static image (mediatype equals 'image'), skipping videos to maintain workflow integrity.

  3. Get Dimensions: The Edit Image1 n8n node is used to extract the image dimensions (width and height), which are crucial for placing the text correctly.

  4. AI Generation & Calculation: The AI Agent n8n node, connected to the OpenAI Chat Model, receives the image metadata (title, explanation) and dimensions. It performs two tasks: generating a short, poetic message and calculating the exact X/Y coordinates for text placement near the bottom-left corner. The output is strictly formatted as JSON for easy parsing.

  5. Data Handling: The Edit Fields Set n8n node converts the incoming binary data into the expected property name (imagefile) for subsequent image processing n8n nodes.

  6. Create Postcard: The final Edit Image n8n node takes the binary image data and overlays the AI-generated text using the coordinates parsed dynamically from the AI Agent's JSON response, completing the postcard creation step of this n8n workflow.

  7. Share: Two Slack n8n nodes execute the final delivery: Upload a file posts the newly created image, and Send a message posts a simple follow-up text, successfully concluding the automated process initiated by the n8n trigger.

Installation Guide

To import and run this n8n workflow successfully, follow these steps:


  1. Import: Copy the entire JSON code and paste it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. NASA Credentials: Configure the Get NASA APOD n8n node with your NASA API credentials. A standard 'DEMO_KEY' may suffice, but a personal key is recommended for reliability.

  3. OpenAI Credentials: Configure the OpenAI Chat Model n8n node with your API key. Ensure you select the appropriate credential set.

  4. Slack Setup: The two Slack n8n nodes (Upload a file and Send a message) require OAuth2 credentials. After setting up the credentials, you must select the target Channel ID within the parameters of both Slack n8n nodes to ensure the postcard is shared correctly.

  5. Testing: Click the 'Execute Workflow' button on the 'When clicking 'Test workflow'' n8n trigger to run the automation for the first time.

Node Details

When clicking 'Test workflow' (Manual Trigger): The starting n8n trigger point for this automation.
Get NASA APOD (NASA n8n node): Fetches Astronomy Picture of the Day data, using a complex expression to randomly select a date within the last decade.
Check if Media Type is Image (If n8n node): Essential flow control. Ensures the workflow only proceeds if the NASA response contains an image (mediatype equals 'image').
Edit Image1 (Edit Image n8n node): Used purely for metadata extraction (operation: information), providing the image dimensions required by the AI agent for coordinate calculation.
OpenAI Chat Model (Language Model n8n node): The language model component, configured to use gpt-4.1-mini for fast and accurate response generation within the n8n workflow.
AI Agent (Langchain Agent n8n node): The core intelligence. It utilizes contextual information from previous n8n nodes (image dimensions and description) and instructs the OpenAI model to produce a poetic caption and precise text placement coordinates in a structured JSON output.
Edit Image (Edit Image n8n node): The critical image manipulation n8n node. It applies the 'text' operation, dynamically pulling the text and calculated X/Y coordinates from the AI Agent's parsed JSON output, overlaying the caption onto the image.
Upload a file (Slack n8n node): Posts the final, edited image file (binaryPropertyName: image
file) to the designated Slack channel.


  • Send a message (Slack n8n node): Sends a quick follow-up message to the same Slack channel, completing the communication aspect of the n8n template.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by
koichi nagino
koichi nagino

Featured*