Back to Templates
This n8n workflow scrapes recent Instagram posts by hashtag and generates new, relevant caption ideas using OpenAI. It avoids making up suggestions by analyzing real-world content and surfacing common patterns.
Marketing teams, content creators, or social media managers can:
When clicking ‘Execute workflow’
Create Search Term
n8n
, but you can modify it to anything.{
"Search_Term": "yourCustomHashtag"
}
Find Recent Posts
HTTP Query Auth
?token=yourTokenHere
as the query stringJSON Body:
{
"hashtags": ["{{ $json.Search_Term }}"],
"resultsLimit": 20,
"resultsType": "posts"
}
Set bio and follower count
caption
from each post and stores it in a clean variable for the AI agent to use.Aggregate
Convert table names and columns into single text for agent
Code
node to combine all captions into a single string for OpenAI to read:return [
{
json: {
text: items
.map(item => `- ${JSON.stringify(item.json)}`)
.join('\n\n'),
},
},
];
AI Agent
I'm looking for ideas for posts about {{ $('Create Search Term').item.json.Search_Term }}.
Here’s the last 5 posts on Instagram about the topic. Use those to help me generate a list of relevant captions.
Do not make up ideas that are not like the others in the list.
Output like this:
{
"Post Idea": ["Idea1", "Idea2"],
"Most Common Post": ["common post 1", "common post 2"]
}
OpenAI Chat Model
gpt-4o-mini
Structured Output Parser
{
"Post Idea": ["Idea1", "Idea2"],
"Most Common Post": ["common post 1", "common post 2"]
}
Split Out
, Split Out1
Post Idea
list and Most Common Post
list into individual items.Merge
Robert Breen
Automation Consultant | AI Workflow Designer | n8n Expert
📧 [email protected]
🔗 LinkedIn