mirror of
https://github.com/khoaliber/n8nworkflows.xyz.git
synced 2026-04-28 00:29:22 +00:00
creation
This commit is contained in:
+226
@@ -0,0 +1,226 @@
|
||||
Generate and Auto-Publish LinkedIn Posts with GPT-4 Text and AI Images
|
||||
|
||||
https://n8nworkflows.xyz/workflows/generate-and-auto-publish-linkedin-posts-with-gpt-4-text-and-ai-images-8007
|
||||
|
||||
|
||||
# Generate and Auto-Publish LinkedIn Posts with GPT-4 Text and AI Images
|
||||
|
||||
### 1. Workflow Overview
|
||||
|
||||
This workflow automates the creation and publishing of LinkedIn posts starting from a user-submitted post idea. It leverages OpenAI GPT-4 for generating engaging LinkedIn post text and AI-driven image creation for visual accompaniment. Finally, it publishes the composed post (text + image) directly to LinkedIn.
|
||||
|
||||
**Target Use Cases:**
|
||||
- Social media managers or content creators wanting to streamline LinkedIn post creation.
|
||||
- Marketing teams seeking to maintain consistent, branded content with personalized tone.
|
||||
- Automation enthusiasts integrating AI-generated content into social channels.
|
||||
|
||||
**Logical Blocks:**
|
||||
|
||||
- **1.1 Input Reception**: Captures the initial LinkedIn post idea through a web form submission.
|
||||
- **1.2 AI Text Generation**: Uses GPT-4 to convert the idea into a polished LinkedIn post text with brand voice and engagement optimization.
|
||||
- **1.3 AI Image Generation**: Creates a branded, minimalist visual asset corresponding to the post idea and text.
|
||||
- **1.4 Publishing**: Publishes the generated post text and image automatically to LinkedIn using OAuth2 credentials.
|
||||
|
||||
---
|
||||
|
||||
### 2. Block-by-Block Analysis
|
||||
|
||||
#### 1.1 Input Reception
|
||||
|
||||
- **Overview:**
|
||||
This block listens for form submissions containing the LinkedIn post idea. It initiates the workflow and supplies the core idea for AI processing.
|
||||
|
||||
- **Nodes Involved:**
|
||||
- Post Idea
|
||||
- Sticky Note (explaining the form trigger)
|
||||
|
||||
- **Node Details:**
|
||||
|
||||
- **Post Idea**
|
||||
- *Type:* Form Trigger
|
||||
- *Role:* Starts the workflow on new form submissions capturing the post idea.
|
||||
- *Configuration:*
|
||||
- Form titled "LINKEDIN POST IDEA" with one required field labeled "Idea" (e.g., "The impact of AI in 2026").
|
||||
- No additional options enabled.
|
||||
- Webhook ID configured for external form submissions.
|
||||
- *Inputs:* External HTTP trigger (form submission).
|
||||
- *Outputs:* JSON containing the user-submitted `Idea`.
|
||||
- *Potential Failures:* Form submission errors, malformed input, webhook connectivity issues.
|
||||
- *Notes:* Acts as the entry point for the workflow.
|
||||
- *Sticky Note:* Explains purpose and usage of this node.
|
||||
|
||||
- **Sticky Note** (Positioned near "Post Idea")
|
||||
- Describes the trigger function and captures of the post idea.
|
||||
|
||||
#### 1.2 AI Text Generation
|
||||
|
||||
- **Overview:**
|
||||
Generates a compelling LinkedIn post text from the submitted idea using OpenAI GPT-4. The prompt is crafted to produce personal, engaging, and brand-aligned content, including emojis and a call to action.
|
||||
|
||||
- **Nodes Involved:**
|
||||
- Generate Post Text
|
||||
- Sticky Note1 (explaining the text generation step)
|
||||
|
||||
- **Node Details:**
|
||||
|
||||
- **Generate Post Text**
|
||||
- *Type:* OpenAI (Langchain Integration)
|
||||
- *Role:* Converts the raw idea into a professional LinkedIn post paragraph.
|
||||
- *Configuration:*
|
||||
- Model: GPT-4.1-MINI (a GPT-4 variant optimized for text generation).
|
||||
- Prompt: Detailed system message instructing the AI to write as if it is the founder of a company, with a personal and approachable tone, adding emojis if helpful, and ending with a call to action.
|
||||
- Input Expression: Injects `{{ $json.Idea }}` from the form submission into the prompt as the post idea.
|
||||
- *Inputs:* JSON data with `Idea` from form trigger.
|
||||
- *Outputs:* JSON containing the generated post text under `message.content`.
|
||||
- *Credentials:* OpenAI API credentials required.
|
||||
- *Potential Failures:* API authentication errors, rate limiting, prompt formatting issues, empty or invalid input.
|
||||
- *Version Requirements:* Uses Langchain OpenAI node, version 1.8.
|
||||
- *Sticky Note1:* Explains AI prompt customization and output purpose.
|
||||
|
||||
- **Sticky Note1**
|
||||
- Describes the text generation node’s role and prompt customization.
|
||||
|
||||
#### 1.3 AI Image Generation
|
||||
|
||||
- **Overview:**
|
||||
Creates a visual asset aligned with the LinkedIn post idea and generated text, using an AI image model. The prompt specifies minimalist design, brand colors, typography, and professional style.
|
||||
|
||||
- **Nodes Involved:**
|
||||
- Visual Creation
|
||||
- Sticky Note2 (explaining image generation)
|
||||
|
||||
- **Node Details:**
|
||||
|
||||
- **Visual Creation**
|
||||
- *Type:* OpenAI Image Generation (Langchain Integration)
|
||||
- *Role:* Produces a minimalist, branded LinkedIn post cover image.
|
||||
- *Configuration:*
|
||||
- Model: `gpt-image-1` (OpenAI image generation model).
|
||||
- Prompt: Dynamically includes:
|
||||
- The post idea `{{ $('Post Idea').item.json.Idea }}`
|
||||
- Additional context from the generated post text (`{{ $json.message.content }}`)
|
||||
- Design requirements specifying minimalist style, clean background, brand color gradient (purple to dark blue), modern typography (Open Sans), and professional composition.
|
||||
- Resource type set to `image`.
|
||||
- *Inputs:* JSON containing `Idea` and generated text content.
|
||||
- *Outputs:* Image data or URL (depending on API response).
|
||||
- *Credentials:* OpenAI API credentials required.
|
||||
- *Potential Failures:* Image generation API errors, prompt misinterpretation, content restrictions, rate limits.
|
||||
- *Version Requirements:* Langchain OpenAI node version 1.8.
|
||||
- *Sticky Note2:* Describes the visual asset generation and branding focus.
|
||||
|
||||
- **Sticky Note2**
|
||||
- Explains the image generation's purpose and design guidelines.
|
||||
|
||||
#### 1.4 Publishing
|
||||
|
||||
- **Overview:**
|
||||
Publishes the combined generated text and image as a LinkedIn post on the connected LinkedIn account, completing the automation pipeline.
|
||||
|
||||
- **Nodes Involved:**
|
||||
- Post on LinkedIn
|
||||
- Sticky Note3 (explains LinkedIn publishing)
|
||||
|
||||
- **Node Details:**
|
||||
|
||||
- **Post on LinkedIn**
|
||||
- *Type:* LinkedIn Node (OAuth2 Auth)
|
||||
- *Role:* Posts the final content to LinkedIn timeline.
|
||||
- *Configuration:*
|
||||
- Text: Pulled from the `Generate Post Text` node’s output (`={{ $('Generate Post Text').item.json.message.content }}`).
|
||||
- Person: LinkedIn user identifier (`K6f9KL_emA`).
|
||||
- Share Media Category: Set to "IMAGE" to indicate post includes image.
|
||||
- Additional Fields: Left empty, default behavior for sharing.
|
||||
- *Inputs:* Post text and image URL/data from previous nodes.
|
||||
- *Outputs:* Confirmation of post publication or error details.
|
||||
- *Credentials:* LinkedIn OAuth2 credentials required and must be connected prior to execution.
|
||||
- *Potential Failures:* OAuth token expiration, permission issues, LinkedIn API limits, content rejection, malformed request.
|
||||
- *Sticky Note3:* Provides publishing instructions and credential reminder.
|
||||
- *Version Requirements:* n8n LinkedIn node current stable version.
|
||||
|
||||
- **Sticky Note3**
|
||||
- Highlights the publishing step and credential requirements.
|
||||
|
||||
---
|
||||
|
||||
### 3. Summary Table
|
||||
|
||||
| Node Name | Node Type | Functional Role | Input Node(s) | Output Node(s) | Sticky Note |
|
||||
|-------------------|--------------------------------|---------------------------------|---------------------|----------------------|----------------------------------------------------------------------------------------------------|
|
||||
| Sticky Note | Sticky Note | Explains form submission trigger| | | On Form Submission: triggers workflow on new form submission to capture post idea |
|
||||
| Post Idea | Form Trigger | Captures user input for post idea| | Generate Post Text | Triggers workflow on form submission; captures "post idea" field |
|
||||
| Generate Post Text | OpenAI (Langchain) | Generates LinkedIn post text | Post Idea | Visual Creation | Uses GPT-4 to expand idea into engaging LinkedIn post with brand voice and call to action |
|
||||
| Sticky Note1 | Sticky Note | Explains text generation step | | | Details AI prompt customization for brand voice and engagement |
|
||||
| Sticky Note2 | Sticky Note | Explains image generation step | | | Describes AI image creation with brand colors and visual style |
|
||||
| Visual Creation | OpenAI Image Generation (Langchain)| Creates branded LinkedIn image | Generate Post Text | Post on LinkedIn | Generates minimalist, branded image based on post idea and text |
|
||||
| Sticky Note3 | Sticky Note | Explains LinkedIn publishing | | | Publishes generated text + image to LinkedIn; requires LinkedIn OAuth2 credentials |
|
||||
| Post on LinkedIn | LinkedIn Node (OAuth2) | Publishes post to LinkedIn | Visual Creation | | Posts final LinkedIn content; ensure LinkedIn credentials connected prior to execution |
|
||||
|
||||
---
|
||||
|
||||
### 4. Reproducing the Workflow from Scratch
|
||||
|
||||
1. **Create Form Trigger Node ("Post Idea")**
|
||||
- Type: Form Trigger
|
||||
- Configure form title as "LINKEDIN POST IDEA".
|
||||
- Add one required field:
|
||||
- Label: "Idea"
|
||||
- Placeholder: "The impact of AI in 2026"
|
||||
- Save and note the webhook URL generated for external submissions.
|
||||
|
||||
2. **Add OpenAI Node for Text Generation ("Generate Post Text")**
|
||||
- Type: OpenAI (Langchain)
|
||||
- Credentials: Connect OpenAI API credentials (ensure GPT-4 access).
|
||||
- Model: Select "gpt-4.1-mini" or equivalent GPT-4 variant.
|
||||
- Messages:
|
||||
- System message: Set detailed prompt instructing AI to write as a founder with a personal tone, adding emojis, ending with a call to action.
|
||||
- User message: Insert expression to pass the post idea: `="Idea for the post: " + $json.Idea`
|
||||
- Connect input from "Post Idea" node.
|
||||
|
||||
3. **Add OpenAI Image Generation Node ("Visual Creation")**
|
||||
- Type: OpenAI Image Generation (Langchain)
|
||||
- Credentials: Same OpenAI API credentials as above.
|
||||
- Model: Use "gpt-image-1" or equivalent image generation model.
|
||||
- Prompt: Construct a dynamic expression including:
|
||||
- The idea from the form: `{{ $('Post Idea').item.json.Idea }}`
|
||||
- The generated post text content: `{{ $json.message.content }}`
|
||||
- Design instructions: minimalist style, brand colors (purple to dark blue gradient), modern typography (Open Sans), professional LinkedIn composition.
|
||||
- Set resource type to "image".
|
||||
- Connect input from "Generate Post Text" node.
|
||||
|
||||
4. **Add LinkedIn Node ("Post on LinkedIn")**
|
||||
- Type: LinkedIn Node
|
||||
- Credentials: Connect LinkedIn OAuth2 credentials with necessary permissions to post content.
|
||||
- Configure fields:
|
||||
- Text: Expression to use generated post text: `={{ $('Generate Post Text').item.json.message.content }}`
|
||||
- Person: Set LinkedIn user ID (e.g., `K6f9KL_emA`) or leave default for authenticated user.
|
||||
- Share Media Category: Set to "IMAGE" to attach the generated image.
|
||||
- Connect input from "Visual Creation" node.
|
||||
|
||||
5. **Link Nodes in Sequence**
|
||||
- Connect "Post Idea" → "Generate Post Text"
|
||||
- Connect "Generate Post Text" → "Visual Creation"
|
||||
- Connect "Visual Creation" → "Post on LinkedIn"
|
||||
|
||||
6. **Add Sticky Notes (Optional but Recommended)**
|
||||
- Add sticky notes near each functional block explaining their purpose, referencing content from this documentation.
|
||||
|
||||
7. **Activate Workflow**
|
||||
- Ensure all credentials are valid and connected.
|
||||
- Activate workflow and test by submitting a sample LinkedIn post idea via the form webhook.
|
||||
|
||||
---
|
||||
|
||||
### 5. General Notes & Resources
|
||||
|
||||
| Note Content | Context or Link |
|
||||
|------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
|
||||
| The form trigger node uses webhook-based form submissions for real-time input capture. | [Form Trigger Node Documentation](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.formtrigger/) |
|
||||
| LinkedIn OAuth2 credentials must be authorized with permissions to post on behalf of the user. | [LinkedIn Node Documentation](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.linkedin/) |
|
||||
| OpenAI model selection can be customized to balance cost and output quality; GPT-4.1-MINI is recommended. | OpenAI API official docs: https://platform.openai.com/docs/models/gpt-4 |
|
||||
| The image generation prompt is designed for professional branding with minimalist aesthetics. | Consider adjusting brand colors and typography in prompt to match your brand guidelines. |
|
||||
| Use of sticky notes in n8n helps document the workflow logic for future maintainers or collaborators. | Sticky notes contain important contextual information and usage instructions. |
|
||||
|
||||
---
|
||||
|
||||
**Disclaimer:**
|
||||
The text provided derives solely from an n8n automated workflow export. It fully complies with content policies and contains no illegal, offensive, or protected elements. All handled data are legal and publicly accessible.
|
||||
Reference in New Issue
Block a user