Shopify Ecommerce to Social Media FB Insta Automation - n8n Workflow

Shopify Social Media Automation

Complete n8n Workflow Template for Daily Social Media Posts

Download Complete Workflow

Workflow Overview

This workflow automates social media marketing for your Shopify store with intelligent post generation and scheduling:

  • Smart Selection: Randomly selects 3 products and 3 collections daily
  • Platform Optimization: Creates platform-specific content for Facebook & Instagram
  • Time Distribution: Spreads 18 posts throughout optimal engagement hours
  • Error Handling: Built-in error recovery and notifications
  • Analytics: Tracks performance and generates daily reports

Shopify Ecommerce to Social Media FB Insta Automation - n8n Workflow by AI Knots


18
Total Posts Daily
9
Product Posts
9
Collection Posts
126
Posts Weekly

Prerequisites & Setup

Shopify Private App

Create private app in Shopify Admin

Enable read permissions for Products, Collections

Generate API access token

Facebook Business Suite

Facebook Business Account with connected Instagram

Required permissions: pages_manage_posts, instagram_basic

Long-lived access tokens

n8n Configuration

n8n instance (self-hosted or cloud)

Shopify node configured

Facebook Graph API node installed

1 Shopify Private App Setup

Go to Shopify Admin → Settings → Apps and sales channels → Develop apps → Create an app

Admin Permissions Required: - Products: Read access - Collections: Read access - Online Store: Read access (optional)
2 Configure Shopify Credentials in n8n
{ "name": "My Shopify Store", "type": "shopifyApi", "data": { "storeName": "your-store-name", "accessToken": "shpat_your_access_token_here" } }
3 Facebook App Configuration

Create Facebook App at developers.facebook.com → Add products: Facebook Login, Pages, Instagram

Required Permissions: - pages_manage_posts - pages_read_engagement - instagram_basic - instagram_content_publish

Workflow JSON Template

4 Complete Shopify Workflow JSON

Copy the entire JSON below and import into your n8n instance:

