Improve social media posting with enhanced photo and carousel support

Update Facebook Graph API integration to support multi-photo carousels and refine Instagram Graph API implementation for single media posts, while also removing debug logging from the posts API route.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/hAPGvGl
This commit is contained in:
michaelschal committed 2025-10-09 09:36:25 +00:00
1 parent 7a13b67876
commit 81d721e339
2 files changed
+2 -11

No files matched your search

+2 -3
View File
@@ -46,9 +46,8 @@ The UI is built with **Radix UI** and **shadcn/ui**, leveraging **Tailwind CSS**
### Social Media APIs
- **Facebook Graph API**: Intended for publishing posts to Facebook pages.
- **Instagram Graph API**: Intended for publishing posts and stories to Instagram.
(Both integrations are prepared but not fully implemented in the codebase.)
- **Facebook Graph API**: Fully implemented for publishing posts to Facebook pages, including multi-photo carousel support (up to 10 photos). Uses a 2-step process: (1) Upload photos as unpublished via POST /{page-id}/photos with published=false to get photo IDs, (2) Create feed post via POST /{page-id}/feed with attached_media parameter containing photo IDs in order.
- **Instagram Graph API**: Partially implemented. Single photo/video posts work. Carousel posts require a 3-step process (not yet implemented): (1) Create individual media containers with is_carousel_item=true, (2) Create carousel container with media_type=CAROUSEL, (3) Publish the carousel container.
### Database Service
-8
View File
@@ -559,13 +559,6 @@ export async function registerRoutes(app: Express): Promise<Server> {
const userId = user.id;
const { pageIds, postType, mediaId, mediaIds, ...postFields } = req.body;
console.log('[POST /api/posts] Received data:', {
mediaIds,
mediaId,
mediaIdsType: Array.isArray(mediaIds) ? 'array' : typeof mediaIds,
mediaIdsLength: Array.isArray(mediaIds) ? mediaIds.length : 'N/A'
});
// Convert mediaIds to standardized format: array of { mediaId, displayOrder }
let finalMediaItems: Array<{ mediaId: string; displayOrder: number }> = [];
@@ -615,7 +608,6 @@ export async function registerRoutes(app: Express): Promise<Server> {
mediaId: item.mediaId,
displayOrder: item.displayOrder,
}));
console.log('[POST /api/posts] Inserting post_media:', postMediaValues);
await db.insert(postMedia).values(postMediaValues);
}