AutomationFlowsContent & Video › Generate & Upload Images with Leonardo Ai, Wordpress and Twitter

Generate & Upload Images with Leonardo Ai, Wordpress and Twitter

ByJay Emp0 @jay-emp0 on n8n.io

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.

Event trigger★★★★☆ complexity16 nodesHTTP RequestExecute Workflow Trigger
Content & Video Trigger: Event Nodes: 16 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #6363 — we link there as the canonical source.

This workflow follows the Execute Workflow Trigger → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "855d3c0d-0a4b-4a6b-a8cd-be67cff0928b",
      "name": "Upload image2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        912,
        -16
      ],
      "parameters": {
        "url": "https://your.wordpress.com/wp-json/wp/v2/media",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Disposition",
              "value": "=attachment; filename=\"img-{{ $('Code1').item.json.slug }}.jpg\""
            }
          ]
        },
        "inputDataFieldName": "data",
        "nodeCredentialType": "wordpressApi"
      },
      "credentials": {
        "wordpressApi": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 5000
    },
    {
      "id": "67d0cf44-13b2-4cee-a796-8fd021dd4a2b",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        -16
      ],
      "parameters": {
        "url": "https://cloud.leonardo.ai/api/rest/v1/generations",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"modelId\": \"b2614463-296c-462a-9586-aafdb8f00e36\",\n  \"contrast\": 3.5,\n  \"prompt\": \"{{$json.prompt }}\",\n  \"num_images\": 1,\n  \"width\": 1472,\n  \"height\": 832,\n  \"styleUUID\": \"111dc692-d470-4eec-b791-3475abac4c46\",\n  \"enhancePrompt\": true\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "content-type",
              "value": "application/json"
            },
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0b478d3e-481c-4190-bfea-ea2d13d0c1fc",
      "name": "HTTP Request2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        560,
        -16
      ],
      "parameters": {
        "url": "=https://cloud.leonardo.ai/api/rest/v1/generations/{{ $json.sdGenerationJob.generationId }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4a41c6c9-8467-4d49-a758-13cbf7b5c6ce",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        400,
        -16
      ],
      "parameters": {
        "unit": "minutes",
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "225e26b5-97b7-4186-9c71-bb2d8bcaa7c6",
      "name": "HTTP Request3",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        736,
        -16
      ],
      "parameters": {
        "url": "={{ $json.generations_by_pk.generated_images[0].url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "d8bab379-3d86-4754-9894-e04596832464",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        -112
      ],
      "parameters": {
        "color": 5,
        "width": 672,
        "height": 272,
        "content": "## Generate image with leonardo"
      },
      "typeVersion": 1
    },
    {
      "id": "ce8b507c-213c-4288-88d2-356a96ed5956",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -112
      ],
      "parameters": {
        "color": 6,
        "width": 166,
        "height": 272,
        "content": "## Upload to WordPress"
      },
      "typeVersion": 1
    },
    {
      "id": "0ed127f7-26bc-4750-8ade-6bd672d95a5f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        176
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 432,
        "content": "## Image generated\n![batman-typing-on-a-laptop](https://articles.emp0.com/wp-content/uploads/2025/07/img-batman-typing-on-a-laptop.jpg)"
      },
      "typeVersion": 1
    },
    {
      "id": "76eafb67-e5b6-4bc2-ac8d-e2661ef10f44",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -144,
        160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c124d2ca-f8a6-4b59-84dd-61181bcc2501",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        1456,
        0
      ],
      "parameters": {
        "jsCode": "return {\n  \"public_image_url\" :$input.first().json.data[0].guid.raw,\n  \"wordpress\":$input.first().json.data[0],\n  \"twitter\":$input.first().json.data[1]\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "239aa1ee-ef8d-41f6-a34c-a0d097e9d849",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -144,
        -16
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "prompt"
            },
            {
              "name": "slug"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "773eab92-6f49-4b35-bde8-081c86785c9a",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "position": [
        64,
        -16
      ],
      "parameters": {
        "jsCode": "return $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "f5b60545-3f6e-453c-80de-a76c614a95b1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        192
      ],
      "parameters": {
        "color": 6,
        "width": 166,
        "height": 272,
        "content": "## Upload to Twitter"
      },
      "typeVersion": 1
    },
    {
      "id": "1b4cac4d-17b0-44db-84aa-de970fb48ed0",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1120,
        0
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "f78fca3e-d4b7-4836-ad6c-412d253e805b",
      "name": "Upload Media (X)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        912,
        288
      ],
      "parameters": {
        "url": "https://upload.twitter.com/1.1/media/upload.json?media_category=TWEET_IMAGE",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "media",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "nodeCredentialType": "twitterOAuth1Api"
      },
      "credentials": {
        "twitterOAuth1Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c3ee67e2-9b71-4552-8693-e4c7bb004fc0",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1280,
        0
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request2": {
      "main": [
        [
          {
            "node": "HTTP Request3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request3": {
      "main": [
        [
          {
            "node": "Upload image2",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload Media (X)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload image2": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Media (X)": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this 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.

Source: https://n8n.io/workflows/6363/ — original creator credit. Request a take-down →

More Content & Video workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Content & Video

This template can backup WordPress context github。

HTTP Request, GitHub, Execute Workflow Trigger +1
Content & Video

Enrich Faq Sections On Your Website Pages At Scale With Ai. Uses manualTrigger, lmChatOpenAi, splitInBatches, splitOut. Event-driven trigger; 36 nodes.

OpenAI Chat, Google Drive, Google Sheets +6
Content & Video

Strapi Splitout. Uses manualTrigger, lmChatOpenAi, splitInBatches, splitOut. Event-driven trigger; 36 nodes.

OpenAI Chat, Google Drive, Google Sheets +6
Content & Video

2434. Uses lmChatOpenAi, googleDrive, googleSheets, executeWorkflowTrigger. Event-driven trigger; 36 nodes.

OpenAI Chat, Google Drive, Google Sheets +6
Content & Video

This n8n workflow template lets you easily generate comprehensive FAQ (Frequently Asked Questions) content for multiple services (or any items or pages you need to add the FAQs to). Simply provide the

OpenAI Chat, Google Drive, Google Sheets +6