# Framer Integration

> Part of the [NextBlog documentation](https://nextblog.ai/docs.md). Live page: [https://nextblog.ai/docs/integration-framer](https://nextblog.ai/docs/integration-framer)

Publish to Framer CMS collections for beautiful, fast websites. This integration creates items in your Framer CMS automatically.

#### Prerequisites

Before you begin, make sure you have:

- A Framer account with CMS access
- A Framer site with a CMS collection set up for blog posts
- API access enabled for your site

### Step 1: Generate API Token in Framer

#### 1.1 Open Framer Project

1. Log into your Framer account
2. Open your project in Framer

#### 1.2 Navigate to CMS Settings

1. In your Framer project, go to the CMS section
2. Click on your collection or go to collection settings
3. Look for **"API"** or **"API Access"** settings

#### 1.3 Generate API Token

1. Click **"Generate API token"** or **"Create token"**
2. Enter a name: `NextBlog Integration`
3. Click **"Generate"** or **"Create"**
4. **Important:** Copy the API token immediately and save it securely. You won't be able to see it again!

### Step 2: Get Your Collection ID

#### 2.1 Open CMS Collections

1. In your Framer project, navigate to the CMS section
2. Select your blog collection (or create a new one if needed)

#### 2.2 Get Collection ID

The Collection ID can be found in several ways:

- In the collection settings, look for the Collection ID field
- In the Framer API documentation for your site
- In the URL when viewing the collection in Framer

**Note:** The Collection ID is a long string of characters. Copy it carefully.

### Step 3: Set Up CMS Collection Fields

#### Required CMS Fields

Your Framer CMS collection should have these fields (create them if they don't exist):

- `title` - Text field (required, for post title)
- `slug` - Text field (for URL slug)
- `content` - Rich text field (for post content)
- `excerpt` - Text field (for excerpt/description)
- `image` - Image field (for featured image, optional)
- `imageAlt` - Text field (for image alt text, optional)

**Note:** Field names may vary. Adjust them in NextBlog settings if your collection uses different field names.

### Step 4: Configure Framer Integration in NextBlog

#### 4.1 Navigate to Project Settings

1. Log into your NextBlog dashboard
2. Click on your project to open it
3. Click on **"Settings"**

#### 4.2 Enable Framer Integration

1. Scroll down to the **"Framer Integration"** section
2. Toggle the **"Enable Framer Integration"** switch to ON

#### 4.3 Enter Framer Credentials

Fill in the following fields:

- **Framer API Token:** Paste the API token you copied in Step 1.3
- **Framer Collection ID:** Paste the Collection ID you found in Step 2.2

#### 4.4 Test Connection

1. Click the **"Test Connection"** button
2. Wait for the test to complete
3. If successful, you'll see a green success message
4. If it fails, check your credentials and try again

#### 4.5 Save Changes

Click the **"Save Changes"** button to save your Framer integration settings.

### How It Works

Once configured, here's what happens when you approve a blog post:

1. **Post Approval:** When you approve a blog post in NextBlog, the Framer integration is triggered
2. **Content Conversion:** The markdown content is converted to HTML format
3. **Item Creation:** A new CMS item is created in your Framer collection with:
  - Title in the `title` field
  - Slug in the `slug` field
  - HTML content in the `content` field
  - Description in the `excerpt` field
  - Featured image in the `image` field (if provided)
  - Image alt text in the `imageAlt` field (if provided)
4. **Publishing:** The item is created in your Framer CMS and can be published through your Framer site

### Troubleshooting

#### Connection Test Fails

**Common issues:**

- **Invalid API token:** Make sure you copied the entire token correctly
- **Wrong Collection ID:** Verify the Collection ID is correct
- **Missing permissions:** Make sure your API token has access to the site and collection

#### Posts Not Publishing

**Check the following:**

- Make sure the integration is enabled in project settings
- Verify the connection test passes
- Check that you're approving posts (not just generating them)
- Verify your CMS collection has the required fields
- Look for error messages in your NextBlog dashboard

### Next Steps

Now that your Framer integration is set up:

- Generate or create a blog post in NextBlog
- Review and approve the post
- Check your Framer CMS - a new item should appear automatically!
- Publish the item through your Framer site
