Unify Ads/RRSS approval flow and add personalized Meta creative regen.
Agency validates first then client; Meta copy is 5+5+1 with on-image vs feed layers, emojis on feed, and partial v2 by image/hook/support/copy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { authenticateIntegrationRequest } from '@/lib/integrations-auth';
|
||||
import { dispatchN8nWebhookAsync } from '@/lib/creatives-webhooks';
|
||||
import { normalizeMetaAdCopyInput } from '@/lib/meta-ad-copy';
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
@@ -50,7 +51,18 @@ export async function POST(req: NextRequest) {
|
||||
}
|
||||
|
||||
const toInsert = items.map((c: any) => {
|
||||
const meta = { ...(c.meta || {}) };
|
||||
const copyNorm = normalizeMetaAdCopyInput({
|
||||
primary_text: c.primary_text,
|
||||
primary_texts: c.primary_texts,
|
||||
headline: c.headline,
|
||||
headlines: c.headlines,
|
||||
description: c.description,
|
||||
hook: c.hook,
|
||||
support: c.support,
|
||||
cta: c.cta,
|
||||
meta: c.meta || {},
|
||||
});
|
||||
const meta = { ...copyNorm.meta };
|
||||
if (c.composition_notes) {
|
||||
meta.composition_notes = c.composition_notes;
|
||||
}
|
||||
@@ -64,9 +76,10 @@ export async function POST(req: NextRequest) {
|
||||
meta_ad_id: c.meta_ad_id || null,
|
||||
format: c.format || 'estatico',
|
||||
angle: c.angle || null,
|
||||
hook: c.hook || null,
|
||||
primary_text: c.primary_text || null,
|
||||
headline: c.headline || null,
|
||||
hook: copyNorm.hook || c.hook || null,
|
||||
primary_text: copyNorm.primary_text,
|
||||
headline: copyNorm.headline,
|
||||
description: copyNorm.description,
|
||||
cta: c.cta || null,
|
||||
asset_url: c.asset_url || null,
|
||||
thumbnail_url: c.thumbnail_url || null,
|
||||
|
||||
Reference in New Issue
Block a user