Add n8n community node, /api/v1/render alias, and job webhooks for OSS automation.
Payment-free self-hosted builds keep full API access with optional webhookUrl callbacks and the published n8n-nodes-songs2vid package source under integrations/n8n.
This commit is contained in:
@@ -35,12 +35,15 @@ export async function POST(req: NextRequest) {
|
||||
const job = await createVideoJob(user, {
|
||||
imagePath: body.imagePath,
|
||||
items,
|
||||
webhookUrl: body.webhookUrl ?? null,
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
jobId: job.id,
|
||||
itemCount: job.items.length,
|
||||
status: job.status,
|
||||
statusUrl: `/api/v1/jobs/${job.id}`,
|
||||
webhookUrl: body.webhookUrl ?? null,
|
||||
playlist: playlist
|
||||
? { id: playlist.id, title: playlist.title, privacy: playlist.privacy }
|
||||
: null,
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Alias for n8n / automation: POST|GET /api/v1/render → same as /api/v1/jobs
|
||||
* OSS: no plan gate — Bearer API key + YouTube connected.
|
||||
*/
|
||||
export { POST, GET } from "../jobs/route";
|
||||
+14
-4
@@ -16,11 +16,14 @@ export async function GET() {
|
||||
billing: false,
|
||||
notes:
|
||||
"OSS self-hosted: full entitlements, no Stripe/credits/paywall. In-repo docs: docs/api/",
|
||||
webhooks:
|
||||
"Optional webhookUrl on job create — HTTPS POST JSON on item/job terminal states for n8n",
|
||||
guidance: {
|
||||
recommended:
|
||||
"For most jobs (especially 5+ audio files): POST /api/v1/upload per file, then POST /api/v1/jobs with the returned paths",
|
||||
"For most jobs (especially 5+ audio files): POST /api/v1/upload per file, then POST /api/v1/render (or /api/v1/jobs) with paths + optional webhookUrl",
|
||||
batch:
|
||||
"POST /api/v1/jobs/batch is for small packs only. Large multipart bodies may fail with 'failed to parse body as FormData'",
|
||||
polling: "GET /api/v1/jobs/:id until status is COMPLETED, FAILED, or PARTIAL",
|
||||
},
|
||||
layoutTemplates: LAYOUT_TEMPLATES.map((id) => ({
|
||||
id,
|
||||
@@ -43,12 +46,19 @@ export async function GET() {
|
||||
"Upload image, audio, PNG logo, or .ttf/.otf font (font ≤10MB)",
|
||||
body: "multipart/form-data: file, type (image|audio|logo|font)",
|
||||
},
|
||||
{
|
||||
method: "POST",
|
||||
path: "/api/v1/render",
|
||||
description:
|
||||
"Alias of /api/v1/jobs — create a render job (n8n-friendly). Optional webhookUrl for callbacks.",
|
||||
body: "application/json: { imagePath, webhookUrl?, items[{ audioPath, audioFilename, metadata }] }",
|
||||
},
|
||||
{
|
||||
method: "POST",
|
||||
path: "/api/v1/jobs",
|
||||
description:
|
||||
"Create a video job from uploaded file paths with layouts, watermark, and per-item covers",
|
||||
body: "application/json: { imagePath, items[{ audioPath, audioFilename, metadata }] }",
|
||||
body: "application/json: { imagePath, webhookUrl?, items[{ audioPath, audioFilename, metadata }] }",
|
||||
},
|
||||
{
|
||||
method: "POST",
|
||||
@@ -71,13 +81,13 @@ export async function GET() {
|
||||
{
|
||||
method: "GET",
|
||||
path: "/api/v1/jobs",
|
||||
description: "List recent jobs",
|
||||
description: "List recent jobs (also available as GET /api/v1/render)",
|
||||
query: "limit (default 20, max 100)",
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
path: "/api/v1/jobs/:id",
|
||||
description: "Get job status and item details",
|
||||
description: "Get job status and item details (poll for n8n)",
|
||||
},
|
||||
],
|
||||
docs: API_DOCS_URL,
|
||||
|
||||
Reference in New Issue
Block a user