workflows.fit
Back to n8n workflows
n8n templateFreeBy Jitesh Dugar

Publish Instagram carousel posts from product collections with Slack notification

Automate your entire Instagram carousel publishing pipeline from a single webhook call. This workflow receives a product collection payload, loops through each slide image, uploads every asset via Upload to URL to gen...

DevelopmentCore NodesCommunicationHITLUtilitySticky NoteWebhookCode
Loading interactive preview...

Template notes

Automate your entire Instagram carousel publishing pipeline from a single webhook call. This workflow receives a product collection payload, loops through each slide image, uploads every asset via Upload to URL to generate stable public CDN URLs, creates individual Instagram child media containers per slide, assembles them into a parent CAROUSEL container, and publishes the post. Built for product drops, lookbooks, and multi-item announcements.

---

What This Workflow Does

Intake and Validation - Webhook - Receive Payload -- accepts a POST request with your full collection data including slide array, caption copy, hashtags, and product details. Configured to respond inline once the full workflow completes. - Code - Validate Payload -- enforces Instagram's carousel constraints before touching any API. Checks that slides is an array of 2 to 10 items, every imageUrl is a publicly accessible HTTPS URL, and required environment variables are present. Automatically trims to 10 slides if the array exceeds the Instagram maximum. Fails fast with a descriptive error message. - Code - Build Caption -- assembles a structured, swipe-optimized caption: hook line, main copy block, numbered product list with optional prices, CTA line, and hashtag block. Safely truncated to Instagram's 2200 character limit.

Per-Slide Loop via Split In Batches - Split In Batches -- loops over the slides array one item at a time using batchSize 1. The loop branch feeds into image processing; the done branch feeds into carousel assembly once all slides are processed. - HTTP - Fetch Slide Image -- downloads each slide imageUrl as a binary file using n8n's file response format. Works with any publicly accessible image CDN. - Upload to URL -- mandatory CDN bridge. Instagram's child container endpoint requires a direct public HTTPS image URL per slide. It rejects binary payloads and base64 strings. This node uploads each image binary and returns a stable public URL. Runs once per slide inside the loop. - Code - Create Child Container -- calls the Instagram Graph API to create an individual child media container per slide with iscarouselitem set to true. Returns the child container ID for aggregation.

Carousel Assembly and Publishing - Code - Aggregate Child IDs -- collects all child container IDs produced across loop iterations using $input.all(). Joins them as a comma-separated string for the carousel parent API call. Re-attaches the caption and metadata from the earlier Code node via cross-node reference. - HTTP - Create Carousel Container -- POSTs to the Instagram Graph API /media endpoint with mediatype CAROUSEL and the full children ID string. Caption is set only on the parent container, not on individual children. - Wait 8s -- processing buffer before the publish call. Slightly longer than single-image posts to account for Instagram validating multiple child assets. - HTTP - Publish Carousel -- calls /mediapublish with the carousel container ID. Returns the live Instagram Post ID. - HTTP - Fetch Post Metadata -- retrieves the permalink, timestamp, and mediatype for the published post so the response payload contains the direct Instagram URL.

Notification and Response - Slack - Notify Team -- sends collection name, slide count, permalink, and publish timestamp to your configured Slack channel. - Respond to Webhook -- returns a structured JSON success payload with mediaId, permalink, slideCount, collectionName, and publishedAt timestamp.

---