Solving the Content Creation Puzzle with an Embeddable Carousel Maker.
Published: 2024-04-22 11:12:48

![PostNitro Embed](https://i.imgur.com/srZLYpx.png)

As an indie hacker, you always look for ways to enhance your web application and provide a better user experience. What if I told you that you could easily integrate a powerful carousel maker into your platform, allowing your users to create stunning, engaging content without leaving your site? That's where [PostNitro's Embed](https://postnitro.ai/products/embed) feature comes in.

## Imagine this scenario

You've built a fantastic web app that helps businesses create and manage their social media presence. Your users love the functionality but constantly switch between your platform and external design tools to create eye-catching carousel posts. It's a hassle, and it disrupts their workflow.

That's where PostNitro's Embed comes to the rescue. With just a few lines of code, you can seamlessly integrate our state-of-the-art carousel maker into your web app. Users can create professional-looking carousels directly within your platform, saving time and effort.

## So, why is this a game-changer for your web app? Here are a few reasons

**1. Enhanced User Experience:** By providing an integrated carousel creation tool, you eliminate the need for users to navigate away from your platform. They can create, edit, and manage their carousels in one place, leading to a smoother and more efficient workflow.

**2. Increased Engagement:** Carousels are a highly engaging form of content on social media platforms. Empowering your users to create captivating carousels directly within your app will help capture their audience's attention and drive more engagement.

**3. Competitive Advantage:** Integrating PostNitro's Embed feature sets your web app apart. It demonstrates your commitment to providing a comprehensive solution that caters to your users' needs, giving you a significant edge in the market.

## Setup

You might think,  "That sounds great, but is it complicated to set up?".
Absolutely not! PostNitro's Embed is designed with simplicity in mind. Here's a quick overview of how you can get started:

### Instal the package
First, install the PostNitro Embed package using the following command:

```bash
pnpm add @postnitro/embed
```

### Authenticate
Next, obtain an API key from your [PostNitro](https://postnitro.ai) account. Simply log in, navigate to the "Embed" section, whitelist the domains where you'll be using the Embed feature, and generate your API key.

### Initialize
Now, let's dive into the code. Here's an example of how you can initialize the PostNitro Embed editor in your application:

```typescript
import { createEditor, ExportData } from "@postnitro/embed";

const editor = createEditor({
  apiKey: "your-api-key",
});
```

With the editor initialized, you can easily allow your users to create new carousels or edit existing ones. To create a new carousel, call the `createDesign` method and provide a callback function to handle the exported data:

```typescript
editor.createDesign((data: ExportData) => {
  console.log(data);
  // Save or display the carousel data as needed
});
```

To edit an existing carousel, use the `editDesign` method and provide the carousel ID along with a callback function:

```typescript
editor.editDesign('your-carousel-id', (data: ExportData) => {
  console.log(data);
  // Update the existing carousel with the new data
});
```

### Exported data
The exported data includes the carousel ID, name, size, PDF file, and an array of image files. You can use this data to save the carousel, display it in your application, or perform any other necessary operations.

```typescript
interface ExportData {
    id: string; // Unique identifier for the carousel
    name: string; // Name of the carousel
    size: string; // Size of the carousel in aspect ratio (e.g., "16:9")
    pdf: Blob; // PDF file of the carousel
    images: Blob[]; // Array of image files for the carousel
}
```

## Example

Here's a complete example of how you can integrate PostNitro Embed into a Next.js/React application:

```tsx
'use client'
import { createEditor, ExportData } from "@postnitro/embed";

export default function Example() {
  const editor = createEditor({
    apiKey: "your-api-key",
  });

  const handleCreateCarousel = () => {
    editor.createDesign((data: ExportData) => {
      console.log("New carousel created:", data);
      // Save or display the carousel data as needed
    });
  };

  const handleEditCarousel = () => {
    const carouselId = "your-carousel-id";
    editor.editDesign(carouselId, (data: ExportData) => {
      console.log("Carousel edited:", data);
      // Update the existing carousel with the new data
    });
  };

  return (
    <div>
      <button onClick={handleCreateCarousel}>Create Carousel</button>
      <button onClick={handleEditCarousel}>Edit Carousel</button>
    </div>
  );
}
```

## Conclusion

Integrating [PostNitro](https://postnitro.ai) Embed into your web application empowers users to create visually stunning carousels effortlessly. They can unleash their creativity, enhance their content, and engage their audience without leaving your platform.

But wait, there's more! PostNitro's Embed feature is entirely free to use. You heard that correctly – no hidden costs or complicated pricing plans. All you need is an API key, and you're ready.

So, what are you waiting for? Integrate PostNitro's Embed feature today to elevate your web app's functionality and give users the power to create stunning carousels effortlessly. Watch your user engagement soar.