Documentation
Build a Social Media Automation Pipeline
One prompt generates Twitter threads, LinkedIn posts, and Instagram captions with images. Post to all platforms automatically.
One prompt generates Twitter threads, LinkedIn posts, and Instagram captions with images. Post to all platforms automatically.
What You'll Build
An automation tool that creates platform-specific content from a single idea and schedules posts across Twitter, LinkedIn, and Instagram.
Why This Is Powerful
- Write once, publish everywhere
- AI-optimized for each platform
- Automated image generation
- Scheduling built-in
Prerequisites
- SkillBoss account
- Social media API tokens (Twitter, LinkedIn)
- Node.js experience
Architecture
Input: Topic or article URL Skills: openai/gpt-4o, flux/schnell, twitter-api, linkedin-api Output: Scheduled posts on all platforms
Step 1: Setup Project
Initialize Node.js project and install dependencies:
npm init -y
npm install openai twitter-api-v2 linkedin-api-client dotenv
Step 2: Create Content Generator
Generate platform-specific content with one prompt:
// content-generator.ts
import { OpenAI } from 'openai'
const client = new OpenAI({
baseURL: 'https://api.skillboss.co/v1',
apiKey: process.env.SKILLBOSS_API_KEY,
})
async function generateContent(topic: string) {
const response = await client.chat.completions.create({
model: 'openai/gpt-4o',
messages: [{
role: 'system',
content: `Generate social media content in this JSON format:
{
"twitter": { "thread": ["tweet1", "tweet2", ...] },
"linkedin": { "post": "long-form post" },
"instagram": { "caption": "caption with emojis" }
}`
}, {
role: 'user',
content: `Topic: ${topic}`
}],
response_format: { type: 'json_object' }
})
return JSON.parse(response.choices[0].message.content)
}
Step 3: Generate Images
Create platform-specific images:
async function generateImage(prompt: string) {
const image = await client.images.generate({
model: 'flux/schnell',
prompt: prompt + ' professional, high quality, social media ready',
size: '1024x1024',
})
return image.data[0].url
}
Step 4: Post to Platforms
Publish content to all platforms:
import { TwitterApi } from 'twitter-api-v2'
async function publishAll(content: any, imageUrl: string) {
// Twitter thread
const twitter = new TwitterApi(process.env.TWITTER_TOKEN)
for (const tweet of content.twitter.thread) {
await twitter.v2.tweet(tweet)
}
// LinkedIn post
await linkedin.createPost({
text: content.linkedin.post,
imageUrl,
})
// Instagram (via Facebook Graph API)
await instagram.publish({
caption: content.instagram.caption,
imageUrl,
})
console.log('β
Published to all platforms!')
}
Step 5: Run Automation
Execute the full pipeline:
async function main() {
const topic = "The future of AI in healthcare"
console.log('π Generating content...')
const content = await generateContent(topic)
console.log('π¨ Creating image...')
const imageUrl = await generateImage(topic)
console.log('π Publishing...')
await publishAll(content, imageUrl)
}
main()