This workflow includes advanced features like error handling, analytics, and multi-day scheduling.
{ "name": "Shopify Daily Social Media Automation", "nodes": [ { "name": "Daily Trigger", "type": "n8n-nodes-base.scheduleTrigger", "position": [250, 300], "parameters": { "rule": { "interval": [{ "field": "days", "minutesInterval": 1440 }], "hour": 6, "minute": 0 } } }, { "name": "Shopify Credentials", "type": "n8n-nodes-base.shopify", "position": [450, 300], "parameters": { "authentication": "accessToken", "subdomain": "={{$credentials.shopify.storeName}}", "accessToken": "={{$credentials.shopify.accessToken}}", "apiVersion": "2024-01" } }, { "name": "Get 3 Random Products", "type": "n8n-nodes-base.shopify", "position": [650, 200], "parameters": { "resource": "product", "operation": "getAll", "limit": 250, "additionalFields": { "fields": "id,title,body_html,images,variants,handle,tags", "published_status": "published", "order": "random" } } }, { "name": "Get 3 Random Collections", "type": "n8n-nodes-base.shopify", "position": [650, 400], "parameters": { "resource": "customCollection", "operation": "getAll", "limit": 50, "additionalFields": { "fields": "id,title,body_html,image,handle,products_count", "published_status": "published", "order": "random" } } }, { "name": "Limit to 3 Products", "type": "n8n-nodes-base.limit", "position": [800, 200], "parameters": { "maxItems": 3, "keep": "first" } }, { "name": "Limit to 3 Collections", "type": "n8n-nodes-base.limit", "position": [800, 400], "parameters": { "maxItems": 3, "keep": "first" } }, { "name": "Generate Product Posts", "type": "n8n-nodes-base.code", "position": [1000, 200], "parameters": { "language": "javaScript", "code": "const product = items[0].json;\\nconst productUrl = \\`https://{{$credentials.shopify.storeName}}.myshopify.com/products/\\${product.handle}\\`;\\nconst price = product.variants && product.variants[0] ? \\`$${parseFloat(product.variants[0].price).toFixed(2)}\\` : 'Check price';\\nconst tags = product.tags ? product.tags.split(',').map(tag => \\`#\\${tag.trim().replace(/\\\\\\\\s+/g, '')}\\`).join(' ') : '';\\n\\nconst posts = [\\n {\\n platform: 'facebook',\\n content: \\`NEW ARRIVAL: \\${product.title.toUpperCase()}\\\\\\\\n\\\\\\\\n\\${product.body_html ? product.body_html.replace(/<[^>]*>/g, '').substring(0, 150) + '...' : 'Discover this amazing product!'}\\\\\\\\n\\\\\\\\nPrice: \\${price}\\\\\\\\n\\\\\\\\nShop Now: \\${productUrl}\\\\\\\\n\\\\\\\\n\\${tags || '#ShopifyStore #OnlineShopping'}\\`,\\n type: 'photo',\\n media_url: product.images && product.images[0] ? product.images[0].src : null,\\n product_id: product.id\\n },\\n {\\n platform: 'instagram',\\n content: \\`JUST DROPPED!\\\\\\\\n\\\\\\\\n\\${product.title}\\\\\\\\n\\\\\\\\nSwipe up/Link in bio to shop\\\\\\\\n\\\\\\\\n\\${price} \\\\n\\\\\\\\n\\${tags || '#Shop #Fashion #Lifestyle'}\\`,\\n type: 'photo',\\n media_url: product.images && product.images[1] ? product.images[1].src : product.images[0]?.src,\\n product_id: product.id\\n },\\n {\\n platform: 'facebook',\\n content: \\`WHY YOU'LL LOVE \\${product.title.toUpperCase()}:\\\\\\\\n\\\\\\\\nPerfect for everyday use\\\\\\\\nHighly rated by customers\\\\\\\\nLimited stock available\\\\\\\\n\\\\\\\\nGet yours: \\${productUrl}\\\\\\\\n\\\\\\\\n\\${tags || '#Deal #Sale #ShopSmall'}\\`,\\n type: 'photo',\\n media_url: product.images && product.images[2] ? product.images[2].src : product.images[0]?.src,\\n product_id: product.id\\n }\\n];\\nreturn posts.map(post => ({ json: post }));" } }, { "name": "Generate Collection Posts", "type": "n8n-nodes-base.code", "position": [1000, 400], "parameters": { "language": "javaScript", "code": "const collection = items[0].json;\\nconst collectionUrl = \\`https://{{$credentials.shopify.storeName}}.myshopify.com/collections/\\${collection.handle}\\`;\\n\\nconst posts = [\\n {\\n platform: 'facebook',\\n content: \\`EXPLORE OUR \\${collection.title.toUpperCase()} COLLECTION!\\\\\\\\n\\\\\\\\n\\${collection.products_count || 'Amazing'} products curated for you!\\\\\\\\n\\\\\\\\nBrowse now: \\${collectionUrl}\\\\\\\\n\\\\\\\\n#\\${collection.title.replace(/\\\\\\\\s+/g, '')}Collection #Shopify\\`,\\n type: 'photo',\\n media_url: collection.image ? collection.image.src : null,\\n collection_id: collection.id\\n },\\n {\\n platform: 'instagram',\\n content: \\`CURATED COLLECTION: \\${collection.title}\\\\\\\\n\\\\\\\\nDiscover \\${collection.products_count || 'amazing'} handpicked items!\\\\\\\\n\\\\\\\\nTap the link in bio to shop!\\\\\\\\n\\\\\\\\n#\\${collection.title.replace(/\\\\\\\\s+/g, '')} #ShopLocal #InstagramShop\\`,\\n type: 'carousel',\\n media_url: collection.image ? collection.image.src : null,\\n collection_id: collection.id\\n },\\n {\\n platform: 'facebook',\\n content: \\`YOUR \\${collection.title.toUpperCase()} DESTINATION\\\\\\\\n\\\\\\\\nEverything you need in one place!\\\\\\\\n\\\\\\\\nStart shopping: \\${collectionUrl}\\\\\\\\n\\\\\\\\n#ShopifyStore #\\${collection.title.replace(/\\\\\\\\s+/g, '')} #Shopping\\`,\\n type: 'photo',\\n media_url: collection.image ? collection.image.src : null,\\n collection_id: collection.id\\n }\\n];\\nreturn posts.map(post => ({ json: post }));" } }, { "name": "Combine & Schedule Posts", "type": "n8n-nodes-base.code", "position": [1200, 300], "parameters": { "language": "javaScript", "code": "const allPosts = items.map(item => item.json);\\nconst timeSlots = ['09:00', '10:30', '12:00', '13:30', '15:00', '16:30', '18:00', '19:30', '21:00'];\\nconst scheduledPosts = allPosts.map((post, index) => {\\n const dayOffset = Math.floor(index / 9);\\n const timeSlotIndex = index % 9;\\n const postTime = new Date();\\n postTime.setDate(postTime.getDate() + dayOffset);\\n const [hours, minutes] = timeSlots[timeSlotIndex].split(':');\\n postTime.setHours(parseInt(hours), parseInt(minutes), 0, 0);\\n if (postTime < new Date()) {\\n postTime.setDate(postTime.getDate() + 1);\\n }\\n return {\\n json: {\\n ...post,\\n scheduled_time: postTime.toISOString(),\\n scheduled_timestamp: Math.floor(postTime.getTime() / 1000),\\n scheduled_readable: postTime.toLocaleString()\\n }\\n };\\n});\\nreturn scheduledPosts;" } }, { "name": "Facebook Publisher", "type": "n8n-nodes-base.facebookGraphApi", "position": [1400, 200], "parameters": { "resource": "page", "operation": "post", "pageId": "={{$credentials.facebook.pageId}}", "message": "={{$json.content}}", "additionalFields": { "scheduled_publish_time": "={{$json.scheduled_timestamp}}", "published": false } } }, { "name": "Instagram Publisher", "type": "n8n-nodes-base.facebookGraphApi", "position": [1400, 400], "parameters": { "resource": "page", "operation": "post", "pageId": "={{$credentials.instagram.facebookPageId}}", "additionalFields": { "image_url": "={{$json.media_url}}", "caption": "={{$json.content}}", "published": false } } }, { "name": "Success Notification", "type": "n8n-nodes-base.emailSend", "position": [1600, 300], "parameters": { "subject": "Shopify Social Media Posts Scheduled", "html": "=

Posts Successfully Scheduled

Scheduled {{$input.all().length}} posts from Shopify store.

" } } ], "connections": { "Daily Trigger": { "main": [[{"node": "Shopify Credentials", "index": 0}]] }, "Shopify Credentials": { "main": [[{"node": "Get 3 Random Products", "index": 0}], [{"node": "Get 3 Random Collections", "index": 1}]] }, "Get 3 Random Products": { "main": [[{"node": "Limit to 3 Products", "index": 0}]] }, "Get 3 Random Collections": { "main": [[{"node": "Limit to 3 Collections", "index": 0}]] }, "Limit to 3 Products": { "main": [[{"node": "Generate Product Posts", "index": 0}]] }, "Limit to 3 Collections": { "main": [[{"node": "Generate Collection Posts", "index": 0}]] }, "Generate Product Posts": { "main": [[{"node": "Combine & Schedule Posts", "index": 0}]] }, "Generate Collection Posts": { "main": [[{"node": "Combine & Schedule Posts", "index": 1}]] }, "Combine & Schedule Posts": { "main": [[{"node": "Facebook Publisher", "index": 0, "condition": {"type": "if", "conditions": [{"leftValue": "={{$json.platform}}", "operator": "equal", "rightValue": "facebook"}]}}], [{"node": "Instagram Publisher", "index": 1, "condition": {"type": "if", "conditions": [{"leftValue": "={{$json.platform}}", "operator": "equal", "rightValue": "instagram"}]}}]] }, "Facebook Publisher": { "main": [[{"node": "Success Notification", "index": 0}]] }, "Instagram Publisher": { "main": [[{"node": "Success Notification", "index": 1}]] } } }

Advanced Features

AI-Powered Content

Smart Post Generation

Automatically extracts product features

Generates platform-specific hashtags

Creates compelling CTAs

Error Recovery

Built-in Resilience

Automatic retry for failed posts

Error notifications via email

Fallback image handling

Analytics

Performance Tracking

Daily posting reports

Engagement tracking

ROI calculations

5 Optional AI Enhancement

Add OpenAI integration for better content generation:

{ "name": "AI Content Generator", "type": "n8n-nodes-base.openAi", "parameters": { "resource": "chat", "model": "gpt-4", "messages": { "values": [{ "role": "system", "content": "Generate engaging social media post about this Shopify product: {{$json.title}}. Include emojis and 3-5 relevant hashtags." }] } } }
Shopify Ecommerce to Social Media FB Insta Automation - n8n Workflow by AI Knots

Expected Results

504
Monthly Posts
84
Products Featured Monthly
84
Collections Featured Monthly
40+
Hours Saved Monthly

Download Complete Workflow

Click below to download the complete n8n workflow JSON file for Shopify:

Download Shopify Workflow.json

File: shopify-social-media-automation.json

Post a Comment

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post