Building a LinkedIn Post Generator: A Step-by-Step Guide Using n8n and Azure OpenAI
Introduction
In today’s digital landscape, businesses and individuals must create and share high-quality content efficiently to stay competitive and visible on platforms like LinkedIn. Manually searching for content and crafting posts can be time-consuming and labor-intensive. Luckily, tools like n8n and Azure OpenAI allow you to build an automated LinkedIn post generator.
This blog will guide you through creating a LinkedIn post generator using n8n and Azure OpenAI, helping you save time and consistently produce quality content.
Getting Started with n8n
n8n is an open-source automation tool that enables users to build workflows through a user-friendly visual interface. It connects various applications and services, automating data transfer and processing.
Key Features of n8n
-
Nodes: The building blocks of workflows in n8n. Trigger nodes start workflows, while regular nodes perform actions like sending emails or calling APIs. -
Workflows: Logical sequences of nodes. They can have conditions, branches, and loops, and can be triggered manually or automatically. -
Expressions: Allow dynamic data referencing from previous nodes using double curly braces {{ }}
, supporting JavaScript expressions. -
Credentials: Securely store credentials for connecting to external services, reusable across workflows. -
Variables & Context: Use variables like $node
,$json
to access runtime data. -
Data Structures: JSON is the primary data format. Use “Set” or “Function” nodes to create or modify data. -
Function & Function Item Nodes: Write custom JavaScript for advanced logic. -
n8n Editor UI: A web-based interface for designing and managing workflows, visualizing flow logic, testing runs, and debugging. -
Execution Modes: Support manual execution for testing and production (active) execution triggered by events. Also includes retry and error handling mechanisms.
Accessing n8n
-
Option 1: Use n8n cloud service. Visit n8n official website and get started immediately. -
Option 2: Deploy the community version locally. Install Docker Desktop, then execute commands in the terminal to create a data volume and start the n8n service.
Step-by-Step Guide to Building the LinkedIn Post Generator
Step 1: Add Triggers
Begin by adding a time-based trigger and a manual trigger to your workflow. The time-based trigger will automate workflow execution at set intervals, while the manual trigger is handy for testing.
Step 2: Add RSS URL
Input the RSS URL https://machinelearningmastery.com/blog/feed/ into the RSS node and click “Test” to ensure successful data retrieval.
Step 3: Add a Filter Node
Set up a filter node to include only articles published after a certain date and with “AI” in the title, ensuring fresh and relevant content.
Step 4: Add a Limit Node
Add a limit node to control the number of entries processed. Limiting to 5 entries helps avoid excessive API calls to OpenAI and manage costs.
Step 5: Write Prompt Code
Insert a code node with the following JavaScript code to generate prompts for each article:
return items.map(item => ({
json: {
prompt: `Write a short and engaging LinkedIn post about this AI article:\nTitle: ${item.json.title}\nContent: ${item.json.content}\nLink: ${item.json.link}\nKeep it under 250 words and use a professional tone.`,
}
}));
This code generates prompts that guide the AI model to produce LinkedIn posts based on the article’s title, content, and link, within a 250-word limit and in a professional tone.
Step 6: Add AI Agent
Add an AI Agent node, setting the system prompt to “LinkedIn Post Writer” and the user message to the output from the previous code node. This node sends tasks to the AI model and retrieves generated post content.
Step 7: Integrate Azure OpenAI Model
Before adding the Azure OpenAI model node, create credentials in n8n by entering your Azure OpenAI service’s API key and configuration details. Then, in the Azure OpenAI model node, select the appropriate model and set parameters like maximum tokens and temperature.
Step 8: Connect LinkedIn Node
Add a LinkedIn node to publish the generated posts. Input your LinkedIn account credentials and configure post settings like publishing location.
Testing the Workflow
After completing the setup, click the “Test Workflow” button to start the workflow execution. Monitor each node’s output and status in the execution tab to ensure everything runs smoothly. In the AI Agent node’s output window, you’ll see the generated LinkedIn post content. If satisfied with the results, reconnect the LinkedIn node and re-run the workflow to publish the posts.
Conclusion
This guide has walked you through creating a LinkedIn Post Generator using n8n and Azure OpenAI. From fetching AI articles via RSS feeds to generating professional posts with Agentic workflows, this low-code solution combines automation and AI effortlessly. Whether you’re a solo founder, content creator, or tech enthusiast, this project offers a great way to explore AI applications in a flexible and structured manner. Feel free to tweak the workflow with different feeds, refine prompts, or integrate scheduling for auto-posting to expand its capabilities.