Auto-Create Posts & Images with n8n + latest gpt-image-1 | End-to-End AI Content Workflow Tutorial

3 min read 7 months ago
Published on Aug 31, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial guides you through setting up an automated content creation workflow using n8n, integrating OpenAI's GPT-4 and the Images API. This end-to-end solution allows you to capture topics, generate polished LinkedIn posts, create corresponding images, and email the results—all without any coding. This workflow is ideal for marketers, freelancers, and solopreneurs looking to streamline their content production.

Step 1: Set Up the n8n Form Trigger Node

  1. Create a new workflow in n8n.

  2. Add a Form Trigger Node:

    • This node will capture input from a simple web form.
    • Configure the node to collect the topic and email address from users.
    • Make sure to set the appropriate fields for user input.
  3. Test the Form Trigger:

    • Deploy your form and submit a test entry.
    • Ensure that the workflow successfully captures the data.

Step 2: Craft Prompts for the Post Agent

  1. Add the OpenAI GPT-4 Node:

    • Connect this node to the Form Trigger.
    • Use the captured topic to create a prompt that instructs GPT-4 to draft a LinkedIn post based on the input.
  2. Design the Prompt:

    • For example, your prompt could be:
      Write a professional LinkedIn post about [topic].
      
    • Ensure the prompt is clear to get the best results from GPT-4.
  3. Test the Post Generation:

    • Run the workflow to see if GPT-4 generates the post correctly. Adjust the prompt if necessary for clarity and quality.

Step 3: Generate the Matching Image

  1. Add the OpenAI Images API Node:

    • Connect this node after the GPT-4 node.
    • Use the same topic to create an image prompt.
  2. Design the Image Prompt:

    • A sample prompt could be:
      Create an image that visually represents [topic].
      
  3. Test the Image Generation:

    • Run the workflow to check if the image is generated successfully. Make adjustments to the prompt for better results if needed.

Step 4: Convert Base64 to Binary

  1. Add a Function Node:

    • This node will convert the image received from the OpenAI Images API from base64 format to binary.
    • Use the following code snippet:
      items[0].binary = {
        data: Buffer.from(items[0].json.image_base64, 'base64'),
        mimeType: 'image/png',
      };
      return items;
      
  2. Test the Conversion:

    • Ensure the function node correctly transforms the image format for email attachment.

Step 5: Send Everything via Email

  1. Add the Email Node:

    • Connect this node after the Function Node.
    • Configure it to send an email to the address collected from the form.
  2. Set Up Email Content:

    • Include both the generated LinkedIn post and the image as attachments.
    • Make sure to set the subject and body of the email to clearly communicate the content.
  3. Test the Email Sending:

    • Run the complete workflow to verify that the email sends correctly with both the post and image attached.

Conclusion

By completing these steps, you have successfully built an automated workflow that captures user input, generates a LinkedIn post and image, and emails the result—all using n8n and OpenAI. This process saves time and enhances productivity, allowing you to focus on other aspects of your work. To further customize your workflow, consider experimenting with different prompts or integrating additional nodes for more complex functionalities. Happy automating!