# How to Integrate Lovable with SocialBee

- Tool: Lovable
- Difficulty: Intermediate
- Time required: 30 minutes
- Last updated: March 2026

## TL;DR

To integrate SocialBee with Lovable, store your SocialBee API key in Cloud → Secrets and create an Edge Function that proxies calls to the SocialBee API. SocialBee's unique capability is content category management — posts are organized into categories that can be set to recycle automatically, publishing evergreen content repeatedly on a schedule. Unlike Sendible which focuses on agency multi-account management, SocialBee is built around the concept of categorized, recyclable content queues.

## Add category-based social media scheduling and evergreen content recycling to Lovable via SocialBee

SocialBee's defining feature is its category-based scheduling architecture. Rather than scheduling individual posts to a linear queue, SocialBee organizes content into categories — 'Educational', 'Promotional', 'Engagement', 'Behind the Scenes' — and schedules categories to post at specific time slots. When a category has posts, it publishes one at the scheduled slot. When a category is marked as recyclable, it starts over from the first post after the last one is published. This means evergreen content — tips, FAQs, product highlights — gets continuously recycled without any manual effort.

Lovable has no native SocialBee connector, so the integration flows through a server-side Edge Function. Your Lovable app submits post content with a target category, the Edge Function calls the SocialBee API to add the post to that category queue, and SocialBee handles all scheduling and recycling logic from there. This is particularly useful for content-heavy Lovable apps where users generate or submit content regularly — blog posts that need to be promoted on social media, testimonials that should be shared periodically, product updates that need to reach multiple social channels.

SocialBee's API provides endpoints for managing workspaces, profiles (connected social accounts), categories, and posts. The workspace ID and category ID are the key identifiers you need alongside the API key. This guide covers retrieving these IDs, storing credentials, and building an Edge Function that adds posts to the correct SocialBee category for automated scheduling and recycling.

## Before you start

- A Lovable project with Lovable Cloud enabled (Edge Functions require Lovable Cloud)
- A SocialBee account — plans start at $29/month with full API access (socialbee.com)
- Your SocialBee API key (SocialBee → Settings → Integrations → API Access)
- Your SocialBee Workspace ID and at least one Category ID (visible in the URL when viewing your workspace or category)
- At least one connected social profile in SocialBee and a posting schedule configured for your categories

## Step-by-step guide

### 1. Get your SocialBee API key, Workspace ID, and Category IDs

Gather the three key values from SocialBee: your API key, Workspace ID, and at least one Category ID.

To get your API key: log in to SocialBee and go to Settings (click the gear icon or your profile). Navigate to Integrations or API Access. Generate or copy your API key. Keep this value secure — it authenticates all API requests.

To find your Workspace ID: in SocialBee, your workspace is your main content area. The workspace ID appears in the URL when you are logged in — look for a numeric or alphanumeric ID in the path (e.g., app.socialbee.com/workspace/12345). Note this value.

To find Category IDs: in SocialBee, go to Content → Categories. Click on a category. The category ID appears in the URL when viewing or editing that category. Note the IDs for each category you want to use in your Lovable integration — typically you will have separate categories for different content types (Educational, Promotional, Engagement, Testimonials, etc.).

Alternatively, once you have your API key, you can call GET /api/v1/categories?workspace_id={id} to retrieve all categories with their IDs programmatically. This is useful if you want to show category options dynamically in your Lovable app rather than hardcoding them.

Have your API key, Workspace ID, and the IDs for your target categories ready before the next step.

**Expected result:** You have your SocialBee API key, Workspace ID, and the IDs for your target categories ready to store as secrets.

### 2. Add SocialBee credentials to Lovable Cloud Secrets

Store your SocialBee credentials in Lovable's Cloud Secrets panel. In your Lovable project, click the '+' icon at the top of the editor to open the Cloud panel. Click the 'Secrets' tab and add the following secrets.

