How to Embed Social Posting in Your SaaS (Without Building OAuth)

6 min read

How to Embed Social Posting in Your SaaS (Without Building OAuth)

Building social media posting into your SaaS without a dedicated API means writing and maintaining OAuth flows for X, LinkedIn, Facebook, Instagram, YouTube, and TikTok separately. Each platform has different token expiry rules, rate limits, webhook formats, and API versions. A social posting API absorbs all of that complexity so your team ships the feature in days, not months. Here is how to integrate one properly.

#Why You Should Not Build OAuth From Scratch

Every major social platform uses OAuth 2.0, but the implementations diverge significantly.

LinkedIn tokens expire after 60 days and require a separate refresh flow. Facebook requires app review for certain permissions before you can post at scale. X switched to OAuth 2.0 with PKCE in 2022 but still maintains legacy OAuth 1.0a endpoints for some features. TikTok has a separate business API with its own approval process and rate limits.

Building this yourself means you are not writing code once. You are signing up to maintain six independent OAuth integrations across API versions that change without coordination. Instagram alone has deprecated three major API versions in four years.

Your users will see "reconnect your account" errors at the worst possible times. Debugging expired tokens across six platforms while shipping product features is not where your engineering hours should go.

A social posting API solves this by owning the OAuth layer entirely. Your users authorize once through the provider's hosted flow. Your backend sends post requests to a single endpoint. You never handle a platform token directly.

#What You Are Actually Building

A social posting API integration gives you:

  1. A hosted OAuth connection flow per platform
  2. A single REST endpoint for creating, scheduling, and deleting posts
  3. Webhook notifications for publish success and failure events
  4. Normalized analytics data pulled from each platform
  5. Media handling for images and videos

Your codebase stays clean. All platform-specific logic lives in the API provider's infrastructure.

#Step 1: Generate an API Key

Sign up and generate an API key. Store it in your environment, never in frontend code or version control.

 1SOCIAL_API_KEY=your_key_here
 2SOCIAL_API_BASE=https://api.schedulenchill.com/v1

#Step 2: Add a "Connect Social Account" Button

Your users need a way to connect their accounts. The API generates a short-lived authorization URL per platform. You redirect the user there, they authorize, the provider redirects back to your callback URL with a profile_id.

 1// Laravel controller
 2public function connectSocial(Request $request): RedirectResponse
 3{
 4    $response = Http::withToken(config('services.social_api.key'))
 5        ->post('/connections/create', [
 6            'platform' => $request->platform,
 7            'user_id' => $request->user()->id,
 8            'callback_url' => route('social.callback'),
 9        ]);
10
11    return redirect($response->json('auth_url'));
12}
13
14public function handleCallback(Request $request): RedirectResponse
15{
16    $profileId = $request->input('profile_id');
17
18    $request->user()->update(['social_profile_id' => $profileId]);
19
20    return redirect()->route('dashboard')->with('success', 'Account connected.');
21}

Store that profile_id against your user record. It is what you pass on every post request.

#Step 3: Post on Behalf of Your Users

With a profile_id, posting is a single API call from your backend:

 1public function publishPost(Post $post): void
 2{
 3    Http::withToken(config('services.social_api.key'))
 4        ->post('/posts', [
 5            'profile_ids' => [$post->user->social_profile_id],
 6            'text' => $post->content,
 7            'media_urls' => $post->media ?? [],
 8            'scheduled_at' => $post->scheduled_at?->toIso8601String(),
 9        ]);
10}

One endpoint. The provider handles token refresh, platform-specific rate limits, media formatting, and retry logic on transient failures.


Schedule & Chill's REST API handles OAuth, multi-platform posting, and webhooks from a single endpoint. Start your free trial.


#Step 4: Handle Webhooks for Post Status

Your users need to know when posts publish successfully or fail. Configure a webhook URL in your API dashboard and handle the events in your app:

 1// routes/api.php
 2Route::post('/webhooks/social', HandleSocialWebhook::class);
 1public function __invoke(Request $request): Response
 2{
 3    $event = $request->input('event');
 4    $externalId = $request->input('external_id');
 5
 6    match ($event) {
 7        'post.published' => $this->markPublished($externalId),
 8        'post.failed' => $this->notifyUser($externalId, $request->input('error')),
 9        'connection.expired' => $this->promptReconnect($request->input('profile_id')),
10        default => null,
11    };
12
13    return response()->noContent();
14}

The connection.expired event is important. Platforms revoke tokens on password changes and security events. Catch this and show the user a reconnect prompt the next time they log in, rather than silently failing their posts.

#Step 5: Surface Analytics

A social posting API normalizes analytics across platforms into a consistent format. Pull these on a schedule or on demand:

 1$analytics = Http::withToken(config('services.social_api.key'))
 2    ->get("/posts/{$externalPostId}/analytics")
 3    ->json();
 4
 5// Returns: impressions, reach, engagement_rate, clicks, shares

The normalization matters more than it sounds. LinkedIn, X, and Instagram each define "impressions" differently. Without normalization, you would need to write platform-specific logic to display comparable numbers to your users.

#What to Watch Out For

Per-platform rate limits. Even through an API, your posts are subject to each platform's limits. If your users post at high volume, check rate limit documentation before assuming posting is unlimited.

Video processing delays. Video uploads are async on most platforms. The API returns immediately with a pending status. You need webhooks or polling to know when the video post actually goes live. Do not tell users their video post is live until you receive the post.published event.

The reconnect flow is not optional. Tokens get revoked on user side actions (password change, revoking app access) that you cannot predict. Build a self-serve reconnect flow from day one, or you will have users with permanently broken posting and no way to fix it without engineering involvement.

Profile count and pricing. Social posting APIs price by connected profile. Model your expected user growth and platform connections before choosing a provider. What is $149/month at 10 users can become $299 or custom enterprise pricing at 100 users.

#The MCP Path for AI-Powered Products

If your SaaS includes AI features, an MCP (Model Context Protocol) server lets your agents post to social media as a native tool call, without writing HTTP client code.

Your agent calls create_post the same way it would call any other tool. The MCP server handles the request construction, authentication, and response parsing. For Claude-based features, n8n automations, or Make.com workflows, this simplifies the integration significantly.

Not all social posting APIs have an officially maintained MCP server. If AI is part of your product roadmap, confirm MCP support before committing to a provider.

#Frequently Asked Questions

How long does a social posting API integration take? A working prototype takes one to two days. A production-ready integration with webhooks, error handling, and a user reconnect flow takes about a week of engineering time.

Does my app need approval from each social platform? Your API provider handles platform app registrations. You may still need to submit for review on Facebook and TikTok before posting at scale through those platforms.

What happens when a social platform changes their API? The API provider absorbs the change. That is the core value. You do not modify your integration when Instagram or X updates their endpoints.

Can I test without connecting real social accounts? Most social posting APIs include sandbox mode that simulates posts without publishing live. Use this during development.

What is the difference between this and using Buffer or Hootsuite? Buffer and Hootsuite are products for end users to manage their own social media. A social posting API is infrastructure for developers to build social features inside their own products. Your users never see the provider; they just see your SaaS.

Zakir Hossen profile image

Zakir Hossen

Founder of Schedule & Chill. Bootstrapped entrepreneur and software engineer.

More posts from Zakir Hossen