> ## Documentation Index
> Fetch the complete documentation index at: https://developer.whilter.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Schedule Media Generation

> Learn how to generate and deliver large-scale personalized media using Whilter.AI's schedule-based batch workflow.

# Overview

Whilter.AI’s **Schedule-Based Media** Integration allows clients to generate and deliver large-scale personalized images and videos via a structured, scheduled batch workflow, ensuring efficient and reliable media generation.

***

## High-Level Integration Flow

```mermaid theme={"system"}

sequenceDiagram
    participant Client as Client System
    participant SFTP as Client SFTP Server
    participant Storage as Client S3 Bucket
    participant Media as Whilter Media Pipeline

    %% Step 1: Prepare Campaign Data
    Client->>Client: (1) Prepare campaign CSV<br/>with personalization fields for Media (Image/Video)
    Client->>Client: (1) Zip campaign file

    %% Step 2: Upload to SFTP
    Client->>SFTP: (2) Upload zipped campaign CSV<br/>to sftp/in

    Note over SFTP,Media: (3) Scheduled pickup (time-based)

    %% Step 3: Scheduled Processing & Output Delivery
    Media->>SFTP: (3) Check for new campaign files
    SFTP-->>Media: (3) Campaign file available
    Media->>SFTP: (3) Download zipped CSV
    SFTP-->>Media: (3) Deliver file
    Media->>Media: (3) Unzip, validate CSV<br/>Generate media per row
    Media->>Storage: (3) Store generated media
    Storage-->>Media: (3) Return media URLs
    Media->>Media: (3) Write media URLs<br/>into Output CSV
    Media->>SFTP: (3) Upload output CSV<br/>to sftp/out

    %% Step 4: Completion Notification (Optional)
    Media-->>Client: (4) Task completion callback<br/>(optional)

```

The batch execution flow consists of the following 5 simple steps:

### Step 1: Prepare Your Campaign Data

Prepare a CSV file containing:

* A **unique identifier** (e.g., customer ID or phone number)
* Required **personalization fields** for media generation

Once the CSV is ready, compress it into a ZIP file using the following naming format:
`WHILTERTEMPLATEID_CLIENTNAME_CAMPAIGNNAME_TIMESTAMP.zip`

***

### Step 2: Upload File to SFTP

Upload the ZIP file to the designated **input location** (e.g., `sftp/in`) shared during onboarding.

You only need to upload the file once — **no API trigger is required**.

***

### Step 3: Scheduled Processing & Output Delivery

* At the configured schedule, the system automatically checks for new files.
* If a new file is detected:
  * The file is downloaded from the input location.
  * Data is unzipped and validated.
  * Media is generated for each row in the CSV.
  * Generated media files are stored securely in **Client S3 bucket**.
  * An output CSV is created containing:
    * Original identifiers
    * Generated media URLs
  * The output CSV is uploaded to the defined output location (e.g., `sftp/out`).

***

### Step 4: Completion Notification (Optional)

* The client can provide a callback API.
* Once processing is completed:
  * Our system sends a completion status to the callback API.
  * The client must whitelist our IPs for callback access.

***

## Callback Support

Instead of polling the status API, you can provide a **callback URL**, and Whilter.AI will notify your system automatically when the task is completed.

***

## Security

All APIs are secured using **Bearer Token Authentication**. Ensure your access token is kept confidential.

***

For integration assistance, [Contact us](mailto:support@whilter.ai).