First secret — Name: SOCIALBEE_API_KEY, Value: your SocialBee API key. This authenticates all API requests via the Authorization header as 'Bearer {api_key}'.

Second secret — Name: SOCIALBEE_WORKSPACE_ID, Value: your numeric or alphanumeric workspace ID. This is required for most API calls to identify which workspace the operation targets.

Optional category secrets — if you have specific default categories, store them as: SOCIALBEE_CATEGORY_EDUCATIONAL_ID, SOCIALBEE_CATEGORY_PROMOTIONAL_ID, etc. Storing category IDs as secrets lets you reroute post submissions to different categories by changing a secret value without code changes.

SocialBee uses standard Bearer token authentication: Authorization: Bearer {api_key}. This is the same pattern as many other modern REST APIs and is straightforward to implement in the Edge Function.

**Expected result:** SOCIALBEE_API_KEY and SOCIALBEE_WORKSPACE_ID appear in Cloud → Secrets with values masked, plus any category ID secrets you added.

### 3. Create the SocialBee post management Edge Function

Create the Edge Function that adds posts to SocialBee categories and retrieves available categories. SocialBee's API base URL is https://app.socialbee.com/api/v1 and uses Bearer token authentication.

For adding a post, the endpoint is POST /api/v1/posts. The request body (JSON) requires workspace_id, category_id, and the post content. Content is provided as an array of profile_posts — one for each social network type — or as a single unified content object. Each post can have text, media_url, and link fields. SocialBee automatically adapts the content for each connected social account in the category's assigned profiles.

For retrieving categories, the endpoint is GET /api/v1/categories with workspace_id as a query parameter. This returns all categories with their IDs, names, types, and whether recycling is enabled.

SocialBee's post status follows a lifecycle: draft → pending → published → (if recyclable) returned to pending. When you add a post via the API, it enters the category queue as pending and will be published at the next scheduled slot for that category.

The Edge Function handles both the post creation (action='add-post') and category retrieval (action='get-categories') operations.

```
import { serve } from 'https://deno.land/std@0.168.0/http/server.ts'

const corsHeaders = {
  'Access-Control-Allow-Origin': '*',
  'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
}

const BASE = 'https://app.socialbee.com/api/v1'

serve(async (req) => {
  if (req.method === 'OPTIONS') {
    return new Response('ok', { headers: corsHeaders })
  }

  try {
    const body = await req.json()
    const { action } = body

    const apiKey = Deno.env.get('SOCIALBEE_API_KEY')
    const workspaceId = Deno.env.get('SOCIALBEE_WORKSPACE_ID')

    if (!apiKey || !workspaceId) {
      throw new Error('Missing required secrets: SOCIALBEE_API_KEY and SOCIALBEE_WORKSPACE_ID')
    }

    const headers = {
      Authorization: `Bearer ${apiKey}`,
      'Content-Type': 'application/json',
    }

    if (action === 'get-categories') {
      const res = await fetch(`${BASE}/categories?workspace_id=${workspaceId}`, { headers })
      if (!res.ok) {
        const err = await res.json().catch(() => ({}))
        throw new Error(`SocialBee categories error ${res.status}: ${JSON.stringify(err)}`)
      }
      const data = await res.json()
      const categories = (data.data || data || []).map((c: Record<string, unknown>) => ({
        id: c.id,
        name: c.name,
        recyclable: c.recycle || false,
      }))
      return new Response(
        JSON.stringify({ success: true, categories }),
        { headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
      )
    }

    if (action === 'add-post') {
      const { message, categoryId, imageUrl = '', link = '' } = body
      if (!message) throw new Error('message is required')
      if (!categoryId) throw new Error('categoryId is required')

      const postPayload: Record<string, unknown> = {
        workspace_id: workspaceId,
        category_id: categoryId,
        content: [
          {
            text: message,
            ...(imageUrl ? { media_urls: [imageUrl] } : {}),
            ...(link ? { link } : {}),
          },
        ],
      }

      const res = await fetch(`${BASE}/posts`, {
        method: 'POST',
        headers,
        body: JSON.stringify(postPayload),
      })

      const data = await res.json().catch(() => ({}))
      if (!res.ok) {
        throw new Error(`SocialBee add-post error ${res.status}: ${JSON.stringify(data)}`)
      }

      return new Response(
        JSON.stringify({ success: true, postId: data.data?.id || data.id || null, message: 'Post added to category queue' }),
        { headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
      )
    }

    throw new Error(`Unknown action: ${action}. Use 'add-post' or 'get-categories'.`)
  } catch (error) {
    return new Response(
      JSON.stringify({ error: error.message }),
      { status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
    )
  }
})
```

