> ## Documentation Index
> Fetch the complete documentation index at: https://gigareels.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Social Media Overview

> Automate your content distribution across TikTok, Instagram, and Facebook

# Social Media Integration

GigaReels provides seamless integration with major social media platforms, allowing you to automatically upload your generated content to TikTok, Instagram, and Facebook with full customization and control.

## Supported Platforms

> [card] [TikTok](https://gigareels.mintlify.site/social-media/tiktok)
>
> Videos and photos with privacy controls, comments, and engagement settings

> [card] [Instagram](https://gigareels.mintlify.site/social-media/instagram)
>
> Reels, Stories, and feed posts with advanced customization

> [card] [Facebook](https://gigareels.mintlify.site/social-media/facebook)
>
> Page posts with scheduling and visibility controls

## How It Works

The GigaReels social media integration follows a simple, secure flow:

**1. Connect Accounts**

Users visit a secure connection URL to link their social media accounts

**2. Generate Content**

Create videos using any GigaReels render type

**3. Upload Automatically**

Use the SDK to upload content to connected platforms with custom settings

## Quick Start

### 1. Connect Social Media Accounts

```javascript theme={null}
import { GigaReels } from "@gigareels/sdk";

const client = new GigaReels("your-api-key");

// Get connection URL for your users
const { access_url } = await client.socialMedia.connect();
console.log("Visit this URL to connect accounts:", access_url);
```

The user visits the URL, connects their accounts, and they're automatically synced to your GigaReels integration.

### 2. Generate and Upload Content

```javascript theme={null}
// Generate a video
const task = await client.templates.brainrot.educational({
	prompt: "Explain renewable energy benefits",
	characterPack: "rick-and-morty",
	backgroundVideoPack: "minecraft-parkour",
});

// Upload to multiple platforms
const uploadResult = await client.socialMedia.uploadToMultiplePlatforms({
	videoUrl: task.outputUrl,
	title: "🌱 Amazing renewable energy facts!",
	username: "user_12345", // Your authenticated user ID
	platforms: ["tiktok", "instagram"],
	tiktokOptions: {
		privacy_level: "PUBLIC_TO_EVERYONE",
		disable_comment: false,
	},
	instagramOptions: {
		media_type: "REELS",
		share_to_feed: true,
	},
});

console.log("Upload successful:", uploadResult);
```

## Key Features

> [accordion] 🔐 Secure Authentication
>
> * JWT-based secure token management
> * No password storage required
> * Automatic token refresh
> * User-controlled account connections

&#x20;

> [accordion] 🎯 Platform-Specific Options
>
> * **TikTok**: Privacy levels, comments, duets, stitch settings - **Instagram**: Media types
>   (Reels/Stories), feed sharing, user tags - **Facebook**: Page posting, visibility controls,
>   scheduling

&#x20;

> [accordion] 📊 Usage Tracking
>
> * Monitor upload quotas and limits - Track connected accounts status - View upload history and
>   analytics - Real-time usage statistics

> [accordion] 🚀 Developer Experience
>
> * Simple SDK methods for each platform
> * TypeScript support with full type safety
> * Comprehensive error handling
> * Webhook support for async processing

## Upload Methods

### Multi-Platform Upload

Upload to multiple platforms simultaneously:

```javascript theme={null}
await client.socialMedia.uploadToMultiplePlatforms({
	videoUrl: "https://your-video.mp4",
	title: "Amazing content!",
	username: "user_12345",
	platforms: ["tiktok", "instagram", "facebook"],
	tiktokOptions: {
		privacy_level: "PUBLIC_TO_EVERYONE",
		disable_comment: false,
	},
	instagramOptions: {
		media_type: "REELS",
		share_to_feed: true,
	},
	facebookOptions: {
		facebook_page_id: "your-page-id",
		description: "Check out this amazing content!",
	},
});
```

### Platform-Specific Methods

Upload to individual platforms with platform-specific optimizations:

> [tab] TikTok
>
> ```javascript theme={null}
> await client.socialMedia.uploadToTikTok({
>   videoUrl: "https://your-video.mp4",
>   title: "My awesome TikTok video!",
>   username: "user_12345",
>   privacy_level: "PUBLIC_TO_EVERYONE",
>   disable_comment: false,
>   disable_duet: false,
>   disable_stitch: false
> });
> ```

> [tab] Instagram
>
> ```javascript theme={null}
> await client.socialMedia.uploadToInstagramReels({
>   videoUrl: "https://your-video.mp4",
>   title: "Amazing Instagram Reel!",
>   username: "user_12345",
>   share_to_feed: true,
>   audio_name: "trending_audio_track",
>   user_tags: "@friend1 @friend2"
> });
> ```

> [tab] Facebook
>
> ```javascript theme={null}
> await client.socialMedia.uploadToFacebook({
>   videoUrl: "https://your-video.mp4",
>   title: "Facebook video post",
>   username: "user_12345",
>   facebookPageId: "your-page-id",
>   description: "Check this out!",
>   video_state: "PUBLISHED"
> });
> ```

## Account Management

### Check Connection Status

```javascript theme={null}
// Get usage stats and connection status
const stats = await client.socialMedia.getUsageStats();
console.log("Connected platforms:", stats.connectedPlatforms);
console.log("Upload limits:", stats.limits);
console.log("Usage this month:", stats.usage);

// Get detailed account information
const accounts = await client.socialMedia.getConnectedAccounts();
console.log("Connected accounts:", accounts);
```

### Typical Response

```json theme={null}
{
	"connectedPlatforms": ["tiktok", "instagram"],
	"limits": {
		"tiktok": { "daily": 10, "monthly": 300 },
		"instagram": { "daily": 25, "monthly": 750 }
	},
	"usage": {
		"tiktok": { "today": 3, "thisMonth": 45 },
		"instagram": { "today": 8, "thisMonth": 156 }
	},
	"accounts": [
		{
			"platform": "tiktok",
			"username": "@myhandle",
			"connected": true,
			"lastSync": "2024-01-15T10:30:00Z"
		}
	]
}
```

## Content Optimization

### Platform-Specific Best Practices

> [tab] TikTok Optimization
>
> * **Video Length**: 15-60 seconds for maximum engagement
> * **Aspect Ratio**: 9:16 vertical format
> * **Captions**: Use trending hashtags and keywords
> * **Timing**: Post during peak hours (6-10 PM)
> * **Content**: Educational, entertaining, or trending topics

&#x20;

> [tab] Instagram Optimization
>
> * **Reels Length**: 15-30 seconds perform best - **Stories**: Use interactive stickers and polls -
>   **Hashtags**: 5-10 relevant hashtags - **User Tags**: Tag relevant accounts for reach - **Audio**:
>   Use trending audio tracks

> [tab] Facebook Optimization
>
> * **Video Length**: 1-3 minutes for better retention
> * **Descriptions**: Detailed, keyword-rich descriptions
> * **Scheduling**: Use optimal posting times
> * **Pages**: Post to business pages for better reach
> * **Engagement**: Encourage comments and shares

### Content Types by Platform

| Content Type | TikTok | Instagram | Facebook | Recommended Settings |
| - | - | - | - | - |
| **Educational Brainrot** | ✅ Excellent | ✅ Great for Reels | ⚠️ Longer form better | Use trending audio, add captions |
| **Breaking News** | ✅ Perfect | ✅ Great for Stories | ✅ Good for pages | Quick, punchy titles |
| **Text Messages** | ✅ Viral potential | ✅ Story format | ⚠️ May need context | Use dramatic music |
| **Reddit Stories** | ⚠️ Too long | ⚠️ Clips only | ✅ Full stories work | Break into parts |
| **Transform Videos** | ✅ Perfect | ✅ Great | ✅ Good | Maintain original context |

## Complete Workflow Example

Here's a complete example showing content generation and multi-platform distribution:

```javascript theme={null}
import { GigaReels } from "@gigareels/sdk";

async function createAndDistributeContent() {
	const client = new GigaReels("your-api-key");

	try {
		// 1. Generate educational content
		console.log("🎬 Generating video...");
		const videoTask = await client.templates.brainrot.educational({
			prompt: "Explain how cryptocurrency mining works and its environmental impact",
			characterPack: "rick-and-morty",
			backgroundVideoPack: "minecraft-parkour",
			enableGifs: true,
		});

		console.log("✅ Video generated:", videoTask.outputUrl);

		// 2. Create platform-specific variants
		const platforms = [
			{
				name: "TikTok",
				title: "🔥 Crypto mining explained! #cryptocurrency #education #rickandmorty",
				options: {
					privacy_level: "PUBLIC_TO_EVERYONE",
					disable_comment: false,
					is_aigc: true, // Mark as AI-generated
				},
			},
			{
				name: "Instagram",
				title: "Mind-blowing crypto facts! 🤯 #crypto #education #reels",
				options: {
					media_type: "REELS",
					share_to_feed: true,
					audio_name: "Educational Vibes",
				},
			},
		];

		// 3. Upload to multiple platforms
		console.log("📤 Uploading to platforms...");
		for (const platform of platforms) {
			const result = await client.socialMedia.uploadToMultiplePlatforms({
				videoUrl: videoTask.outputUrl,
				title: platform.title,
				username: "user_12345",
				platforms: [platform.name.toLowerCase()],
				[`${platform.name.toLowerCase()}Options`]: platform.options,
			});

			console.log(`✅ ${platform.name} upload:`, result.success);
		}

		// 4. Check updated usage stats
		const stats = await client.socialMedia.getUsageStats();
		console.log("📊 Updated usage:", stats.usage);
	} catch (error) {
		console.error("❌ Error:", error.message);
	}
}

createAndDistributeContent();
```

## Error Handling

```javascript theme={null}
import { GigaReels } from "@gigareels/sdk";

try {
	const result = await client.socialMedia.uploadToTikTok({
		videoUrl: "https://your-video.mp4",
		title: "My video",
		username: "user_12345",
	});
} catch (error) {
	switch (error.message) {
		case "Account not connected":
			console.log("User needs to connect their TikTok account");
			// Redirect to connection flow
			break;
		case "Upload quota exceeded":
			console.log("Daily upload limit reached");
			// Show quota information
			break;
		case "Invalid video format":
			console.log("Video format not supported");
			// Convert or re-generate video
			break;
		default:
			console.log("Upload failed:", error.message);
	}
}
```

## Rate Limits & Quotas

> [!WARNING]
>
> **Platform Limits**: Each social media platform has its own rate limits and quotas. GigaReels
> tracks these automatically and provides clear error messages when limits are reached.

### Typical Limits

| Platform | Daily Uploads | Monthly Uploads | Video Size Limit | Notes |
| - | - | - | - | - |
| **TikTok** | 10 videos | 300 videos | 500MB | Business accounts may have higher limits |
| **Instagram** | 25 videos | 750 videos | 100MB | Reels have separate limits from posts |
| **Facebook** | 50 videos | 1500 videos | 1GB | Page posting requires admin permissions |

## Next Steps

**1. Set Up Account Connection**

Implement the account connection flow for your users

**2. Choose Your Platforms**

Decide which platforms to target based on your audience

**3. Optimize Content**

Tailor your content generation for each platform's best practices

**4. Monitor Performance**

Track upload success rates and platform-specific analytics

Ready to start automating your social media? Check out the platform-specific guides or explore our [scheduling features](https://gigareels.mintlify.site/social-media/scheduling).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.