🎬 Generate & upload images with Leonardo AI, WordPress and Twitter

⚑ 1,695 views · 🎬 Content Creation & Video

Description

Prompt-to-Image Generator & WordPress Uploader (n8n Workflow)

This workflow generates high-quality AI images from text prompts using Leonardo AI, then automatically uploads the result to your WordPress media library and returns the final image URL.

It functions as a Modular Content Production (MCP) tool - ideal for AI agents or workflows that need to dynamically generate and store visual assets on-demand.


βš™οΈ Features


🧠 Use Cases

For AI Agents (MCP)

For Marketers / Bloggers

For Developers / Creators


πŸ“₯ Inputs

FieldTypeDescription
promptstringText prompt for image generation
slugstringFilename identifier (e.g. hero-image)

Example:

{
  "prompt": "A futuristic city skyline at night",
  "slug": "futuristic-city"
}

πŸ“€ Output

{
  "public_image_url" : "https://your.wordpress.com/img-id",
  "wordpress":{...obj},
  "twitter":{...obj}
}

πŸ”„ Workflow Summary

  1. Receive Prompt & Slug Via manual trigger or parent workflow execution
  2. Generate Image POST to Leonardo AI’s API with the prompt and config
  3. Wait & Poll Delays 1 minute, then fetches final image metadata
  4. Download Image GET request to retrieve generated image
  5. Upload to WordPress Uses WordPress REST API with proper headers
  6. Upload to Twitter Uses Twitter Media Upload API to get the media id incase you want to post the image to twitter
  7. Return Result Outputs a clean public_image_url JSON object along with wordpress and twitter media objects

πŸ” Requirements

🧩 Node Stack

πŸ–Ό Example Prompt

{
  "prompt": "Batman typing on a laptop",
  "slug": "batman-typing-on-a-laptop"
}

Will return:

{
"public_image_url": "https://articles.emp0.com/wp-content/uploads/2025/07/img-batman-typing-on-a-laptop.jpg"
}

🧠 Integrate with AI Agents

This workflow is MCP-compliantβ€”plug it into:

Trigger it from any parent AI agent that needs to generate an image based on a given idea, post, or instruction.

πŸ”— Nodes Used

HTTP Request, Execute Workflow Trigger

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup