# Content Publisher Template

## Overview

This template provides a minimal starting point for building a content publisher app. It demonstrates the basic structure and key concepts of the Content Publisher intent, including:

- Implementing the Content Publisher intent with all required functions
- Rendering a settings UI where users configure publishing options
- Rendering a preview UI that shows how content will appear after publishing
- Defining output types and media slot specifications
- Handling publish operations (with placeholder implementation)

This template focuses on the intent structure and UI patterns. You'll need to add your own platform integration, including authentication and API calls to your publishing service.

## What's Included

### Content Publisher Intent Structure

The template implements all four required functions:

- `renderSettingsUi`: Renders a simple settings form with a caption input field
- `renderPreviewUi`: Displays a mock social media post preview
- `getPublishConfiguration`: Defines a "Feed Post" output type with image specifications
- `publishContent`: Placeholder function that returns mock success response

### UI Components

- **Settings UI** (`settings_ui.tsx`): A form using the App UI Kit with a caption field and validation
- **Preview UI** (`preview_ui.tsx`): A social media post preview showing how the published content will look

### App UI Kit

The App UI Kit is a React-based component library designed for creating apps that emulate Canva's look and feel. We strongly recommend using the App UI Kit if you're planning to release an app to the public, as this makes it easier to comply with our [design guidelines](https://www.canva.dev/docs/apps/design-guidelines/).

This template uses the App UI Kit for both the settings and preview UIs to demonstrate common patterns. The preview UI is more flexible in production and can be customized to match your target platform's design system.

## Getting Started

### 0. Set up your app

- If not already handled by the Canva CLI, you need to create an app via the [Developer Portal](https://www.canva.com/developers/apps).
- On the **Intents** page, enable the `Content Publisher` intent

### 1. Run the template

- Run `npm start` to start the development server
- Click **Preview URL** in the terminal or **Preview** in the [Developer Portal](https://www.canva.com/developers/apps) to view the app in the Canva editor
- Try entering a caption and viewing the preview

### 2. Customize for your platform

To integrate with your publishing platform, you'll need to:

- **Add authentication**: [Implement OAuth](https://www.canva.dev/docs/apps/authenticating-users/oauth/) or your authentication method to connect user accounts
- **Customize settings**: Modify `settings_ui.tsx` to collect platform-specific publishing options
- **Update preview**: Modify `preview_ui.tsx` to match your platform's post appearance
- **Configure output types**: Update `getPublishConfiguration` in `index.tsx` to define your supported formats and media requirements
- **Implement publishing**: Replace the placeholder in `publishContent` with actual API calls to your platform