**Expected result:** The socialbee-content Edge Function is deployed. Test get-categories to verify your API key and workspace ID work. Test add-post with a test message and category ID — verify the post appears in SocialBee's category queue.

### 4. Build the content submission form in your Lovable app

With the Edge Function deployed, build the content submission interface. The form fetches available SocialBee categories on mount and displays them as a dropdown or radio button group. When a user submits content, the form calls the Edge Function to add the post to the selected category.

For team-based content workflows, consider showing the number of posts currently queued in each category — categories with full queues don't need new posts added, while low-queue categories are a priority. You can retrieve this queue count data from the SocialBee API's category endpoint which includes queue statistics.

Recyclable categories (those set to repeat after the last post is published) are the most valuable categories to fill with high-quality evergreen content. In your UI, mark recyclable categories distinctly — for example, show a recycle icon — so content creators know which posts will be reused vs published once.

When the form submits successfully, show which category the post was added to and remind the user about the category's posting schedule. This helps content creators understand when their post will actually be published and sets realistic expectations.

```
import { useState, useEffect } from 'react'
import { supabase } from '@/lib/supabase'
import { Button } from '@/components/ui/button'
import { Textarea } from '@/components/ui/textarea'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@/components/ui/select'
import { toast } from '@/components/ui/use-toast'

interface Category { id: string; name: string; recyclable: boolean }

export const SocialBeeSubmit = () => {
  const [message, setMessage] = useState('')
  const [imageUrl, setImageUrl] = useState('')
  const [categories, setCategories] = useState<Category[]>([])
  const [categoryId, setCategoryId] = useState('')
  const [loading, setLoading] = useState(false)

  useEffect(() => {
    supabase.functions.invoke('socialbee-content', { body: { action: 'get-categories' } })
      .then(({ data }) => {
        setCategories(data?.categories || [])
        if (data?.categories?.length > 0) setCategoryId(data.categories[0].id)
      })
      .catch(() => toast({ title: 'Could not load categories', variant: 'destructive' }))
  }, [])

  const selectedCategory = categories.find((c) => c.id === categoryId)

  const handleSubmit = async (e: React.FormEvent) => {
    e.preventDefault()
    setLoading(true)
    try {
      const { error } = await supabase.functions.invoke('socialbee-content', {
        body: { action: 'add-post', message, categoryId, imageUrl },
      })
      if (error) throw error
      toast({ title: `Added to ${selectedCategory?.name || 'category'} queue!` })
      setMessage('')
      setImageUrl('')
    } catch (err) {
      toast({ title: 'Could not add post', variant: 'destructive' })
    } finally {
      setLoading(false)
    }
  }

  return (
    <form onSubmit={handleSubmit} className="space-y-4 max-w-lg">
      <div>
        <Label>Content Category</Label>
        <Select value={categoryId} onValueChange={setCategoryId}>
          <SelectTrigger><SelectValue placeholder="Select a category" /></SelectTrigger>
          <SelectContent>
            {categories.map((c) => (
              <SelectItem key={c.id} value={c.id}>
                {c.recyclable ? '♻ ' : ''}{c.name}
              </SelectItem>
            ))}
          </SelectContent>
        </Select>
      </div>
      <div>
        <Label>Post Message *</Label>
        <Textarea value={message} onChange={(e) => setMessage(e.target.value)} placeholder="Write your social media post..." rows={4} required />
      </div>
      <div>
        <Label>Image URL (optional)</Label>
        <Input value={imageUrl} onChange={(e) => setImageUrl(e.target.value)} placeholder="https://..." />
      </div>
      <Button type="submit" disabled={loading || !categoryId}>
        {loading ? 'Adding...' : 'Add to Queue'}
      </Button>
    </form>
  )
}
```

