# NextBlog Documentation

> NextBlog is a 100% automated AI agent that researches keywords, generates SEO & AEO-optimized content, and publishes blog posts daily across 14+ publishing platforms.

This file is the complete NextBlog documentation in Markdown. It mirrors [https://nextblog.ai/docs](https://nextblog.ai/docs) for AI agents, LLMs, and anyone who prefers plain text.

- Product overview and site map: [https://nextblog.ai/llms.txt](https://nextblog.ai/llms.txt)
- Per-section Markdown files: [https://nextblog.ai/docs/llms.txt](https://nextblog.ai/docs/llms.txt)

**Contents**

- [Introduction](/docs/introduction.md)
- [Quick Start Guide](/docs/quick-start.md)
- [Project Settings](/docs/settings.md)
- [Subdomain Blog Hosting](/docs/subdomain-hosting.md)
- [Customization & Best Practices](/docs/customization.md)
- [WordPress Integration](/docs/integration-wordpress.md)
- [Notion Integration](/docs/integration-notion.md)
- [Shopify Integration](/docs/integration-shopify.md)
- [Shopify Legacy Integration](/docs/integration-shopify-legacy.md)
- [Wix Integration](/docs/integration-wix.md)
- [Webflow Integration](/docs/integration-webflow.md)
- [Ghost Integration](/docs/integration-ghost.md)
- [Framer Integration](/docs/integration-framer.md)
- [DEV.to Integration](/docs/integration-devto.md)
- [Blogger Integration](/docs/integration-blogger.md)
- [YouTube Integration](/docs/integration-youtube.md)
- [Hashnode Integration](/docs/integration-hashnode.md)
- [REST API Integration](/docs/integration-rest-api.md)
- [Webhooks Integration](/docs/integration-webhooks.md)
- [Next.js App Router Examples](/docs/nextjs-examples.md)
- [React Examples](/docs/react-examples.md)
- [JavaScript Examples](/docs/javascript-examples.md)
- [API Authentication](/docs/authentication.md)
- [Blog Display API](/docs/endpoints.md)
- [Post Management API](/docs/api-manage-posts.md)
- [Webhooks](/docs/webhooks.md)
- [Frequently Asked Questions](/docs/faq.md)

## Introduction

### Welcome to NextBlog

NextBlog is a powerful platform that automatically generates SEO-optimized blog content and integrates seamlessly with Notion. Whether you're a content creator, marketer, or business owner, NextBlog helps you create high-quality, search-engine-friendly content with minimal effort.

### Key Features

- **AI-Powered Content Generation:** Create engaging blog posts using advanced AI
- **AI Website Description Generator:** Simply paste your website URL and let AI generate a comprehensive project description
- **SEO Optimization:** Automatically optimize content for search engines with internal linking
- **Internal Linking Automation:** Automatically adds relevant internal links to boost SEO and user engagement
- **Backlink Network:** Optionally get and give contextual backlinks with other real sites in the network to grow domain authority (free, on by default, opt out anytime)
- **Approve/Decline Workflow:** Review and approve content before publishing with our built-in approval system
- **Blog → YouTube:** Automatically turn blog posts into YouTube videos and publish them to your channel
- **11+ Platform Integrations:** Automatically publish to WordPress, Notion, DEV.to, Blogger, Shopify, Wix, Webflow, Ghost, Framer, REST API, and Webhooks
- **Multi-Platform Publishing:** Write once, publish everywhere—automatically sync your content across all your platforms
- **Subdomain Blog Hosting:** Automatically host your blog on a custom subdomain (e.g., orange.nextblog.ai) with no additional setup required

## Quick Start Guide

Get up and running with NextBlog in just a few minutes. Follow these simple steps to create your first AI-generated blog post.

#### Step 1: Sign Up

Create your account by visiting our [login page](https://nextblog.ai/login). You can sign up with your email or use your Google account.

#### Step 2: Create a Project

Once logged in, create your first project. Give it a name and website URL.

**Pro Tip:** Use our AI Website Description Generator! Simply paste your website URL and click "Generate from URL (AI)" to automatically create a comprehensive project description. You can always edit it afterward.

#### Step 3: Configure Settings

Set up your content preferences, automation settings, and CMS integrations in the project dashboard.

**Available Integrations:**

- **WordPress** - Auto-publish to WordPress when posts are approved
- **Notion** - Sync content with Notion databases
- **Shopify** - Publish blog posts to your Shopify store
- **Wix** - Publish to Wix blog with rich formatting
- **Webflow** - Push content to Webflow CMS collections
- **Ghost** - Native markdown publishing to Ghost CMS
- **Framer** - Publish to Framer CMS collections
- **DEV.to** - Cross-post approved posts to DEV.to
- **Blogger** - Publish to Google Blogger via OAuth
- **REST API** - Fetch blog posts programmatically
- **Webhooks** - Receive real-time notifications for custom integrations

**Pro Tip:** Check out our detailed [Integration Guides](/docs/integrations.md) for step-by-step setup instructions for each platform.

#### Step 4: Generate & Review Content

Use our AI-powered generator to create your first blog post. Generated posts will automatically include:

- SEO-optimized content with proper keyword usage
- Automatic internal links to related posts
- Featured images from Unsplash
- Meta descriptions for search engines

**Review & Approve:** All auto-generated posts start as drafts. Review them in your dashboard and approve or decline before publishing.

## Project Settings

Configure your project settings to customize how NextBlog generates and manages your content. These settings can be accessed by navigating to your project dashboard and clicking on a specific project.

### Basic Settings

#### Project Name

**Description:** The name of your project that will be displayed in the dashboard.

**Type:** Text input (max 50 characters)

**Required:** Yes

**Example:** "My Tech Blog", "Company Website", "Personal Portfolio"

#### Website URL

**Description:** The main URL of your website or blog where the generated content will be published.

**Type:** URL input (max 50 characters)

**Required:** Yes

**Validation:** Must be a valid URL format

**Example:** "https://example.com", "https://myblog.com"

#### Project Description

**Description:** A detailed description of your project that helps the AI understand your business, target audience, and content goals. This information is crucial for generating relevant and high-quality blog posts.

**Type:** Multi-line text area (max 6000 characters)

**Required:** Yes

**AI Generation:** Click the "Generate from URL (AI)" button to automatically generate a comprehensive description from your website. The AI will analyze your website content and create a detailed description that you can edit afterward.

**Recommended Content:**

- Target audience and demographics
- Problems your product/service solves
- Key features and benefits
- Pricing information
- Industry and niche
- Brand voice and tone preferences
- Competitors and market positioning

**Tip:** Use the AI generator for a quick start, or manually paste your existing website copy or marketing materials.

### Automation Settings

#### Auto-generate

**Description:** When enabled, NextBlog will automatically generate new blog posts based on your project settings and content schedule.

**Type:** Toggle switch

**Default:** Off

**How it works:**

- AI analyzes your project description and website content
- Generates relevant topics based on your industry and audience
- Creates SEO-optimized blog posts automatically
- Automatically adds internal links to existing posts
- Follows your specified content schedule (daily at 12:00 AM UTC)

**Content Status:** When auto-generate is enabled but auto-publish is disabled, generated posts are created as "draft" status for your review.

**Best for:** Users who want hands-off content generation with quality control.

#### Auto-publish

**Description:** When enabled, generated blog posts will be automatically published (status: "approved") without requiring manual review.

**Type:** Toggle switch

**Default:** Off

**Requirements:** Auto-generate must be enabled for this setting to take effect.

**How it works:**

- Generated content is automatically published (status: "approved")
- SEO meta tags and descriptions are automatically added
- Content is optimized for search engines with internal linking
- If integrations are configured, posts are automatically published to all enabled platforms (WordPress, Notion, Shopify, Wix, Webflow, Ghost, Framer)
- Webhooks are triggered if configured

**Best for:** Users who trust the AI-generated content and want a completely automated workflow.

**Note:** We recommend keeping this disabled initially to review content before publishing.

### CMS Integrations

NextBlog supports multiple platform integrations to automatically publish your content. Configure integrations in your project settings, and approved posts will be automatically published to your connected platforms.

**Available Integrations:**

- [WordPress](/docs/integration-wordpress.md) - Auto-publish to WordPress sites
- [Notion](/docs/integration-notion.md) - Sync to Notion databases
- [DEV.to](/docs/integration-devto.md) - Cross-post to DEV.to
- [Shopify](/docs/integration-shopify.md) - Publish to Shopify blogs
- [Wix](/docs/integration-wix.md) - Publish to Wix blogs
- [Webflow](/docs/integration-webflow.md) - Push to Webflow CMS
- [Ghost](/docs/integration-ghost.md) - Native markdown publishing to Ghost
- [Framer](/docs/integration-framer.md) - Publish to Framer CMS
- [Blogger](/docs/integration-blogger.md) - Publish to Google Blogger
- [YouTube](/docs/integration-youtube.md) - Auto-generate & publish videos from blog posts (paid plans)
- [Hashnode](/docs/integration-hashnode.md) - Publish to Hashnode
- [REST API](/docs/integration-rest-api.md) - Fetch posts programmatically
- [Webhooks](/docs/integration-webhooks.md) - Real-time notifications

**Note:** Each integration has detailed setup instructions. Click on any integration above to see step-by-step guides for getting API credentials and configuring the integration.

**Multiple Integrations:** You can enable multiple integrations simultaneously. When you approve a post, it will be published to all enabled integrations automatically.

### Backlink Network

**Description:** An optional, free network where projects get and give contextual backlinks to each other's websites. When enabled, each generated post can include one relevant external link to another real site in the network, and your Website URL can be promoted the same way in other members' posts.

**Type:** Toggle switch (per project)

**Default:** On

**How it works:**

- Your generated posts may include one contextual link to a topically relevant site in the network (scored per article, so mentions stay natural)
- Your Website URL is promoted automatically inside other members' generated posts
- Links are only placed between real sites whose owners have an active subscription (free trials included)
- Links received and given are tracked in your project settings
- No outreach or buying links required

**Turn it off** anytime in your project settings if you prefer not to participate. Existing backlinks in already-published posts remain, but no new ones are placed or received.

### Saving Your Settings

After making changes to your project settings:

1. Click the "Save Changes" button at the bottom of the form
2. Wait for the confirmation message that your settings have been updated
3. Your changes will be applied immediately to future content generation

### Validation Rules

The following validation rules apply when saving your project settings:

- **Project Name:** Cannot be empty and must be 50 characters or less
- **Website URL:** Must be a valid URL format (e.g., https://example.com)
- **Project Description:** Cannot be empty and must be 5000 characters or less

### Best Practices

#### Writing Effective Project Descriptions

**Be Specific:** Include detailed information about your business, products, and target audience.

**Include Keywords:** Mention important keywords and topics you want to rank for.

**Define Your Voice:** Describe your brand's tone and style preferences.

**Mention Competitors:** Include information about your competitors and market positioning.

#### Automation Strategy

**Start Manual:** Begin with auto-generate disabled to review and understand the AI's output.

**Gradual Automation:** Enable auto-generate once you're satisfied with the content quality.

**Review Before Publishing:** Keep auto-publish disabled initially to maintain quality control.

**Monitor Performance:** Regularly check your content's performance and adjust settings accordingly.

## Subdomain Blog Hosting

NextBlog allows you to automatically host your blog on a custom subdomain of nextblog.ai. This feature enables you to have a dedicated blog URL without setting up your own domain or hosting infrastructure.

### Overview

When enabled, your blog will be accessible at a URL like `orange.nextblog.ai` (where "orange" is your project's subdomain). Your blog posts will be automatically published to this subdomain when they are approved.

### How to Enable Subdomain Hosting

#### Step 1: Navigate to Project Settings

1. Go to your project dashboard
2. Click on the project you want to configure
3. Scroll down to the "Subdomain Publishing" section

#### Step 2: Enable Subdomain Publishing

1. Toggle the "Enable Subdomain Publishing" switch to ON
2. Enter your desired subdomain in the input field (e.g., "orange" for orange.nextblog.ai)
3. The subdomain will be automatically validated

**Note:** If you don't specify a subdomain, NextBlog will automatically suggest one based on your project name (e.g., "My Tech Blog" becomes "my-tech-blog").

#### Step 3: Save Your Settings

1. Click the "Save Changes" button at the bottom of the form
2. Wait for the confirmation message
3. Your blog will be available at `https://your-subdomain.nextblog.ai` once enabled

### Subdomain Requirements

Your subdomain must meet the following requirements:

- Must be 3-63 characters long
- Can only contain lowercase letters, numbers, and hyphens
- Cannot start or end with a hyphen
- Must be unique across all NextBlog projects

### How It Works

Once subdomain hosting is enabled:

- Your blog posts will be automatically published to your custom subdomain when approved
- The subdomain is automatically validated and must be unique across all projects
- Your blog will be accessible at `https://your-subdomain.nextblog.ai`
- All your published blog posts will be available on the subdomain

### Best Practices

#### Choosing a Subdomain

**Keep it simple:** Use a short, memorable subdomain that reflects your brand or project name.

**Use hyphens:** If your project name has spaces, hyphens will be automatically added (e.g., "My Tech Blog" becomes "my-tech-blog").

**Make it brandable:** Choose a subdomain that you can use in marketing materials and social media.

#### Availability

**All Plans:** Subdomain hosting is available on all NextBlog plans (Starter, Growth, and Pro).

**No Additional Setup:** Once enabled, your blog is automatically available—no DNS configuration or hosting setup required.

### Troubleshooting

If you encounter issues with subdomain hosting:

- **Subdomain already taken:** Try a different subdomain name or add numbers/descriptors to make it unique
- **Invalid format:** Ensure your subdomain only contains lowercase letters, numbers, and hyphens
- **Not accessible:** Wait a few minutes after enabling—subdomain changes may take a moment to propagate

## Customization & Best Practices

Customize your NextBlog experience to match your brand and content strategy. Learn how to tailor the AI-generated content to your specific needs and follow best practices for optimal results.

### Content Style Customization

NextBlog allows you to customize various aspects of your generated content to ensure it matches your brand voice and style.

#### Brand Voice and Tone

Your project description plays a crucial role in determining the tone and style of generated content. Include information about:

- Your brand's personality (professional, casual, friendly, authoritative)
- Target audience communication style
- Industry-specific terminology and jargon
- Content length preferences
- Call-to-action style preferences

#### Content Structure

The AI automatically structures content with proper headings, subheadings, and formatting. You can influence this by mentioning in your project description:

- Preferred heading styles and hierarchy
- Use of bullet points and numbered lists
- Image and media placement preferences
- Conclusion and call-to-action placement

### SEO Customization

NextBlog automatically optimizes content for search engines, but you can customize the approach:

#### Keyword Strategy

Include your target keywords and topics in your project description to guide the AI's content generation:

- Primary keywords for your industry
- Long-tail keyword variations
- Competitor keywords to target
- Seasonal or trending topics

#### Meta Information

The AI automatically generates SEO-friendly meta descriptions and titles based on your content. These are optimized for:

- Search engine visibility
- Click-through rates
- Social media sharing
- Brand consistency

### Content Types and Formats

NextBlog can generate various types of content based on your project settings and description:

#### Blog Posts

**Description:** Standard blog articles optimized for your website.

**Best for:** Regular content marketing, SEO, and audience engagement.

#### How-to Guides

**Description:** Step-by-step instructional content.

**Best for:** Product tutorials, educational content, and lead generation.

#### Industry Insights

**Description:** Thought leadership and industry analysis content.

**Best for:** Establishing authority, B2B marketing, and professional networking.

### Integration Customization

Customize how NextBlog integrates with your existing workflow and platforms:

#### Notion Integration

Configure how your content is synced with Notion:

- Choose the target Notion database
- Set up custom property mappings
- Configure automatic publishing workflows
- Set up content approval processes

#### WordPress Integration

Automatically publish approved blog posts to your WordPress site:

- Connect your WordPress site with Application Password
- Automatic markdown to HTML conversion
- Featured image upload to WordPress media library
- Automatic publishing when posts are approved

#### Webhooks

Receive real-time notifications for custom integrations:

- Configure webhook URL in project settings
- Receive POST requests when posts are approved
- Build custom workflows and integrations
- Sync with external systems and services

#### API Integration

Use the NextBlog API to integrate content into your custom applications:

- Fetch blog posts for custom websites
- Integrate with content management systems
- Build custom publishing workflows
- Create automated content distribution

### Performance Optimization

Optimize your NextBlog setup for better performance and results:

#### Content Quality

Improve content quality by:

- Providing detailed project descriptions
- Including specific examples and case studies
- Mentioning your unique value propositions
- Specifying content goals and objectives

#### Automation Settings

Fine-tune automation settings for optimal results:

- Start with manual generation to understand output quality
- Gradually enable automation as you refine your settings
- Monitor content performance and adjust settings accordingly
- Use auto-publish only after establishing quality standards

### Advanced Customization

For advanced users, NextBlog offers additional customization options:

#### Content Templates

Create custom content templates to ensure consistency across all generated content:

- Define standard content structures
- Set up brand-specific formatting
- Include standard sections and elements
- Configure automatic content categorization

#### Workflow Automation

Set up automated workflows for content management:

- Automatic content scheduling
- Multi-platform publishing
- Content approval processes
- Performance tracking and reporting

## WordPress Integration

Automatically publish approved blog posts directly to your WordPress site. This integration converts markdown to HTML, uploads featured images, and publishes posts with proper formatting.

#### Prerequisites

Before you begin, make sure you have:

- A WordPress site with admin access
- WordPress version 5.6 or higher (for Application Passwords support)
- Your WordPress site URL

### Step 1: Create Application Password in WordPress

WordPress Application Passwords are more secure than using your regular password. Follow these steps:

#### 1.1 Log into WordPress Admin

Log into your WordPress admin dashboard at `https://yoursite.com/wp-admin`

#### 1.2 Navigate to Profile

In the left sidebar, click on **"Users"** → **"Profile"**

#### 1.3 Find Application Passwords Section

Scroll down to the **"Application Passwords"** section (usually near the bottom of the page)

#### 1.4 Create New Application Password

1. In the "New Application Password Name" field, enter: `NextBlog Integration`
2. Click the **"Add New Application Password"** button
3. A new password will be generated and displayed **only once**
4. **Important:** Copy this password immediately and save it securely. You won't be able to see it again!

### Step 2: Configure WordPress Integration in NextBlog

#### 2.1 Navigate to Project Settings

1. Log into your NextBlog dashboard
2. Click on your project to open it
3. Click on **"Settings"** or navigate to the project settings page

#### 2.2 Enable WordPress Integration

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

#### 2.3 Enter WordPress Credentials

Fill in the following fields:

- **WordPress Site URL:** Enter your WordPress site URL (e.g., `https://yoursite.com` or `https://yoursite.wordpress.com`)
- **WordPress Username:** Enter your WordPress username (the one you use to log in)
- **WordPress Application Password:** Paste the Application Password you created in Step 1

**Note:** Do NOT use your regular WordPress password. Always use an Application Password for security.

#### 2.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

#### 2.5 Save Changes

Click the **"Save Changes"** button at the bottom of the form to save your WordPress 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 WordPress integration is automatically triggered
2. **Content Conversion:** The markdown content is automatically converted to HTML format
3. **Image Upload:** Featured images are automatically uploaded to your WordPress media library
4. **Post Creation:** A new WordPress post is created with:
  - Title from your NextBlog post
  - HTML content (converted from markdown)
  - Featured image
  - Excerpt/description
  - SEO-friendly slug
5. **Publishing:** The post is published to your WordPress site and is immediately live
6. **Tracking:** The WordPress post ID and URL are saved in NextBlog for future reference

### Troubleshooting

#### Connection Test Fails

**Possible causes:**

- Incorrect WordPress site URL - Make sure it includes `https://` and doesn't have a trailing slash
- Wrong username - Use the exact username you use to log into WordPress
- Invalid Application Password - Make sure you copied the entire password correctly
- WordPress version too old - Application Passwords require WordPress 5.6+
- Site is down or unreachable - Check if your WordPress site is accessible

#### 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)
- Look for error messages in your NextBlog dashboard
- Check WordPress admin for any failed post attempts

#### Images Not Uploading

**Common issues:**

- WordPress media library permissions - Make sure your user has permission to upload media
- Image URL accessibility - The image URL must be publicly accessible
- File size limits - Check WordPress upload size limits

### Next Steps

Now that your WordPress integration is set up:

- Generate or create a blog post in NextBlog
- Review and approve the post
- Check your WordPress site - the post should appear automatically!
- Consider setting up [Webhooks](/docs/integration-webhooks.md) for additional automation

## Notion Integration

Seamlessly sync your blog posts with Notion databases for collaboration and content management. This integration converts markdown to Notion blocks and creates new pages in your database automatically.

#### Prerequisites

Before you begin, make sure you have:

- A Notion account with workspace access
- Permission to create integrations in your workspace
- A Notion database (or create a new one) to sync posts to

### Step 1: Create Notion Integration

#### 1.1 Visit Notion Integrations Page

Go to [https://www.notion.so/my-integrations](https://www.notion.so/my-integrations)

#### 1.2 Create New Integration

1. Click the **"+ New integration"** button
2. You'll be prompted to name your integration

#### 1.3 Configure Integration

Fill in the integration details:

- **Name:** Enter `NextBlog Integration` (or any name you prefer)
- **Associated workspace:** Select the workspace where your database is located
- **Type:** Select `Internal`
- **Capabilities:** Make sure `Read content` and `Insert content` are enabled

#### 1.4 Copy Integration Token

1. After creating the integration, you'll see the **"Internal Integration Token"**
2. **Important:** Copy this token immediately and save it securely. It starts with `secret_`
3. You can view this token again later, but it's best to copy it now

### Step 2: Create or Select Notion Database

#### 2.1 Create New Database (Optional)

If you don't have a database yet:

1. Open Notion and navigate to the page where you want the database
2. Type `/database` and select "Table - Inline" or "Table - Full page"
3. Name your database (e.g., "Blog Posts")

#### 2.2 Set Up Database Properties

Your database should have these properties (they can be created automatically, but it's better to set them up):

- `Name` - Title property (this is the default, required)
- `slug` - Text property
- `description` - Text property
- `image` - Files & media property
- `imageAlt` - Text property
- `isReady` - Checkbox property

**Note:** If these properties don't exist, they will be created automatically when the first post is synced.

### Step 3: Share Database with Integration

#### 3.1 Open Database

Open the Notion database you want to sync posts to

#### 3.2 Add Integration Connection

1. Click the **"..."** menu (three dots) in the top right of the database
2. Select **"Add connections"** or **"Connections"**
3. Find and select your `NextBlog Integration`
4. Click **"Confirm"** or **"Add"**

**Important:** Without this step, the integration won't have access to your database and syncing will fail.

### Step 4: Get Database ID

#### 4.1 Copy Database URL

1. Open your Notion database in a web browser
2. Copy the URL from your browser's address bar
3. The URL will look like: `https://www.notion.so/workspace/DATABASE_ID?v=...`

#### 4.2 Extract Database ID

The Database ID is the 32-character string between your workspace name and the `?` character.

**Example:**

```text
URL: https://www.notion.so/myworkspace/a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6?v=...
Database ID: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
```

**Tip:** The Database ID is 32 characters long and contains letters and numbers. Remove any hyphens if present.

### Step 5: Configure Notion Integration in NextBlog

#### 5.1 Navigate to Project Settings

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

#### 5.2 Enable Notion Integration

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

#### 5.3 Enter Notion Credentials

Fill in the following fields:

- **Notion Integration Token:** Paste the token you copied in Step 1.4 (starts with `secret_`)
- **Notion Database ID:** Paste the Database ID you extracted in Step 4.2 (32 characters)

#### 5.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:
  - That the database is shared with your integration (Step 3)
  - That the token and database ID are correct
  - That you have access to the workspace

#### 5.5 Save Changes

Click the **"Save Changes"** button to save your Notion 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 Notion integration is triggered
2. **Content Conversion:** The markdown content is converted to Notion blocks (headings, paragraphs, lists, etc.)
3. **Page Creation:** A new page is created in your Notion database with:
  - `Name` property set to the post title
  - `slug` property with the post slug
  - `description` property with the post description
  - `image` property with the cover image URL
  - `imageAlt` property with the image alt text
  - `isReady` checkbox set to true
4. **Content Blocks:** The full blog post content is added as Notion blocks in the page body
5. **Completion:** The page is ready for viewing and collaboration in Notion

### Troubleshooting

#### Connection Test Fails

**Common issues:**

- **Database not shared:** Make sure you completed Step 3 and shared the database with your integration
- **Invalid token:** Check that you copied the entire token correctly (it should start with `secret_`)
- **Wrong database ID:** Verify the 32-character ID is correct and doesn't include hyphens or extra characters
- **Workspace access:** Make sure your integration has access to the workspace containing the database

#### Posts Not Syncing

**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)
- Look for error messages in your NextBlog dashboard
- Check Notion for any permission errors

#### Content Not Appearing Correctly

**Possible causes:**

- Complex markdown formatting may not convert perfectly - review and adjust in Notion if needed
- Images must be publicly accessible URLs
- Very long posts may take a moment to sync completely

### Next Steps

Now that your Notion integration is set up:

- Generate or create a blog post in NextBlog
- Review and approve the post
- Check your Notion database - a new page should appear automatically!
- Use Notion's collaboration features to work with your team on the content

## Shopify Integration

Automatically publish blog posts to your Shopify store. This integration adds blog articles to your Shopify blog, perfect for content marketing and SEO.

#### Prerequisites

Before you begin, make sure you have:

- A Shopify store with admin access
- Permission to create custom apps in your Shopify store
- Admin API access enabled

### Step 1: Create Custom App in Shopify

#### 1.1 Navigate to Apps Section

1. Log into your Shopify admin dashboard
2. In the left sidebar, click on **"Apps"**
3. Scroll down and click **"Develop apps"** (or "App and sales channel settings" → "Develop apps")

![Navigate to Apps section in Shopify](https://nextblog.ai/shopify-steps/step1-shopify.png)

#### 1.2 Create New App

1. Click the **"Create an app"** button
2. Enter an app name: `NextBlog Integration`
3. Enter your email address (optional but recommended)
4. Click **"Create app"**

#### 1.3 Configure API Scopes

1. Set the app URL to `https://nextblog.ai`
2. Click on **"Configure Admin API scopes"**
3. Enable the following scopes:
  - `write_content` - To create blog articles
  - `read_content` - To read blog information
  - `write_files` - To upload images (optional)
  - `read_files` - To read file information (optional)
4. Click **"Save"**

![Configure API scopes for your Shopify app](https://nextblog.ai/shopify-steps/step2-create-app.png)

#### 1.4 Install the App

1. Click the **"Install app"** button at the top of the page
2. Review the permissions and click **"Install"** to confirm
3. Wait for the installation to complete

![Install app - step 1](https://nextblog.ai/shopify-steps/step3a-install.png)

![Install app - step 2](https://nextblog.ai/shopify-steps/step3b-install.png)

#### 1.5 Get Your API Credentials

1. Click on **"API credentials"** tab
2. Copy your **"Client ID"**
3. Copy your **"Client secret"**
4. **Important:** Save both credentials securely. You'll need them to connect NextBlog to Shopify.

![Get Client ID and Secret](https://nextblog.ai/shopify-steps/step4a-connect.png)

### Step 2: Configure Shopify Integration in NextBlog

#### 2.1 Navigate to Project Settings

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

#### 2.2 Enable Shopify Integration

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

#### 2.3 Enter Shopify Credentials

Fill in the following fields:

- **Shopify Store URL:** Enter your store URL (e.g., `mystore.myshopify.com` - without https://)
- **Client ID:** Paste the Client ID from Step 1.4
- **Client Secret:** Paste the Client Secret from Step 1.4
- **Blog ID (Optional):** Leave empty to use your store's default blog, or enter a specific blog ID if you have multiple blogs

![Enter Shopify credentials in NextBlog](https://nextblog.ai/shopify-steps/step4b-connect.png)

#### 2.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

#### 2.5 Save Changes

Click the **"Save Changes"** button to save your Shopify 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 Shopify integration is triggered
2. **Content Conversion:** The markdown content is converted to HTML format
3. **Blog Selection:** The post is added to your default Shopify blog (or the specified blog ID)
4. **Article Creation:** A new Shopify article is created with:
  - Title from your NextBlog post
  - HTML content (converted from markdown)
  - Summary/excerpt
  - SEO-friendly handle (slug)
  - Featured image (if provided)
  - Author set to "NextBlog AI"
  - Tags: "SEO, AI Generated, NextBlog"
5. **Publishing:** The article is published to your Shopify blog and is immediately live

### Troubleshooting

#### Connection Test Fails

**Common issues:**

- **Incorrect store URL:** Make sure you're using the format `yourstore.myshopify.com` (without https://)
- **Invalid credentials:** Make sure you copied both Client ID and Client Secret correctly
- **Missing API scopes:** Verify that you enabled the required scopes in Step 1.3
- **App not installed:** Make sure you installed the app after creating it

#### 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)
- Look for error messages in your NextBlog dashboard
- Check Shopify admin for any failed article attempts

### Next Steps

Now that your Shopify integration is set up:

- Generate or create a blog post in NextBlog
- Review and approve the post
- Check your Shopify blog - the article should appear automatically!
- Customize the blog appearance in your Shopify theme settings

## Shopify Legacy Integration

> **Legacy Method:** This integration method uses Client ID and Client Secret for authentication. It is recommended to use the standard Shopify OAuth integration instead, which provides better security and a smoother user experience.

The Shopify Legacy integration allows you to publish blog posts to your Shopify store using Client ID and Client Secret credentials. This method exchanges your credentials for an access token on each request.

#### Prerequisites

Before you begin, make sure you have:

- A Shopify store with admin access
- Permission to create custom apps in your Shopify store
- Admin API access enabled

### Step 1: Create Custom App in Shopify

#### 1.1 Navigate to Apps Section

1. Log into your Shopify admin dashboard
2. In the left sidebar, click on **"Apps"**
3. Scroll down and click **"Develop apps"** (or "App and sales channel settings" → "Develop apps")

#### 1.2 Create New App

1. Click the **"Create an app"** button
2. Enter an app name: `NextBlog Legacy Integration`
3. Enter your email address (optional but recommended)
4. Click **"Create app"**

#### 1.3 Configure API Scopes

1. Click on **"Configure Admin API scopes"**
2. Enable the following scopes:
  - `write_content` - To create blog articles
  - `read_content` - To read blog information
  - `write_files` - To upload images (optional)
  - `read_files` - To read file information (optional)
3. Click **"Save"**

#### 1.4 Install the App

1. Click the **"Install app"** button at the top of the page
2. Review the permissions and click **"Install"** to confirm
3. Wait for the installation to complete

#### 1.5 Get Your API Credentials

1. Click on **"API credentials"** tab
2. Copy your **"Client ID"**
3. Copy your **"Client secret"**
4. **Important:** Save both credentials securely. You'll need them to connect NextBlog to Shopify.

### Step 2: Get Your Shopify Store URL

#### 2.1 Find Your Store URL

Your Shopify store URL is in the format: `yourstore.myshopify.com`

You can find it:

- In your browser's address bar when logged into Shopify admin
- In your Shopify admin settings under "Store details"
- It's the part before `.myshopify.com` in your store's URL

### Step 3: Configure Shopify Legacy Integration in NextBlog

#### 3.1 Navigate to Project Settings

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

#### 3.2 Enable Shopify Legacy Integration

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

#### 3.3 Enter Shopify Credentials

Fill in the following fields:

- **Shop URL:** Enter your store URL (e.g., `mystore.myshopify.com` - without https://)
- **Client ID:** Paste the Client ID from Step 1.5
- **Client Secret:** Paste the Client Secret from Step 1.5
- **Blog ID (Optional):** Leave empty to use your store's default blog, or enter a specific blog ID if you have multiple blogs

#### 3.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

#### 3.5 Save Changes

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

### How It Works

The Shopify Legacy integration uses the client_credentials OAuth flow:

1. **Post Approval:** When you approve a blog post in NextBlog, the Shopify Legacy integration is triggered
2. **Token Exchange:** NextBlog exchanges your Client ID and Client Secret for an access token
3. **Content Conversion:** The markdown content is converted to HTML format
4. **Article Creation:** A new Shopify article is created with your post content
5. **Publishing:** The article is published to your Shopify blog and is immediately live

### Troubleshooting

#### Connection Test Fails

**Common issues:**

- **Incorrect store URL:** Make sure you're using the format `yourstore.myshopify.com` (without https://)
- **Invalid credentials:** Make sure you copied both Client ID and Client Secret correctly
- **Missing API scopes:** Verify that you enabled the required scopes
- **App not installed:** Make sure you installed the app after creating it

#### Posts Not Publishing

**Check the following:**

- Make sure the Shopify Legacy integration is enabled in project settings
- Verify the connection test passes
- Check that you're approving posts (not just generating them)
- Look for error messages in your NextBlog dashboard
- Check Shopify admin for any failed article attempts

### Next Steps

Now that your Shopify Legacy integration is set up:

- Generate or create a blog post in NextBlog
- Review and approve the post
- Check your Shopify blog - the article should appear automatically!
- Customize the blog appearance in your Shopify theme settings

## Wix Integration

Publish blog posts to your Wix site with rich formatting and media support. This integration creates posts in your Wix blog automatically.

#### Prerequisites

Before you begin, make sure you have:

- A Wix site with a blog enabled
- Wix account with admin access
- API access enabled for your site

**Note:** If you haven't added a blog to your Wix site yet, you can do so by:

1. In the Wix website builder, click **"Pages and Menu"** in the left sidebar
2. Click **"Add Page"** or the **"+"** button
3. Select **"Blog"** from the page types
4. Your blog page will be created and ready to receive posts

### Step 1: Create API Key in Wix

#### 1.1 Visit Wix API Keys Page

Go to [https://manage.wix.com/account/api-keys](https://manage.wix.com/account/api-keys)

#### 1.2 Create New API Key

1. Click the **"Create API Key"** button
2. Enter a name: `NextBlog Integration`
3. Select the permissions: `Blog (write)`
4. Click **"Generate"** or **"Create"**

#### 1.3 Copy API Key

1. After creating the API key, it will be displayed
2. **Important:** Copy the API key immediately and save it securely
3. You can view this key again later, but it's best to copy it now

### Step 2: Get Your Wix Site ID

#### 2.1 Access Site Dashboard

1. Log into your Wix account
2. Go to your site dashboard
3. Click on **"Settings"** in the left sidebar

#### 2.2 Find Site ID

The easiest way to find your Site ID is from the Wix dashboard URL:

1. Go to your Wix dashboard
2. Look at your browser's address bar - it will look something like:

https://manage.wix.com/dashboard/412f6f5e-6c38-46df-aee1-66802a2001d1

The long string after `/dashboard/` (for example `412f6f5e-6c38-46df-aee1-66802a2001d1`) is your Site ID.

**Alternative method:** You can also find the Site ID by:

- Clicking on **"Settings"** → **"General Info"** or **"Site Info"**
- Looking for **"Site ID"** or **"Site Number"** in the settings
- Checking the Wix API documentation for your site

### Step 3: Configure Wix Integration in NextBlog

#### 3.1 Navigate to Project Settings

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

#### 3.2 Enable Wix Integration

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

#### 3.3 Enter Wix Credentials

Fill in the following fields:

- **Wix API Key:** Paste the API key you copied in Step 1.3
- **Wix Site ID:** Paste the Site ID you found in Step 2.2

#### 3.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

#### 3.5 Save Changes

Click the **"Save Changes"** button to save your Wix 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 Wix integration is triggered
2. **Content Conversion:** The markdown content is converted to Wix rich content format
3. **Post Creation:** A new Wix blog post is created with:
  - Title from your NextBlog post
  - Rich content (converted from markdown)
  - Excerpt/description
  - SEO-friendly slug
  - Featured image (if provided)
  - Published status (based on your post status)
4. **Publishing:** The post is published to your Wix blog and is immediately live

### Troubleshooting

#### Connection Test Fails

**Common issues:**

- **Invalid API key:** Make sure you copied the entire API key correctly
- **Wrong Site ID:** Verify the Site ID is correct
- **Missing permissions:** Make sure the API key has Blog write permissions
- **Blog not enabled:** Ensure you have a blog enabled on your Wix site

#### 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)
- Look for error messages in your NextBlog dashboard

### Next Steps

Now that your Wix integration is set up:

- Generate or create a blog post in NextBlog
- Review and approve the post
- Check your Wix blog - the post should appear automatically!
- Customize the blog design in your Wix editor

## Webflow Integration

Push content to Webflow CMS collections with designer-friendly formatting. This integration creates items in your Webflow CMS automatically.

#### Prerequisites

Before you begin, make sure you have:

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

### Step 1: Generate API Token in Webflow

#### 1.1 Visit Webflow Account Settings

1. Log into your Webflow account
2. Click on your profile icon in the top right
3. Select **"Account Settings"**

#### 1.2 Navigate to API Access

1. Log into your Webflow site settings like `https://webflow.com/dashboard/sites/YOUR_SITE/integrations`
2. In the left sidebar, click on **"Apps & Integrations"**
3. Scroll down to the **"API access"** section

#### 1.3 Generate API Token

1. Click the **"Generate API token"** button
2. Enter a name: `NextBlog Integration`
3. Select "Read & Write" permissions for the **"CMS"** scope
4. Click **"Generate Token"**
5. **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 Webflow Designer

1. Log into your Webflow account
2. Open your site in the Webflow Designer

#### 2.2 Navigate to CMS Collections

1. In the left sidebar, click on **"CMS"**
2. Select your blog collection (or create a new one if needed)

#### 2.3 Get Collection ID

The Collection ID can be found in several ways:

- In the collection settings, look for the Collection ID field
- In the URL when viewing the collection: `https://webflow.com/design/site-name/collections/COLLECTION_ID`
- In the Webflow API documentation for your site

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

### Step 3: Set Up CMS Collection Fields

#### Required CMS Fields

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

- `name` - Plain text field (required, for post title)
- `slug` - Plain text field (for URL slug)
- `post-body` - Rich text field (for post content)
- `post-summary` - Plain text field (for excerpt/description)
- `main-image` - Image field (for featured image, optional)

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

### Step 4: Configure Webflow 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 Webflow Integration

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

#### 4.3 Enter Webflow Credentials

Fill in the following fields:

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

#### 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 Webflow 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 Webflow 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 Webflow collection with:
  - Title in the `name` field
  - Slug in the `slug` field
  - HTML content in the `post-body` field
  - Description in the `post-summary` field
  - Featured image in the `main-image` field (if provided)
4. **Publishing:** The item is created in your Webflow CMS and can be published through your Webflow 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 Webflow integration is set up:

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

## Ghost Integration

Native markdown publishing to Ghost CMS with full feature support. Ghost natively supports markdown, so your content is published exactly as written.

#### Prerequisites

Before you begin, make sure you have:

- A Ghost site (self-hosted or Ghost Pro)
- Admin access to your Ghost site
- Ability to create custom integrations

### Step 1: Create Custom Integration in Ghost

#### 1.1 Navigate to Ghost Admin

1. Log into your Ghost admin dashboard
2. In the left sidebar, click on **"Settings"**

#### 1.2 Go to Integrations

1. Click on **"Integrations"** in the Settings menu
2. You'll see a list of existing integrations

#### 1.3 Create New Integration

1. Click the **"Add custom integration"** button
2. Enter a name: `NextBlog Integration`
3. Click **"Create"**

#### 1.4 Get Admin API Key

1. After creating the integration, you'll see the integration details
2. Look for the **"Admin API Key"** section
3. You'll see a key in the format: `id:secret` (e.g., `5f8a9b2c3d4e5f6g7h8i9j0:1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7`)
4. **Important:** Copy the entire Admin API Key (both the ID and secret, including the colon). You'll need the full `id:secret` format!

### Step 2: Get Your Ghost Site URL

#### 2.1 Find Your Ghost URL

Your Ghost site URL is the base URL of your Ghost installation:

- For Ghost Pro: `https://yourblog.ghost.io`
- For self-hosted: `https://yourdomain.com` or `https://blog.yourdomain.com`

Make sure to use the full URL including `https://`

### Step 3: Configure Ghost Integration in NextBlog

#### 3.1 Navigate to Project Settings

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

#### 3.2 Enable Ghost Integration

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

#### 3.3 Enter Ghost Credentials

Fill in the following fields:

- **Ghost Site URL:** Enter your Ghost site URL (e.g., `https://yourblog.ghost.io`)
- **Ghost Admin API Key:** Paste the full Admin API Key in `id:secret` format that you copied in Step 1.4

**Important:** The Admin API Key must be in the format `id:secret` with a colon between them. Do not separate them or modify the format.

#### 3.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:
  - That the URL is correct and includes https://
  - That the Admin API Key is in the correct `id:secret` format
  - That your Ghost site is accessible

#### 3.5 Save Changes

Click the **"Save Changes"** button to save your Ghost 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 Ghost integration is triggered
2. **Native Markdown:** Ghost natively supports markdown, so your content is published exactly as written (no conversion needed!)
3. **Post Creation:** A new Ghost post is created with:
  - Title from your NextBlog post
  - Markdown content (native format)
  - Custom excerpt/description
  - SEO-friendly slug
  - Feature image (if provided)
  - Tags: "SEO" and "AI Generated"
  - Published status (based on your post status)
4. **Publishing:** The post is published to your Ghost site and is immediately live

### Troubleshooting

#### Connection Test Fails

**Common issues:**

- **Incorrect URL format:** Make sure the URL includes `https://` and doesn't have a trailing slash
- **Wrong API key format:** The Admin API Key must be in `id:secret` format with a colon. Make sure you copied both parts.
- **Invalid credentials:** Verify that the integration was created correctly in Ghost
- **Site unreachable:** Check if your Ghost site is accessible and running

#### 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)
- Look for error messages in your NextBlog dashboard
- Check Ghost admin for any failed post attempts

### Next Steps

Now that your Ghost integration is set up:

- Generate or create a blog post in NextBlog
- Review and approve the post
- Check your Ghost site - the post should appear automatically!
- Enjoy native markdown support - your content is published exactly as written

## Framer Integration

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

## DEV.to Integration

Cross-post approved blog posts to DEV.to (Forem) with native markdown support. When enabled, approving a post will publish (or update) the matching DEV article automatically.

#### Prerequisites

Before you begin, make sure you have:

- A DEV.to account
- A DEV Community API key

### Step 1: Create a DEV Community API Key

#### 1.1 Open DEV account settings

Go to [https://dev.to/settings/extensions](https://dev.to/settings/extensions).

#### 1.2 Generate an API key

Scroll to the **DEV Community API Keys** section, generate a new key, and copy it.

**Important:** Treat this key like a password and store it securely.

### Step 2: Configure DEV.to in NextBlog

#### 2.1 Open your project settings

In your NextBlog dashboard, open the project you want to connect.

#### 2.2 Enable DEV.to integration

In the **Integrations** section, expand **DEV.to** and toggle the enable switch to ON.

#### 2.3 Paste your API key

Paste your DEV API key into the **DEV.to API Key** field.

#### 2.4 Test connection

Click **Test Connection**. You should see a success message if the key is valid.

#### 2.5 Save changes

Click **Save Changes** at the bottom of the page to persist your DEV.to settings.

### How Publishing Works

#### Approve publishes to DEV.to

When you approve a blog post, NextBlog will publish it to DEV.to. If it was published before, it will update the existing DEV article instead of creating a duplicate.

#### Unpublish reverts to draft

If you unpublish a blog post in NextBlog, the linked DEV article will be reverted back to a draft (unpublished) state.

### Troubleshooting

#### Connection test fails

**Common issues:**

- Invalid or revoked API key
- Copy/paste included extra whitespace
- DEV API keys not enabled on your account

## Blogger Integration

Publish posts to [Blogger](https://www.blogger.com/) using the official [Blogger API v3](https://developers.google.com/blogger/docs/3.0/using). NextBlog uses the same Google account connection as Search Console (OAuth). Markdown is converted to HTML; cover images are included at the top of the post body.

#### Prerequisites

Before you begin:

- A Google account with a blog on [Blogger](https://www.blogger.com/)
- In [Google Cloud Console](https://console.cloud.google.com/apis/library), enable the **Blogger API** for the same project that owns your OAuth client (the one used for “Connect Google” in NextBlog)
- NextBlog’s Google sign-in requests the `https://www.googleapis.com/auth/blogger` scope alongside Search Console. If you connected Google before Blogger support existed, open the dashboard, disconnect Google, and connect again so your refresh token includes Blogger access.

### Step 1: Connect Google

#### 1.1 From project settings (recommended)

Open your project, expand the **Blogger** section, and click **Connect Google account**. After you sign in, you are sent back to the same project to finish setup. The same connection powers Search Console (optional) and Blogger.

#### 1.2 From the dashboard

Alternatively, use **Connect Google** on your [dashboard](https://nextblog.ai/dashboard) if you prefer.

#### 1.3 Reconnect if needed

If the Blogger blog list or test connection fails with permission or API errors, disconnect and reconnect Google so consent includes the Blogger scope, and confirm the Blogger API is enabled in Google Cloud.

### Step 2: Configure Blogger in your project

#### 2.1 Open project settings

In the NextBlog app, open the project and expand the **Blogger** integration section.

#### 2.2 Enable and choose a blog

Turn on **Enable Blogger**, pick your blog from the dropdown (loaded from your Google account), and click **Save Changes**.

#### 2.3 Test connection

Click **Test Connection** to verify the Blogger API responds. If this fails, check prerequisites above.

### How publishing works

#### Drafts on generation

When Blogger is enabled, new generated posts create a **draft** on your selected blog. If **auto-publish** is on for the project, that draft is published immediately after creation.

#### Approve publishes

Approving a post updates the Blogger post content and publishes it if it is still a draft. If the post was already live, content is updated in place.

#### Unpublish reverts to draft

Unpublishing in NextBlog calls Blogger’s **revert** action so the post returns to draft and is removed from public view (when the API allows).

### Troubleshooting

#### Common issues

- **Blogger API has not been used / disabled:** Enable Blogger API in Google Cloud for your OAuth client’s project.
- **403 / insufficient permissions:** Disconnect and reconnect Google on the dashboard to grant the Blogger scope.
- **No blogs in the list:** Ensure the Google account you connected owns at least one Blogger blog.

## YouTube Integration

On **paid plans**, NextBlog can automatically generate a full **15–20 minute** YouTube video version of each blog post and publish it to your channel.

#### Prerequisites

- A YouTube channel on the Google account you will connect
- Ability to grant YouTube upload permissions during OAuth consent
- Video generation consumes additional resources/credits compared to text-only publishing

### Step 1: Connect YouTube to a project

#### 1.1 Open project settings

In the NextBlog app, open your project and go to the **Settings** page.

#### 1.2 Connect your YouTube account

Find the **YouTube** section and click **Connect YouTube**. Complete the Google consent flow and grant the requested permissions.

#### 1.3 Confirm connection

After you return to NextBlog, you should see your channel connected for the current project.

### How it works

After a YouTube account is connected to the project, NextBlog automatically:

1. Creates a storyboard and narration from the approved/generated blog post
2. Renders a complete video targeting ~15–20 minutes (varies by post length)
3. Uploads and publishes the video to your YouTube channel

### Troubleshooting

#### Upload fails / insufficient permissions

Disconnect and reconnect your YouTube account so consent includes YouTube upload permissions.

#### No channel available

Ensure the connected Google account has an active YouTube channel.

## Hashnode Integration

Publish, update, and unpublish your NextBlog posts on [Hashnode](https://hashnode.com/) using Hashnode’s GraphQL API.

#### Prerequisites

- A Hashnode account
- A Hashnode API token (PAT) for GraphQL mutations
- Your Hashnode **publicationId** (where posts will be created/published)

### Step 1: Create your Hashnode API token

#### 1.1 Generate a token

Go to [Hashnode Developer Settings](https://hashnode.com/settings/developer) and click **Generate New Token**.

NextBlog sends this token as the GraphQL header `Authorization: <token>`.

### Step 2: Get your publicationId

#### 2.1 Find the publication you want to publish to

Your **publicationId** tells NextBlog where to create drafts and publish posts.

If you already know your publicationId, paste it below in the project settings.

### Step 3: Connect Hashnode in NextBlog

#### 3.1 Enable Hashnode and test connection

Open **Project Settings** → **Integrations** → enable **Hashnode**, paste your API token and publicationId, then click **Test Connection**.

### How Publishing Works

#### Generation creates a draft

When Hashnode is enabled, NextBlog creates a Hashnode draft for every generated post and stores the draft id.

#### auto_publish publishes immediately

If **auto_publish** is enabled, the draft is published right away and NextBlog stores the published post id.

#### Approve updates or publishes

When you approve a post:

- If we have a published Hashnode post id, NextBlog updates the post content.
- Otherwise, NextBlog publishes the stored draft.

#### Unpublish removes and recreates a draft

When you unpublish a post, NextBlog removes the published Hashnode post and recreates a fresh draft from your current blog markdown.

### Troubleshooting

#### Test Connection fails

Check that:

- Your API token is valid (and not revoked)
- Your publicationId matches where you want to publish
- You pasted values without extra whitespace

## REST API Integration

Use our HTTP APIs with your project API key: the Blog Display API (`/api/blog/...`) fetches published posts for your website; the optional Post Management API (`/api/manage/...`) lets you create or edit posts from your own backend. See [Post Management API](/docs/api-manage-posts.md) for details.

#### Overview

The NextBlog REST APIs allow you to:

- Fetch all published blog posts for a project (Blog Display API)
- Get a specific published blog post by slug
- Integrate content into custom websites and applications
- Optionally create, update, and change status of posts via the Post Management API

### Step 1: Get Your API Key

#### 1.1 Navigate to Project Settings

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

#### 1.2 Generate API Key

1. Scroll to the **"API Key"** section
2. Click **"Generate API Key"** if you don't have one yet
3. Copy your API key and save it securely
4. **Important:** Keep this key secret and never expose it in client-side code

### Step 2: Get Your Project ID

#### 2.1 Find Project ID

Your Project ID can be found:

- In your project settings page
- In the URL when viewing your project: `/projects/PROJECT_ID`
- In the API key section of your project settings

### Step 3: Make API Requests

Published-content reads use `https://nextblog.ai/api/blog`. Advanced create/update flows use `https://nextblog.ai/api/manage` — see [Post Management API](/docs/api-manage-posts.md).

#### 3.1 Base URL (display published posts)

Fetch published posts from:

```bash
https://nextblog.ai/api/blog
```

#### 3.2 Authentication

Include your API key in the Authorization header:

```bash
Authorization: Bearer your_api_key_here
```

#### 3.3 Get All Blog Posts

**Endpoint:** `GET /api/blog/{projectId}`

**Example:**

```bash
curl -H "Authorization: Bearer your_api_key_here" \
    https://nextblog.ai/api/blog/project_123
```

#### 3.4 Get Single Blog Post

**Endpoint:** `GET /api/blog/{projectId}/{slug}`

**Example:**

```bash
curl -H "Authorization: Bearer your_api_key_here" \
    https://nextblog.ai/api/blog/project_123/how-to-optimize-website
```

#### 3.5 Post Management API (optional)

To list drafts, create posts, or update status over HTTP, use the management base URL and endpoints documented on the [Post Management API](/docs/api-manage-posts.md) page.

```bash
https://nextblog.ai/api/manage/{projectId}/posts
```

### Response Format

#### All Posts Response

```json
{
  "project": {
    "id": "project_123",
    "name": "My Blog"
  },
  "blogs": [
    {
      "id": "blog_456",
      "title": "How to Optimize Your Website",
      "slug": "how-to-optimize-website",
      "description": "Learn the best practices...",
      "cover_image_url": "https://example.com/image.jpg",
      "published": true,
      "created_at": "2024-01-01T00:00:00Z"
    }
  ]
}
```

#### Single Post Response

```json
{
  "project": {
    "id": "project_123",
    "name": "My Blog"
  },
  "blog": {
    "id": "blog_456",
    "title": "How to Optimize Your Website",
    "slug": "how-to-optimize-website",
    "description": "Learn the best practices...",
    "markdown": "# Full markdown content...",
    "cover_image_url": "https://example.com/image.jpg",
    "published": true,
    "created_at": "2024-01-01T00:00:00Z"
  }
}
```

### Integration Examples

See our detailed examples for:

- [Next.js Integration](/docs/nextjs-examples.md)
- [React Integration](/docs/react-examples.md)
- [JavaScript Integration](/docs/javascript-examples.md)

### Rate Limits

API requests are limited to 1000 requests per hour per API key. If you exceed this limit, you'll receive a 429 Too Many Requests response.

### Security Best Practices

- Never expose your API key in client-side code
- Use environment variables to store API keys
- Rotate your API keys regularly
- Monitor API usage for suspicious activity

## Webhooks Integration

Receive real-time notifications when blog posts are approved or published. Use webhooks to integrate NextBlog with any custom CMS or application.

#### Overview

Webhooks allow you to:

- Receive real-time notifications when posts are approved
- Sync content to custom CMS systems
- Trigger notifications in Slack, Discord, or other services
- Update external databases or systems
- Build custom publishing workflows

### Step 1: Set Up Your Webhook Endpoint

#### 1.1 Create Webhook Endpoint

Create an HTTP endpoint (URL) that can receive POST requests. This endpoint should:

- Be publicly accessible (use HTTPS)
- Accept POST requests
- Return a 200 status code on success
- Handle JSON payloads

#### 1.2 Example Webhook Handler (Node.js/Express)

```javascript
// Express.js webhook handler
const express = require('express');
const app = express();

app.use(express.json());

app.post('/webhook', (req, res) => {
  const { event, blog } = req.body;
  
  if (event === 'approved') {
    console.log('Blog post approved:', blog.title);
    // Process the approved blog post
    // e.g., sync to another CMS, send notifications, etc.
  }
  
  res.status(200).json({ received: true });
});

app.listen(3000, () => {
  console.log('Webhook server running on port 3000');
});
```

### Step 2: Configure Webhook in NextBlog

#### 2.1 Navigate to Project Settings

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

#### 2.2 Enter Webhook URL

1. Scroll down to the **"Webhooks"** section
2. Enter your webhook URL (must be HTTPS, e.g., `https://your-server.com/webhook`)
3. Leave empty to disable webhooks

#### 2.3 Save Changes

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

### Webhook Events

#### Approved Event

Webhooks are triggered when a blog post is approved and published. The event type is `"approved"`.

### Webhook Payload

When a webhook is triggered, a POST request is sent to your webhook URL with the following JSON payload:

```json
{
  "event": "approved",
  "timestamp": "2024-01-01T12:00:00Z",
  "blog": {
    "id": "blog_123",
    "title": "How to Optimize Your Website",
    "slug": "how-to-optimize-website",
    "description": "Learn the best practices...",
    "markdown": "# Full markdown content...",
    "cover_image_url": "https://example.com/image.jpg",
    "cover_image_alt": "Website optimization",
    "published": true,
    "status": "approved",
    "created_at": "2024-01-01T10:00:00Z",
    "updated_at": "2024-01-01T12:00:00Z",
    "project_id": "project_456"
  }
}
```

### Webhook Headers

Each webhook request includes the following headers:

```bash
Content-Type: application/json
User-Agent: NextBlog-Webhook/1.0
```

### Error Handling

If your webhook endpoint returns an error or is unreachable, NextBlog will automatically retry once. Failed webhooks are logged but do not prevent the blog post from being published.

### Security Best Practices

- **Use HTTPS:** Always use HTTPS for your webhook URLs to encrypt data in transit
- **Validate Payload:** Validate the webhook payload on your server to ensure it's from NextBlog
- **Rate Limiting:** Implement rate limiting on your webhook endpoint to prevent abuse
- **Verify Event Type:** Check the event type before processing to handle different events appropriately
- **Idempotency:** Make your webhook handler idempotent to handle duplicate deliveries

### Testing Your Webhook

To test your webhook:

1. Set up your webhook endpoint
2. Configure the webhook URL in NextBlog
3. Approve a test blog post
4. Check your webhook endpoint logs to verify the request was received

### Use Cases

- Sync content to custom CMS systems
- Send notifications to Slack, Discord, or email
- Update external databases or search indices
- Trigger automated workflows in other services
- Build custom analytics and tracking

## Next.js App Router Examples

Learn how to integrate NextBlog content into your Next.js applications using the App Router.
Full [Next.js example code is available here](https://github.com/NextBlogAI/NextJS-AI-Blog).

#### Blog List Page

```javascript
// app/blog/page.js (Server Component)
import Link from 'next/link';

export const metadata = {
  title: 'YourSite Official Blog',
  description: 'The latest blog posts of YourSite.',
};

async function getBlogPosts() {
  const apiKey = process.env.NEXTBLOG_API_KEY;
  const projectId = process.env.NEXTBLOG_PROJECT_ID;
  
  try {
    const response = await fetch(`https://nextblog.ai/api/blog/${projectId}`, {
      headers: {
        'Authorization': `Bearer ${apiKey}`
      },
      next: { revalidate: 3600 } // Cache for 1 hour
    });
    
    if (!response.ok) {
      throw new Error('Failed to fetch blog posts');
    }
    
    const data = await response.json();
    return data.blogs;
  } catch (error) {
    console.error('Error fetching blog posts:', error);
    return [];
  }
}

export default async function BlogList() {
  const blogs = await getBlogPosts();
  
  return (
    <div className='blog-list'>
      {blogs.map(blog => (
        <article key={blog.id} className='blog-post-preview'>
          <h2>{blog.title}</h2>
          <p>{blog.description}</p>
          <img src={blog.cover_image_url} alt={blog.title} />
          <Link href={`/blog/${blog.slug}`}>Read more</Link>
        </article>
      ))}
    </div>
  );
}
```

#### Single Blog Post Page

**Install react-markdown:**

```bash
npm install react-markdown --save
```

```javascript
// app/blog/[slug]/page.js (Server Component)
import { notFound } from 'next/navigation';
import ReactMarkdown from 'react-markdown';

async function getBlogPost(slug) {
  const apiKey = process.env.NEXTBLOG_API_KEY;
  const projectId = process.env.NEXTBLOG_PROJECT_ID;
  
  try {
    const response = await fetch(`https://nextblog.ai/api/blog/${projectId}/${slug}`, {
      headers: {
        'Authorization': `Bearer ${apiKey}`
      },
      next: { revalidate: 3600 } // Cache for 1 hour
    });
    
    if (!response.ok) {
      throw new Error('Failed to fetch blog post');
    }
    
    const data = await response.json();
    return data.blog;
  } catch (error) {
    console.error('Error fetching blog post:', error);
    return null;
  }
}

// Generate metadata for SEO
export async function generateMetadata({ params }) {
  const blog = await getBlogPost(params.slug);

  return {
    title: blog.title,
    description: blog.description,
    openGraph: {
      title: blog.title,
      description: blog.description,
      images: blog.cover_image_url,
    },
  };
}

export default async function BlogPost({ params }) {
  const blog = await getBlogPost(params.slug);
  
  if (!blog) {
    notFound();
  }
  
  return (
    <article className='blog-post'>
      <h1>{blog.title}</h1>
      <div className='blog-meta'>
        <time>{new Date(blog.created_at).toLocaleDateString()}</time>
      </div>
      <div className='blog-content'>
        <ReactMarkdown>{blog.markdown}</ReactMarkdown>
      </div>
    </article>
  );
}
```

### Environment Variables

Set up these environment variables for secure API integration:

```bash
# .env.local
NEXTBLOG_API_KEY=your_api_key_here
NEXTBLOG_PROJECT_ID=your_project_id_here
```

## React Examples

Learn how to integrate NextBlog content into your React applications, including Vite apps with proper routing and metadata handling.

### Vite React App Integration

For Vite React apps, you'll need to set up routing and handle dynamic page generation. Here's a complete example using React Router:

#### 1. Install Dependencies

```bash
npm install react-router-dom react-markdown react-helmet-async
```

#### 2. Blog List Component

```jsx
// src/components/BlogList.jsx
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { Helmet } from 'react-helmet-async';

function BlogList() {
  const [blogs, setBlogs] = useState([]);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(null);

  useEffect(() => {
    async function fetchBlogs() {
      try {
        const response = await fetch(`/api/blog/${import.meta.env.VITE_NEXTBLOG_PROJECT_ID}`, {
          headers: {
            'Authorization': `Bearer ${import.meta.env.VITE_NEXTBLOG_API_KEY}`
          }
        });
        
        if (!response.ok) {
          throw new Error('Failed to fetch blog posts');
        }
        
        const data = await response.json();
        setBlogs(data.blogs);
      } catch (error) {
        console.error('Error fetching blogs:', error);
        setError(error.message);
      } finally {
        setLoading(false);
      }
    }
    
    fetchBlogs();
  }, []);

  if (loading) return <div>Loading blog posts...</div>;
  if (error) return <div>Error: {error}</div>;

  return (
    <>
      <Helmet>
        <title>Blog - Your Site Name</title>
        <meta name="description" content="Latest blog posts and articles" />
        <meta property="og:title" content="Blog - Your Site Name" />
        <meta property="og:description" content="Latest blog posts and articles" />
      </Helmet>
      
      <div className="blog-list">
        <h1>Blog Posts</h1>
        {blogs.map(blog => (
          <article key={blog.id} className="blog-post-preview">
            <h2>{blog.title}</h2>
            <p>{blog.description}</p>
            {blog.cover_image_url && (
              <img src={blog.cover_image_url} alt={blog.title} />
            )}
            <Link to={`/blog/${blog.slug}`}>Read more</Link>
          </article>
        ))}
      </div>
    </>
  );
}

export default BlogList;
```

#### 3. Single Blog Post Component

```jsx
// src/components/BlogPost.jsx
import React, { useState, useEffect } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import { Helmet } from 'react-helmet-async';
import ReactMarkdown from 'react-markdown';

function BlogPost() {
  const [blog, setBlog] = useState(null);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(null);
  const { slug } = useParams();
  const navigate = useNavigate();

  useEffect(() => {
    async function fetchBlogPost() {
      try {
        const response = await fetch(`/api/blog/${import.meta.env.VITE_NEXTBLOG_PROJECT_ID}/${slug}`, {
          headers: {
            'Authorization': `Bearer ${import.meta.env.VITE_NEXTBLOG_API_KEY}`
          }
        });
        
        if (!response.ok) {
          if (response.status === 404) {
            navigate('/404');
            return;
          }
          throw new Error('Failed to fetch blog post');
        }
        
        const data = await response.json();
        setBlog(data.blog);
      } catch (error) {
        console.error('Error fetching blog post:', error);
        setError(error.message);
      } finally {
        setLoading(false);
      }
    }
    
    fetchBlogPost();
  }, [slug, navigate]);

  if (loading) return <div>Loading blog post...</div>;
  if (error) return <div>Error: {error}</div>;
  if (!blog) return <div>Blog post not found</div>;

  return (
    <>
      <Helmet>
        <title>{blog.title}</title>
        <meta name="description" content={blog.description} />
        <meta property="og:title" content={blog.title} />
        <meta property="og:description" content={blog.description} />
        {blog.cover_image_url && (
          <meta property="og:image" content={blog.cover_image_url} />
        )}
        <meta property="og:type" content="article" />
        <meta property="article:published_time" content={blog.created_at} />
        <meta property="article:modified_time" content={blog.updated_at} />
      </Helmet>
      
      <article className="blog-post">
        <h1>{blog.title}</h1>
        <div className="blog-meta">
          <time>{new Date(blog.created_at).toLocaleDateString()}</time>
        </div>
        {blog.cover_image_url && (
          <img 
            src={blog.cover_image_url} 
            alt={blog.title}
            className="blog-cover"
          />
        )}
        <div className="blog-content">
          <ReactMarkdown>{blog.markdown}</ReactMarkdown>
        </div>
      </article>
    </>
  );
}

export default BlogPost;
```

#### 4. App Router Setup

```jsx
// src/App.jsx
import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { HelmetProvider } from 'react-helmet-async';
import BlogList from './components/BlogList';
import BlogPost from './components/BlogPost';
import Home from './components/Home';
import NotFound from './components/NotFound';

function App() {
  return (
    <HelmetProvider>
      <Router>
        <div className="App">
          <Routes>
            <Route path="/" element={<Home />} />
            <Route path="/blog" element={<BlogList />} />
            <Route path="/blog/:slug" element={<BlogPost />} />
            <Route path="/404" element={<NotFound />} />
            <Route path="*" element={<NotFound />} />
          </Routes>
        </div>
      </Router>
    </HelmetProvider>
  );
}

export default App;
```

#### 5. Environment Variables

Create a `.env` file in your Vite project root:

```bash
# .env
VITE_NEXTBLOG_API_KEY=your_api_key_here
VITE_NEXTBLOG_PROJECT_ID=your_project_id_here
```

### That's It!

With just these 5 steps, you have a fully functional blog that automatically displays your NextBlog content. The blog posts will update automatically whenever new content is generated by NextBlog.

### Optional: Simple Caching for Better Performance

If you want to reduce API calls and improve loading speed, you can add a simple caching mechanism:

```javascript
// Simple caching in your BlogList component
const [blogs, setBlogs] = useState([]);
const [loading, setLoading] = useState(true);

useEffect(() => {
  async function fetchBlogs() {
    try {
      // Check if we have cached data (less than 5 minutes old)
      const cached = localStorage.getItem('nextblog-cache');
      const cacheTime = localStorage.getItem('nextblog-cache-time');
      
      if (cached && cacheTime && (Date.now() - parseInt(cacheTime)) < 5 * 60 * 1000) {
        setBlogs(JSON.parse(cached));
        setLoading(false);
        return;
      }

      const response = await fetch(`/api/blog/${import.meta.env.VITE_NEXTBLOG_PROJECT_ID}`, {
        headers: {
          'Authorization': `Bearer ${import.meta.env.VITE_NEXTBLOG_API_KEY}`
        }
      });
      
      const data = await response.json();
      
      // Cache the data
      localStorage.setItem('nextblog-cache', JSON.stringify(data.blogs));
      localStorage.setItem('nextblog-cache-time', Date.now().toString());
      
      setBlogs(data.blogs);
    } catch (error) {
      console.error('Error:', error);
    } finally {
      setLoading(false);
    }
  }
  
  fetchBlogs();
}, []);
```

### Key Benefits

- **Simple Setup:** Just 5 steps to get started
- **Automatic Updates:** New blog posts appear without rebuilding
- **SEO Ready:** Proper meta tags and structured data
- **Performance:** Optional caching for faster loading

## JavaScript Examples

Learn how to integrate NextBlog content into your websites using vanilla JavaScript.

### Fetch All Blog Posts

```javascript
// Fetch all blog posts for a project
async function fetchBlogPosts(projectId, apiKey) {
  try {
    const response = await fetch(`/api/blog/${projectId}`, {
      headers: {
        'Authorization': `Bearer ${apiKey}`
      }
    });
    if (!response.ok) {
      throw new Error('Failed to fetch blog posts');
    }
    const data = await response.json();
    return data.blogs;
  } catch (error) {
    console.error('Error:', error);
    return [];
  }
}

// Display blog posts
function displayBlogPosts(blogs) {
  const container = document.getElementById('blog-posts');
  container.innerHTML = blogs.map(blog => `
    <article class="blog-post">
      <h2>${blog.title}</h2>
      <p>${blog.description}</p>
      <a href="/blog/${blog.slug}">Read more</a>
    </article>
  `).join('');
}
```

### Fetch Single Blog Post

```javascript
// Fetch a single blog post
async function fetchBlogPost(projectId, slug, apiKey) {
  try {
    const response = await fetch(`/api/blog/${projectId}/${slug}`, {
      headers: {
        'Authorization': `Bearer ${apiKey}`
      }
    });
    if (!response.ok) {
      throw new Error('Failed to fetch blog post');
    }
    const data = await response.json();
    return data.blog;
  } catch (error) {
    console.error('Error:', error);
    return null;
  }
}

// Display single blog post with markdown
function displayBlogPost(blog) {
  const container = document.getElementById('blog-content');
  container.innerHTML = `
    <article class="blog-post">
      <h1>${blog.title}</h1>
      <div class="blog-meta">
        <time>${new Date(blog.created_at).toLocaleDateString()}</time>
      </div>
      <div class="blog-content">
        ${marked(blog.markdown)} <!-- Using marked.js for markdown rendering -->
      </div>
    </article>
  `;
}
```

## API Authentication

All API requests require authentication using an API key. Your API key should be included in the Authorization header of every request.

### Getting Your API Key

To get your API key:

1. Log into your NextBlog dashboard
2. Navigate to your project settings
3. Generate or copy your project's API key
4. Keep this key secure and don't share it publicly

### Using Your API Key

Include your API key in the Authorization header using the Bearer token format:

```bash
Authorization: Bearer your_api_key_here
```

### Example Request

```bash
curl -H "Authorization: Bearer your_api_key_here" \
    https://nextblog.ai/api/blog/project_id
```

### Security Best Practices

- Never expose your API key in client-side code
- Use environment variables to store API keys
- Rotate your API keys regularly
- Monitor API usage for suspicious activity

## Blog Display API

These endpoints are for **displaying published content** on your own site: they return only posts that are published in NextBlog. The same project API key is used for authentication.

To create posts, change status, or edit drafts via HTTP, use the optional [Post Management API](/docs/api-manage-posts.md) (`/api/manage/...`).

**Looking for detailed REST API integration guide?** See our [REST API Integration](/docs/integration-rest-api.md) page for step-by-step setup instructions and examples.

### Base URL

```bash
https://nextblog.ai/api/blog
```

### Endpoints

#### Get All Blog Posts

**Endpoint:** `GET /api/blog/{projectId}`

**Description:** Retrieves all published blog posts for a specific project.

**Headers:**

```bash
Authorization: Bearer your_api_key_here
```

**Example Request:**

```bash
curl -H "Authorization: Bearer your_api_key_here" \
    https://nextblog.ai/api/blog/project_123
```

**Response:**

```json
{
  "project": {
    "id": "project_123",
    "name": "My Blog"
  },
  "blogs": [
    {
      "id": "blog_456",
      "title": "How to Optimize Your Website",
      "slug": "how-to-optimize-website",
      "description": "Learn the best practices for website optimization...",
      "cover_image_url": "https://example.com/image.jpg",
      "cover_image_alt": "How to Optimize Your Website",
      "published": true,
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ]
}
```

#### Get Single Blog Post

**Endpoint:** `GET /api/blog/{projectId}/{slug}`

**Description:** Retrieves a specific blog post with full content using the post's slug.

**Headers:**

```bash
Authorization: Bearer your_api_key_here
```

**Example Request:**

```bash
curl -H "Authorization: Bearer your_api_key_here" \
    https://nextblog.ai/api/blog/project_123/how-to-optimize-website
```

**Response:**

```json
{
  "project": {
    "id": "project_123",
    "name": "My Blog"
  },
  "blog": {
    "id": "blog_456",
    "title": "How to Optimize Your Website",
    "slug": "how-to-optimize-website",
    "description": "Learn the best practices for website optimization...",
    "markdown": "# How to Optimize Your Website\n\nThis is the full blog post content in markdown format...",
    "cover_image_url": "https://example.com/image.jpg",
    "published": true,
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
}
```

### Error Responses

The API returns standard HTTP status codes and error messages:

- **400 Bad Request:** Missing required parameters
- **401 Unauthorized:** Invalid or missing API key
- **404 Not Found:** Project or blog post not found
- **500 Internal Server Error:** Server error

### Rate Limits

API requests are limited to 1000 requests per hour per API key. If you exceed this limit, you'll receive a 429 Too Many Requests response.

## Post Management API

Optional, advanced API for creating and editing posts, changing status, and listing drafts or declined posts. Most users manage content in the NextBlog dashboard; use this when you need full control from your own backend.

Use the same project API key as the display API: `Authorization: Bearer your_api_key`. For embedding published posts on a website, prefer the [Blog Display API](/docs/endpoints.md) (`/api/blog/...`).

### Base URL

```bash
https://nextblog.ai/api/manage
```

### Status values

- `draft` — not shown on the public Blog Display API; editable.
- `approved` with `published: true` — included in the Blog Display API.
- `declined` — not shown on the Blog Display API.

When `status` is `approved` (or you publish via `published: true`), a non-empty `slug` is required. Setting status or publishing through this API updates your NextBlog project data; it does not run the same external CMS publish steps as approving from the dashboard (e.g. WordPress sync). Use the dashboard for integrations that push to third-party platforms.

### Endpoints

#### List all posts (including drafts)

**Endpoint:** `GET /api/manage/{projectId}/posts`

**Query (optional):** `status` (`draft`, `approved`, `declined`), `published` (`true` / `false`), `limit`.

**Example:**

```bash
curl -H "Authorization: Bearer your_api_key_here" \
  "https://nextblog.ai/api/manage/project_123/posts?status=draft"
```

#### Create a post

**Endpoint:** `POST /api/manage/{projectId}/posts`

**Body (JSON):** required `title`, `markdown`. Optional: `slug`, `description`, `cover_image_url`, `cover_image_alt`, `published`, `status`. New posts default to draft unless you set status or published.

```bash
curl -X POST -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"title":"My post","markdown":"# Hello","status":"draft"}' \
  https://nextblog.ai/api/manage/project_123/posts
```

#### Get one post by ID

**Endpoint:** `GET /api/manage/{projectId}/posts/{postId}`

Returns full fields including `markdown` for drafts and declined posts.

```bash
curl -H "Authorization: Bearer your_api_key_here" \
  https://nextblog.ai/api/manage/project_123/posts/blog_uuid
```

#### Update a post (content or status)

**Endpoint:** `PATCH /api/manage/{projectId}/posts/{postId}`

**Body (JSON):** any of `title`, `markdown`, `slug`, `description`, `cover_image_url`, `cover_image_alt`, `published`, `status`. Send only fields you want to change.

```bash
curl -X PATCH -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"status":"approved","slug":"my-post-slug"}' \
  https://nextblog.ai/api/manage/project_123/posts/blog_uuid
```

### Errors

- **400** — validation (e.g. missing slug when approving)
- **401** — missing or invalid API key
- **404** — post not found or not in this project
- **409** — duplicate slug (when applicable)
- **500** — server error

## Webhooks

Webhooks allow you to receive real-time notifications when blog posts are approved or published. This enables you to integrate NextBlog with your custom applications and workflows.

**Looking for detailed webhooks integration guide?** See our [Webhooks Integration](/docs/integration-webhooks.md) page for step-by-step setup instructions, examples, and best practices.

### Setting Up Webhooks

To configure webhooks for your project:

1. Navigate to your project settings
2. Scroll to the "Webhooks" section
3. Enter your webhook URL (e.g., https://your-server.com/webhook)
4. Save your changes

### Webhook Events

Webhooks are triggered for the following events:

- **approved:** When a blog post is approved and published

### Webhook Payload

When a webhook is triggered, a POST request is sent to your webhook URL with the following payload:

```json
{
  "event": "approved",
  "timestamp": "2024-01-01T12:00:00Z",
  "blog": {
    "id": "blog_123",
    "title": "How to Optimize Your Website",
    "slug": "how-to-optimize-website",
    "description": "Learn the best practices...",
    "markdown": "# How to Optimize Your Website\n\n...",
    "cover_image_url": "https://example.com/image.jpg",
    "cover_image_alt": "Website optimization",
    "published": true,
    "status": "approved",
    "created_at": "2024-01-01T10:00:00Z",
    "updated_at": "2024-01-01T12:00:00Z",
    "project_id": "project_456"
  }
}
```

### Webhook Headers

Each webhook request includes the following headers:

```bash
Content-Type: application/json
User-Agent: NextBlog-Webhook/1.0
```

### Error Handling

If your webhook endpoint returns an error or is unreachable, NextBlog will automatically retry once. Failed webhooks are logged but do not prevent the blog post from being published.

### Security Best Practices

- Use HTTPS for your webhook URLs
- Validate the webhook payload on your server
- Implement rate limiting on your webhook endpoint
- Verify the event type before processing

### Example Webhook Handler

Here's an example webhook handler in Node.js:

```javascript
// Express.js webhook handler
app.post('/webhook', express.json(), (req, res) => {
  const { event, blog } = req.body;

  if (event === 'approved') {
    console.log('Blog post approved:', blog.title);
    // Process the approved blog post
    // e.g., sync to another CMS, send notifications, etc.
  }

  res.status(200).json({ received: true });
});
```

## Frequently Asked Questions

### FAQ

### How does the AI content generation work?

Our AI uses advanced language models trained on high-quality content to generate relevant, engaging blog posts. You provide keywords, topics, and preferences, and our AI creates unique content tailored to your needs.

### Is the generated content unique?

Yes, all generated content is unique and original. Our AI creates fresh content for each request, ensuring no duplicate content issues.

### Can I edit the generated content?

Absolutely! You have full control over the generated content. You can edit, modify, or completely rewrite any part of the content to match your voice and style.

### What SEO features are included?

We include comprehensive SEO features:
- Keyword optimization and natural keyword placement
- Automatic meta description generation
- Proper heading structure (H1, H2, H3)
- **Automatic internal linking** - Links to related posts are added automatically
- **Backlink Network** - Optionally receive contextual backlinks from other real sites in the network
- SEO-friendly URL slugs
- Image alt text optimization
- Content length optimization (2000-3000 words)

### How does the approve/decline workflow work?

When auto-generate is enabled but auto-publish is disabled, all generated posts are created as "draft" status. You can:
- Review each post in your dashboard
- Approve posts to publish them (triggers all enabled integrations and webhooks)
- Decline posts you don't want to publish
- Edit posts before approving

This gives you full control over what gets published while still benefiting from automated content generation.

### Can I use WordPress with NextBlog?

Yes! NextBlog has full WordPress CMS integration. Simply:
1. Enable WordPress integration in your project settings
2. Enter your WordPress site URL, username, and Application Password
3. Test the connection
4. When you approve a blog post, it will automatically publish to WordPress

The integration converts markdown to HTML, uploads featured images, and publishes posts with proper formatting.

### What is internal linking automation?

Internal linking automation automatically adds relevant links to your existing blog posts within new articles. This:
- Improves SEO by creating a better site structure
- Increases user engagement and time on site
- Helps search engines discover and index your content
- Distributes page authority throughout your site

The system intelligently matches keywords and phrases in new posts with relevant existing content, adding up to 5 internal links per post.

### What is the Backlink Network?

The Backlink Network is a free, opt-out feature that helps your site earn real backlinks without outreach:

- It's enabled per project by default. You can turn it off anytime in your project settings.
- When enabled, each generated article can naturally include one contextual link to another real website in the network.
- In return, your Website URL can be promoted the same way inside other members' generated articles.
- Placements are relevance-scored per article, so mentions stay natural and contextual.
- Projects only receive backlinks while their subscription is active (free trials included). Once a subscription lapses, the project stops receiving new backlinks.
- Links received and given are tracked in your project settings.

Because links are only placed between topically relevant sites, the Backlink Network is designed to be editorial rather than a link scheme. No outreach, no buying links.

### Which platforms can I integrate with?

NextBlog supports 9 platform integrations:
- [WordPress](/docs/integration-wordpress.md) - Auto-publish to WordPress sites
- [Notion](/docs/integration-notion.md) - Sync to Notion databases
- [Shopify](/docs/integration-shopify.md) - Publish to Shopify blogs
- [Wix](/docs/integration-wix.md) - Publish to Wix blogs
- [Webflow](/docs/integration-webflow.md) - Push to Webflow CMS
- [Ghost](/docs/integration-ghost.md) - Native markdown publishing to Ghost
- [Framer](/docs/integration-framer.md) - Publish to Framer CMS
- [REST API](/docs/integration-rest-api.md) - Fetch posts programmatically
- [Webhooks](/docs/integration-webhooks.md) - Real-time notifications for custom integrations

Each integration has detailed setup guides. Visit our [Integrations section](/docs/integrations.md) for step-by-step instructions.

### How do I get API credentials for integrations?

Each platform has its own process for generating API credentials:
- **WordPress:** Create an Application Password in Users → Profile → Application Passwords
- **Notion:** Create an integration at [notion.so/my-integrations](https://www.notion.so/my-integrations)
- **Shopify:** Create a custom app in Apps → Develop apps
- **Wix:** Generate an API key at [manage.wix.com/account/api-keys](https://manage.wix.com/account/api-keys)
- **Webflow:** Generate an API token in Account Settings → API Access
- **Ghost:** Create a custom integration in Settings → Integrations
- **Framer:** Generate an API token in your project's CMS settings

For detailed, step-by-step instructions with screenshots, see our [Integration Guides](/docs/integrations.md).

### Can I use multiple integrations at once?

Yes! You can enable multiple integrations simultaneously. When you approve a blog post, it will be automatically published to all enabled integrations at the same time.

For example, you could:
- Publish to WordPress for your main website
- Sync to Notion for team collaboration
- Send webhooks to trigger custom workflows
- All happening automatically when you approve a post!

### What happens if an integration fails?

If an integration fails to publish a post:
- The post will still be approved and published in NextBlog
- You'll see an error message in your dashboard
- Other integrations will still work normally
- You can retry publishing by re-approving the post

Common causes of failures include:
- Invalid or expired API credentials
- Network connectivity issues
- Platform-specific errors (e.g., missing required fields)

Check the integration's troubleshooting section in our [Integration Guides](/docs/integrations.md) for specific solutions.

### Do you support [X] platform?

We currently support WordPress, Notion, Shopify, Wix, Webflow, Ghost, Framer, REST API, and Webhooks. If you need a platform that's not listed, we'd love to hear from you!

You can:
- Use our [REST API](/docs/integration-rest-api.md) to build a custom integration
- Use [Webhooks](/docs/integration-webhooks.md) to connect to any platform that accepts HTTP POST requests
- Contact us to request a new integration - we're always adding new platforms based on user demand

### How much does NextBlog cost?

We offer various pricing plans to suit different needs. Visit our [pricing page](https://nextblog.ai/pricing) for detailed information about our plans and features.
