Automated LinkedIn Posts with AI-Generated Content using OpenAI GPT

Go to Workflow
0 views
Built by Wevanta Infotech Wevanta Infotech
Created on June 05, 2026

Description

LinkedIn Auto-Post Agent for n8n

🚀 Automate your LinkedIn presence with AI-powered content generation

This n8n workflow automatically generates and publishes engaging LinkedIn posts using OpenAI's GPT models. Perfect for professionals and businesses who want to maintain an active LinkedIn presence without manual effort.

✨ Features

🤖 AI-Powered Content**: Generate professional LinkedIn posts using OpenAI GPT-3.5-turbo or GPT-4
⏰ Automated Scheduling**: Post content automatically on weekdays at 9 AM (customizable)
🎯 Manual Trigger**: Generate and post content on-demand
🔒 Secure**: All credentials stored securely in n8n's encrypted credential system
📊 Error Handling**: Built-in retry logic and error notifications
🎨 Customizable**: Easily modify prompts, scheduling, and content parameters

🏗️ Architecture

This workflow uses a streamlined 3-node architecture:

Schedule/Manual Trigger → OpenAI Content Generation → LinkedIn Post

Node Details

Schedule Trigger: Automatically triggers the workflow (default: weekdays at 9 AM)
Manual Trigger: Allows on-demand content generation
OpenAI Content Generation: Creates LinkedIn-optimized content using AI
LinkedIn Post: Publishes the generated content to LinkedIn

📋 Prerequisites

n8n instance (self-hosted or cloud)
OpenAI API account and API key
LinkedIn account with API access
Basic familiarity with n8n workflows

🚀 Quick Start

1. Import the Workflow

Download the linkedin-auto-post-agent.json file
In your n8n instance, go to Workflows → Import from File
Select the downloaded JSON file
Click Import

2. Set Up Credentials

OpenAI API Credentials

Go to Credentials in your n8n instance
Click Create New Credential
Select OpenAI
Enter your OpenAI API key
Name it "OpenAI API" and save

LinkedIn OAuth2 Credentials

Create a LinkedIn App at LinkedIn Developer Portal
Configure OAuth 2.0 settings:
Redirect URL: https://your-n8n-instance.com/rest/oauth2-credential/callback
Scopes: r_liteprofile, w_member_social
In n8n, create new LinkedIn OAuth2 credentials
Enter your LinkedIn App's Client ID and Client Secret
Complete the OAuth authorization flow

3. Configure the Workflow

Open the imported workflow
Click on the OpenAI Content Generation node
Select your OpenAI credentials
Customize the content prompt if desired
Click on the LinkedIn Post node
Select your LinkedIn OAuth2 credentials
Save the workflow

4. Test the Workflow

Click the Manual Trigger node
Click Execute Node to test content generation
Verify the generated content in the LinkedIn node output
Check your LinkedIn profile to confirm the post was published

5. Activate Automated Posting

Click the Active toggle in the top-right corner
The workflow will now run automatically based on the schedule

⚙️ Configuration Options

Scheduling

The default schedule posts content on weekdays at 9 AM. To modify:

Click the Schedule Trigger node
Modify the Cron Expression: 0 9 * * 1-5
0 9 * * 1-5: Weekdays at 9 AM
0 12 * * *: Daily at noon
0 9 * * 1,3,5: Monday, Wednesday, Friday at 9 AM

Content Customization

Modify the OpenAI prompt to change content style:

Click the OpenAI Content Generation node
Edit the System Message to adjust tone and style
Modify the User Message to change topic focus

Example Prompts

Professional Development Focus:
Create a LinkedIn post about professional growth, skill development, or career advancement. Keep it under 280 characters and include 2-3 relevant hashtags.

Industry Insights:
Generate a LinkedIn post sharing an industry insight or trend in technology. Make it thought-provoking and include relevant hashtags.

Motivational Content:
Write an inspiring LinkedIn post about overcoming challenges or achieving goals. Keep it positive and engaging with appropriate hashtags.

Model Selection

Choose between OpenAI models based on your needs:

gpt-3.5-turbo**: Cost-effective, good quality
gpt-4**: Higher quality, more expensive
gpt-4-turbo**: Latest model with improved performance

🔧 Advanced Configuration

Error Handling

The workflow includes built-in error handling:

Retry Logic**: 3 attempts with 1-second delays
Continue on Fail**: Workflow continues even if individual nodes fail
Error Notifications**: Optional email/Slack notifications on failures

Content Review Workflow (Optional)

To add manual content review before posting:

Add a Wait node between OpenAI and LinkedIn nodes
Configure webhook trigger for approval
Add conditional logic based on approval status

Rate Limiting

To respect API limits:

OpenAI: 3 requests per minute (default)
LinkedIn: 100 posts per day per user
Adjust scheduling frequency accordingly

📊 Monitoring and Analytics

Execution History

Go to Executions in your n8n instance
Filter by workflow name to see all runs
Click on individual executions to see detailed logs

Key Metrics to Monitor

Success Rate**: Percentage of successful executions
Content Quality**: Review generated posts periodically
API Usage**: Monitor OpenAI token consumption
LinkedIn Engagement**: Track post performance on LinkedIn

🛠️ Troubleshooting

Common Issues

OpenAI Node Fails
Verify API key is correct and has sufficient credits
Check if you've exceeded rate limits
Ensure the model name is spelled correctly

LinkedIn Node Fails
Verify OAuth2 credentials are properly configured
Check if LinkedIn app has required permissions
Ensure the content doesn't violate LinkedIn's posting policies

Workflow Doesn't Trigger
Confirm the workflow is marked as "Active"
Verify the cron expression syntax
Check n8n's timezone settings

Debug Mode

Enable Save Manual Executions in workflow settings
Run the workflow manually to see detailed execution data
Check each node's input/output data

🔒 Security Best Practices

Store all API keys in n8n's encrypted credential system
Regularly rotate API keys (monthly recommended)
Use environment variables for sensitive configuration
Enable execution logging for audit trails
Monitor for unusual API usage patterns

📈 Optimization Tips

Content Quality
Review and refine prompts based on output quality
A/B test different prompt variations
Monitor LinkedIn engagement metrics
Adjust posting frequency based on audience response

Cost Optimization
Use gpt-3.5-turbo for cost-effective content generation
Set appropriate token limits (200 tokens recommended)
Monitor OpenAI usage in your dashboard

Performance
Keep workflows simple with minimal nodes
Use appropriate retry settings
Monitor execution times and optimize if needed

🤝 Contributing

We welcome contributions to improve this workflow:

Fork the repository
Create a feature branch
Make your improvements
Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

If you encounter issues or have questions:

Check the troubleshooting section above
Review n8n's official documentation
Join the n8n community forum
Create an issue in this repository

🔗 Useful Links

n8n Documentation
OpenAI API Documentation
LinkedIn API Documentation
n8n Community Forum

Happy Automating! 🚀

This workflow helps you maintain a consistent LinkedIn presence while focusing on what matters most - your business and professional growth.

Nodes Used (2)

LinkedIn
n8n-nodes-base.linkedIn
OpenAI
n8n-nodes-base.openAi