**Expected result:** The content submission form loads with a dropdown of your SocialBee categories. When a user submits a post, it appears in the selected category's queue in SocialBee and will publish at the next scheduled slot for that category.

## Best practices

- Always configure posting schedules in SocialBee before adding posts via the API — posts added to a category with no schedule will sit in the queue indefinitely without being published.
- Use SocialBee's recyclable category setting for evergreen content — tips, testimonials, product highlights — so this content continues to reach new followers without manual re-adding.
- Fetch categories dynamically via the get-categories action rather than hardcoding category IDs, so your Lovable app automatically reflects any category changes made in the SocialBee interface.
- Store the workspace ID and default category IDs as secrets rather than hardcoding them so you can switch between SocialBee workspaces or update category routing without code changes.
- For content that should only post once (time-sensitive announcements, one-time promotions), add it to a non-recyclable category specifically designated for time-sensitive content.
- Validate post content length before calling the Edge Function — different social networks have different character limits, and SocialBee may truncate or reject posts that exceed platform-specific limits.
- Consider storing post IDs returned by SocialBee in your Supabase database for tracking — this lets you later retrieve post performance analytics via the SocialBee API by referencing the stored IDs.

## Use cases

### Add blog post social snippets to a SocialBee promotion category automatically

When a user publishes a new blog post in your Lovable app, automatically add promotional social media snippets to a SocialBee 'Blog Promotion' category. SocialBee distributes these posts across your connected social accounts according to the category's schedule. The blog post gets promoted on social media without any manual social scheduling step.

Prompt example:

```
Create an Edge Function called socialbee-add-post that accepts { message, categoryId, imageUrl, link } and adds the post to a SocialBee category. Use SOCIALBEE_API_KEY and SOCIALBEE_WORKSPACE_ID from secrets. Call the SocialBee API POST /api/v1/posts endpoint. Include the image and link if provided. Return the created post ID or error details.
```

### Build a content submission form that routes posts to SocialBee categories

Create a content submission interface in Lovable where team members write social media posts and select a target category (Educational, Promotional, Engagement). The Edge Function adds the post to the appropriate SocialBee category. Each category has its own posting schedule, so routing to the right category ensures the post gets published at the right frequency and time of day.

Prompt example:

```
Create a social media content submission form with a message field, category dropdown (populated from SocialBee categories via the API), and optional image URL. When submitted, call socialbee-add-post with the selected category ID. Show a success message with the category name and estimated next publish time. Let team members see a count of posts queued in each category.
```

### Recycle evergreen product testimonials across social channels via SocialBee

When a user submits a positive testimonial or review in your Lovable app, add it as a social post to a SocialBee 'Customer Success' category set to recycle. SocialBee continuously reposts the testimonial across your social channels on its schedule, keeping social proof visible to new followers without any ongoing manual effort.

Prompt example:

```
After a user submits a testimonial with a 5-star rating in my app, format it as a social media post and add it to SocialBee category SOCIALBEE_TESTIMONIALS_CATEGORY_ID from secrets. The post should include the testimonial text, the customer's first name, and a star rating emoji. Call socialbee-add-post in the background after saving the testimonial to Supabase.
```

## Troubleshooting

### SocialBee API returns 401 Unauthorized for all requests

Cause: The SOCIALBEE_API_KEY is incorrect or the Authorization header format is wrong. SocialBee uses Bearer token authentication: Authorization: Bearer {api_key}.

