Skip to main content

Generate blog posts and social media content with GPT-4.1 and Pexels images

Workflow preview

Workflow preview
100%
Generate blog posts and social media content with GPT-4.1 and Pexels images preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

AI Content Generator with Auto Pexels Image Matching This n8n template demonstrates how to use AI to generate engaging content and automatically find matching royalty free images based on the conte...

Best for

  • Content Creation automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.httprequest, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.code, n8n-nodes-base.html, n8n-nodes-base.stickynote, n8n-nodes-base.formtrigger, @n8n/n8n-nodes-langchain.lmchatopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Wan Dinie.

Original n8n.io source

1.1 Workflow description

Title
Generate blog posts and social media content with GPT-4.1 and Pexels images
Workflow name
Generate blog posts and social media content with GPT-4.1 and Pexels images

AI Content Generator with Auto Pexels Image Matching

This n8n template demonstrates how to use AI to generate engaging content and automatically find matching royalty-free images based on the content context.

Use cases are many: Try creating blog posts with hero images, generating social media content with visuals or drafting email newsletters with relevant photos.

Good to know

  • At time of writing, Pexels offers free API access with up to 200 requests per hour. See Pexels API for updated info.
  • OpenAI API costs vary by model. GPT-4.1 mini is cheaper while normal GPT-4.1 and above offer deeper content generation but cost more per request.
  • Using the floating JavaScript node can reduce token usage by processing content and keyword extraction in a single prompt.

How it works

  1. We'll collect a content topic or idea via a manual form trigger.
  2. OpenAI generates initial content based on your input topic.
  3. The AI extracts suitable keywords from the generated content to find matching images.
  4. The keywords are sent to Pexels API, which searches for relevant royalty-free stock images.
  5. OpenAI creates the final polished content that complements the selected image.
  6. The result is displayed as a formatted HTML template combining content and image together.

How to use

  • The manual trigger node is used as an example, but feel free to replace this with other triggers such as webhook or even a form.
  • You can batch-generate multiple pieces of content by looping through a list, but of course, the processing will take longer and cost more.

Requirements

Customizing this workflow

  • Optimize token usage: Connect the floating "Extract Content and Image Keyword" JavaScript node to process everything in one prompt and minimize API costs. If you use this option, update the expressions in the "Pexels Image Search" node and "Create Suitable Content Including Image" node to reference the extracted keywords from the JS node.
  • Upgrade to GPT-4.1, GPT-5.1, or GPT-5.2 for more advanced and creative content generation.
  • Change the HTML template output to other formats like Markdown, plain text, or JSON for different publishing platforms.
  • For long term, store the results in a database like Supabase or Google Sheets if you are planning to reuse the contents.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Pexels Image Search

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 2 - Create Content with AI

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3

Block 3 - Find suitable content keyword

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 2

Block 4 - Create Suitable Content Including Image

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3

Block 5 - Extract Content and Image Keyword

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - View the Result

Type / Role
n8n-nodes-base.html - html
Config choices
Version 1.2

Block 7 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - On form submission

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.3

Block 9 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Create Content and Find Suitable Image

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3

Block 15 - OpenAI 4.1 mini

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.3

Block 16 - OpenAi 4.1 Mini

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.3

Block 17 - OpenAI 4.1 mini for Content and Image

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.3

3. Summary Table

Workflow Generate blog posts and social media content with GPT-4.1 and Pexels images
Complexity advanced
Nodes 17
Categories Content Creation, Multimodal AI
Author Wan Dinie
Published 25 Dec 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/12123/12123.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Generate blog posts and social media content with GPT-4.1 and Pexels images do?

AI Content Generator with Auto Pexels Image Matching This n8n template demonstrates how to use AI to generate engaging content and automatically find matching royalty free images based on the conte...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Content Creation, Multimodal AI use case.