Skip to content
Notifications
Clear all

Guide: Setting up a simple approval chain for Kling-generated marketing copy.

1 Posts
1 Users
0 Reactions
2 Views
(@data_pipeline_guy)
Estimable Member
Joined: 4 months ago
Posts: 107
Topic starter   [#10872]

Everyone's rushing to generate a thousand variations of "synergistic, cutting-edge content" with Kling. Then they're shocked when the legal team has a stroke. You still need a human to say "yes" before anything goes live.

Here's a simple pipeline. It uses a couple of tables and a dbt model to track state. No fancy "AI workflow" platforms required.

First, a staging table to land the raw Kling output and its metadata.

```sql
CREATE TABLE kling_copy_staging (
copy_id UUID PRIMARY KEY,
generated_copy TEXT NOT NULL,
prompt_used TEXT,
generated_at TIMESTAMP_NTZ,
campaign_name VARCHAR(255),
status VARCHAR(50) DEFAULT 'generated'
);
```

Then an approval table to log the chain.

```sql
CREATE TABLE copy_approval_log (
approval_id UUID PRIMARY KEY,
copy_id UUID REFERENCES kling_copy_staging,
approver_role VARCHAR(100), -- e.g., 'marketing_lead', 'legal'
approver_email VARCHAR(255),
approval_status VARCHAR(50), -- 'approved', 'rejected', 'changes_requested'
approval_comment TEXT,
approval_ts TIMESTAMP_NTZ,
sort_order INTEGER -- determines approval sequence
);
```

The core logic is a view to see what's pending for whom. This is the single source of truth.

```sql
-- approval_pending_current.sql
WITH approval_sequence AS (
SELECT
ks.copy_id,
ks.campaign_name,
ks.generated_copy,
cal.approver_role,
cal.approval_status,
cal.sort_order,
LAG(cal.approval_status) OVER (PARTITION BY ks.copy_id ORDER BY cal.sort_order) AS prev_approval_status
FROM kling_copy_staging ks
LEFT JOIN copy_approval_log cal ON ks.copy_id = cal.copy_id
WHERE ks.status != 'final_approved'
)
SELECT *
FROM approval_sequence
WHERE prev_approval_status = 'approved' OR prev_approval_status IS NULL
AND approval_status IS NULL;
```

Marketing queries this view. When they approve, an `INSERT` into the log table increments `sort_order`. Legal gets the next one. When the final approver in the sequence OKs it, a trigger or simple Airflow task updates the staging `status` to `final_approved`. Now you can feed it to your CMS.

It's just a state machine. You don't need a SaaS for this.


SQL is enough


   
Quote