Solution: Go to SocialBee → Settings → Integrations → API Access and copy the current API key. Update SOCIALBEE_API_KEY in Cloud → Secrets and trigger a redeployment. Verify the Edge Function constructs the header as: Authorization: `Bearer ${apiKey}` with a capital B and a space between Bearer and the key.

### Posts are added to the category but never get published to social media

Cause: The SocialBee category does not have a posting schedule configured, or none of the connected social profiles are assigned to that category.

Solution: In SocialBee, go to Content → Categories → click on the category → Schedule. Verify at least one time slot is configured for each day you want posts to go out. Also check that social profiles (connected social accounts) are assigned to the category — go to the category settings and confirm which profiles are included in the posting queue.

### Edge Function returns 'workspace not found' or 404 errors

Cause: The SOCIALBEE_WORKSPACE_ID is incorrect. Workspace IDs are not always visible in the SocialBee interface — they may need to be retrieved via the API.

Solution: Call GET https://app.socialbee.com/api/v1/workspaces with your API key as a Bearer token to retrieve your workspace ID. Update SOCIALBEE_WORKSPACE_ID in Cloud → Secrets with the correct value from the API response.

### Categories are listed by get-categories but the wrong number of posts are shown

Cause: SocialBee's API response structure may wrap the categories array in a 'data' property. The Edge Function normalizes this, but if you are processing the raw response elsewhere, the structure may differ.

Solution: Always access categories as data.categories from the Edge Function response (which normalizes the data), rather than accessing the raw SocialBee API response format directly. The Edge Function extracts the array from data.data or data depending on the API response structure.

## Frequently asked questions

### What is content category recycling in SocialBee and why does it matter for a Lovable app?

Content recycling in SocialBee means that when a category runs out of posts, it starts over from the beginning — continuously republishing the same evergreen content on a rotating schedule. For a Lovable app, this means you can add a collection of evergreen posts (tips, FAQs, testimonials, product highlights) to a recyclable category once, and SocialBee will keep promoting them indefinitely without any ongoing manual effort. It is one of the most time-efficient features in social media marketing.

### How does SocialBee compare to Sendible for a Lovable integration?

SocialBee and Sendible both schedule social media posts, but with different primary focuses. SocialBee is built around content categories and evergreen recycling — the right tool when you have a library of reusable content. Sendible is built for agencies managing multiple client accounts with white-label capabilities — the right tool when your Lovable app manages social media for multiple businesses. For a single brand with lots of evergreen content, SocialBee is better. For a multi-client agency tool, Sendible is more appropriate.

### Does SocialBee support image and video uploads via the API?

SocialBee's API supports passing image URLs (media_urls field in the content payload) for posts. For video content, you typically upload the video to cloud storage first (Lovable Cloud Storage or AWS S3) and pass the public URL to SocialBee. Direct video file upload via the API may require multipart form upload — check the current SocialBee API documentation for the latest supported media upload methods.

### What social networks does SocialBee support?

SocialBee supports Facebook (profiles, pages, groups), Twitter/X, Instagram (business accounts), LinkedIn (profiles and company pages), Google My Business, Pinterest, and TikTok on higher plans. The available networks depend on your SocialBee plan tier. Each connected social account is assigned to categories, and SocialBee publishes category posts to all assigned accounts at the scheduled time.

### Can I retrieve analytics data about my SocialBee posts from Lovable?

SocialBee's API includes endpoints for retrieving post performance data including engagement metrics. You can call GET /api/v1/posts/{postId}/analytics to get metrics for a specific post if you stored the post ID from the creation response. For aggregate analytics, SocialBee's dashboard is more practical than building an analytics page in Lovable. Use the API for displaying post-level performance data in context with your app's content.

---

Source: https://www.rapidevelopers.com/lovable-integration/socialbee
© RapidDev — https://www.rapidevelopers.com/lovable-integration/socialbee
