How to Build an AI Content Repurposer Tool
Content creation is one of the most time-consuming marketing activities. A single blog post can take hours to research, write, and edit. But what if you could transform that one piece of content into tweets, LinkedIn posts, email newsletters, and video scripts — automatically?
That is exactly what an AI content repurposer does. In this guide, we will build one using Next.js and OpenAI.
The Core Idea
The repurposer takes a piece of content (blog post, article, or notes) and generates multiple output formats tailored to different platforms. Each format has its own style constraints:
- - Tweets: 280 characters, hook-driven, hashtags
- - LinkedIn: Professional tone, longer form, engagement question
- - Email: Subject line, preview text, body with CTA
- - Video Script: Hook, main points, call to action
Building the API Route
import { NextRequest, NextResponse } from 'next/server'
import OpenAI from 'openai'
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY })
const FORMAT_PROMPTS = {
tweet: 'Rewrite this content as an engaging tweet under 280 characters with relevant hashtags:',
linkedin: 'Rewrite this as a professional LinkedIn post with a hook, value, and engagement question:',
email: 'Create an email newsletter from this content with subject line, preview, body, and CTA:',
script: 'Create a video script from this content with hook, key points, and call to action:',
}
export async function POST(req: NextRequest) {
const { content, format } = await req.json()
const prompt = `${FORMAT_PROMPTS[format as keyof typeof FORMAT_PROMPTS]}
${content}`
const completion = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [
{ role: 'system', content: 'You are a content repurposing expert. Transform content into the requested format while preserving key information and adapting the tone appropriately.' },
{ role: 'user', content: prompt },
],
})
return NextResponse.json({ result: completion.choices[0].message.content })
}Building the UI
'use client'
import { useState } from 'react'
export function ContentRepurposer() {
const [content, setContent] = useState('')
const [results, setResults] = useState<Record<string, string>>({})
const [loading, setLoading] = useState<string | null>(null)
async function generateFormat(format: string) {
setLoading(format)
const res = await fetch('/api/repurpose', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ content, format }),
})
const data = await res.json()
setResults(prev => ({ ...prev, [format]: data.result }))
setLoading(null)
}
return (
<div className="space-y-6">
<textarea
value={content}
onChange={e => setContent(e.target.value)}
placeholder="Paste your blog post or content here..."
className="w-full h-40 rounded-xl bg-gray-900 p-4 text-sm text-white border border-gray-700"
/>
<div className="flex gap-2">
{['tweet', 'linkedin', 'email', 'script'].map(f => (
<button
key={f}
onClick={() => generateFormat(f)}
disabled={loading !== null || !content}
className="rounded-lg bg-brand-600 px-4 py-2 text-sm text-white disabled:opacity-50"
>
{loading === f ? 'Generating...' : `Generate ${f}`}
</button>
))}
</div>
<div className="grid grid-cols-2 gap-4">
{Object.entries(results).map(([format, result]) => (
<div key={format} className="rounded-xl bg-gray-900 p-4">
<h3 className="text-sm font-semibold text-white capitalize mb-2">{format}</h3>
<p className="text-sm text-gray-300">{result}</p>
</div>
))}
</div>
</div>
)
}Cross-Selling: Get the Complete Repurposer Template
Our AI Content Repurposer template takes this concept and runs with it — supporting brand voice customization, batch processing, content calendar integration, and history tracking. It is production-ready and fully customizable.
Combine with AI Lead Enrichment to personalize outreach content, or Email Campaign Manager to distribute your repurposed content to subscribers automatically.
Related Template
Try this production-ready starter kit to build your project faster.
AI Content Repurposer
One piece of content, every format
Ready to Build?
Get started with our production-ready starter kits and ship your project faster.
Browse Starter Kits