AutomationFlowsAI & RAG › Automate Shopify Product Posting to Social Media with Gpt-4.1-mini & Data…

Automate Shopify Product Posting to Social Media with Gpt-4.1-mini & Data…

Original n8n title: Automate Shopify Product Posting to Social Media with Gpt-4.1-mini & Data Tracking

ByAvkash Kakdiya @itechnotion on n8n.io

This workflow listens for new products in Shopify and transforms the product data into polished social media content. It generates captions and hashtags using an AI model, then posts the product to Instagram and Facebook using the Facebook Graph API. It logs every post to Google…

Event trigger★★★★☆ complexityAI-powered16 nodesHTTP RequestShopify TriggerOpenAIGoogle SheetsDiscord
AI & RAG Trigger: Event Nodes: 16 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #10817 — we link there as the canonical source.

This workflow follows the Discord → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "kPqmBJm4SV5SabF2",
  "name": "002 Ecom Social Auto-Post",
  "tags": [],
  "nodes": [
    {
      "id": "9647bd1c-13be-4d45-967b-1ee86860f830",
      "name": "Set Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        -144
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "imageUrl",
              "value": "={{ $('parse product data').item.json.productImage }}"
            },
            {
              "name": "caption",
              "value": "={{ $json.message.content.caption }}"
            },
            {
              "name": "hashtags",
              "value": "={{ $json.message.content.hashtags }}\n"
            },
            {
              "name": "facebookPageId",
              "value": "YOUR_FACEBOOK_PAGE_ID"
            },
            {
              "name": "instagramAccountId",
              "value": "YOUR_IG_BUSINESS_ACCOUNT_ID"
            },
            {
              "name": "accessToken",
              "value": "YOUR_ACCESS_TOKEN"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "c58bbe87-716c-4813-a460-7aaff9aac416",
      "name": "Create Instagram Media Container",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1088,
        -16
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v18.0/{{ $json.instagramAccountId }}/media",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "image_url",
              "value": "={{ $json.imageUrl }}"
            },
            {
              "name": "caption",
              "value": "={{ $json.caption }} {{ $json.hashtags }}"
            },
            {
              "name": "access_token",
              "value": "={{ $json.accessToken }}"
            }
          ]
        },
        "nodeCredentialType": "facebookGraphApi"
      },
      "credentials": {
        "facebookGraphApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "cf07a45a-6559-4970-9bb0-95f2c1a9be81",
      "name": "Wait for Processing",
      "type": "n8n-nodes-base.wait",
      "position": [
        1280,
        -16
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 5
      },
      "typeVersion": 1
    },
    {
      "id": "9d1e5a82-051f-4607-8495-f15a59063d6f",
      "name": "Publish Instagram Media",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1472,
        -16
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v18.0/{{ $('Set Configuration').item.json.instagramAccountId }}/media_publish",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "creation_id",
              "value": "={{ $json.id }}"
            },
            {
              "name": "access_token",
              "value": "={{ $('Set Configuration').item.json.accessToken }}"
            }
          ]
        },
        "nodeCredentialType": "facebookGraphApi"
      },
      "credentials": {
        "facebookGraphApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "23c6d9e0-e49d-47e5-b263-69825a440ac2",
      "name": "Download Image for Facebook",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1104,
        -272
      ],
      "parameters": {
        "url": "={{ $json.imageUrl }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "f3093c54-b985-45f1-9552-dd56ad3c8b95",
      "name": "Shopify Trigger",
      "type": "n8n-nodes-base.shopifyTrigger",
      "position": [
        0,
        -144
      ],
      "parameters": {
        "topic": "products/create",
        "authentication": "accessToken"
      },
      "credentials": {
        "shopifyAccessTokenApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a05cc51d-33e4-4068-b415-23aa18ffeff9",
      "name": "parse product data",
      "type": "n8n-nodes-base.function",
      "notes": "Formats product data into social media post content with caption and hashtags",
      "position": [
        224,
        -144
      ],
      "parameters": {
        "functionCode": "// Extract and format product data\nconst product = items[0].json;\n\nconst productName = product.title || 'New Product';\nconst productPrice = product.variants?.[0]?.price || 'Price TBA';\nconst productImage = product.images?.[0]?.src || '';\nconst productUrl = `https://yourstore.myshopify.com/products/${product.handle}`;\nconst productDescription = product.body_html?.replace(/<[^>]*>/g, '').substring(0, 150) || '';\nconst timestamp = new Date().toISOString();\n\n\n// // Generate social media caption\n// const caption = `\ud83c\udf89 New Arrival! ${productName}\\n\\n${productDescription}...\\n\\n\ud83d\udcb0 ${productPrice}\\n\ud83d\uded2 Shop now: ${productUrl}\\n\\n#NewProduct #ShopNow #Ecommerce #${productName.replace(/\\s+/g, '')}`;\n\nreturn [\n  {\n    json: {\n      productName,\n      productPrice,\n      productImage,\n      productUrl,\n      productDescription,\n      timestamp\n    }\n  }\n];"
      },
      "typeVersion": 1
    },
    {
      "id": "fa7aa400-a958-48d4-b01e-f898ec525c34",
      "name": "Generate caption and hashtags",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        448,
        -144
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are a professional social media copywriter.  \nYour task is to create engaging social media content for a product listed in a Shopify store.\n\nHere is the product JSON:\n[{\n  \"id\":{{ $('Shopify Trigger').item.json.id }} ,\n  \"title\": \"{{ $json.productName }}\",\n  \"body_html\": \"{{ $json.productDescription }}\",\n  \"vendor\": \"{{ $('Shopify Trigger').item.json.vendor }}\",\n  \"product_type\": \"{{ $('Shopify Trigger').item.json.product_type }}\",\n  \"price\": \"{{ $json.productPrice }}\",\n  \"tags\": \"{{ $('Shopify Trigger').item.json.tags }}\",\n  \"image\": \"{{ $json.productImage }}\",\n  \"hashtag\":\"\"\n}]\n\nUsing this data:\n1. Write an attractive **caption** (2\u20133 lines) suitable for Instagram, Facebook, or Twitter.\n2. The tone should be **energetic, sporty, and brand-aligned (Nike-style)**.\n3. End the caption with a **call to action** (e.g., \"Shop now\", \"Run your best\", etc.).\n4. Generate **10 relevant and trending hashtags** for this product based on its category, use case, and brand.\n5. Output the result in this JSON format:\n\n{\n  \"caption\": \"<your generated caption>\",\n  \"hashtags\": [\"#hashtag1\", \"#hashtag2\", ...]\n}\n"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "edd5397c-da14-43de-914f-04536e215235",
      "name": "Post to Facebook Page",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1376,
        -272
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/v18.0/{{ $('Set Configuration').item.json.facebookPageId }}/photos",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendQuery": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "source",
              "value": "data"
            }
          ]
        },
        "queryParameters": {
          "parameters": [
            {
              "name": "message",
              "value": "={{ $('Set Configuration').item.json.caption }} {{ $('Set Configuration').item.json.hashtags }}"
            },
            {
              "name": "access_token",
              "value": "={{ $('Set Configuration').item.json.accessToken }}"
            }
          ]
        },
        "nodeCredentialType": "facebookGraphApi"
      },
      "credentials": {
        "facebookGraphApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "14e50a9c-a9c6-49e7-bb03-345a97267cda",
      "name": "Log Product Post Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1952,
        -160
      ],
      "parameters": {
        "columns": {
          "value": {
            "caption": "={{ $('Generate caption and hashtags').item.json.message.content.caption }}",
            "hashtags": "={{ $('Generate caption and hashtags').item.json.message.content.hashtags }}\n",
            "productid": "={{ $('Shopify Trigger').item.json.id }}",
            "productUrl": "={{ $('parse product data').item.json.productUrl }}",
            "postingdate": "={{ $('parse product data').item.json.timestamp }}",
            "productName": "={{ $('parse product data').item.json.productName }}",
            "productImage": "={{ $('parse product data').item.json.productImage }}",
            "productPrice": "={{ $('Shopify Trigger').item.json.variants[0].price }}"
          },
          "schema": [
            {
              "id": "productName",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "productName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productid",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "productid",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productPrice",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "productPrice",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "postingdate",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "postingdate",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productImage",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "productImage",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "productUrl",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "productUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "caption",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "caption",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "hashtags",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "hashtags",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vOjAxiJf1RsLoy7SYpoAEaNMGtmgjydecs-pOniBJUU/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vOjAxiJf1RsLoy7SYpoAEaNMGtmgjydecs-pOniBJUU",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vOjAxiJf1RsLoy7SYpoAEaNMGtmgjydecs-pOniBJUU/edit?usp=drivesdk",
          "cachedResultName": "Log sheet"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "4e7031cb-0d60-4b42-ab24-6ee117f3ad03",
      "name": "Notify Discord About Post",
      "type": "n8n-nodes-base.discord",
      "position": [
        2208,
        -160
      ],
      "parameters": {
        "content": "=\u2705 New Product Posted\n\nProduct Name: {{ $json.productName }}\nCaption: {{ $json.caption }}\nImage URL: {{ $json.productImage }}\nhashtag: {{ $json.hashtags }}",
        "options": {},
        "authentication": "webhook"
      },
      "credentials": {
        "discordWebhookApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ce105698-d31a-46ac-8228-c88e7f3ad6a5",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1728,
        -160
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.2
    },
    {
      "id": "1af331ab-641b-4137-ad6a-890cfc051ef1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -432
      ],
      "parameters": {
        "color": 7,
        "width": 784,
        "height": 624,
        "content": "## Step 1: Product Capture & Prep  \nCaptures new Shopify products, extracts all required product details, and prepares clean data for caption generation and social posting.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "81a00629-076d-447f-b9be-d4467b02b7d1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        -432
      ],
      "parameters": {
        "color": 7,
        "width": 896,
        "height": 624,
        "content": "## Step 2: Social Content & Publishing  \nAI generates the caption and hashtags, then posts the product image and text to Instagram and Facebook using the Meta Graph API.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7328d5cc-ce39-4075-85e3-b1a254a86a93",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        -432
      ],
      "parameters": {
        "color": 7,
        "width": 768,
        "height": 624,
        "content": "## Step 3: Logging & Notifications  \nLogs post details to Google Sheets and sends a final confirmation message to Discord with product information.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c3a7fd78-0c2b-4719-86e0-75f51f16b9a4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        -432
      ],
      "parameters": {
        "width": 544,
        "height": 592,
        "content": "## Ecom Auto Social Posting Workflow \u2013 Overview  \nThis workflow automatically turns every new Shopify product into a ready-to-post social media update. It collects the product\u2019s name, price, image, and description, then uses AI to create a short, engaging caption with 10 hashtags.  \n\nThe workflow then posts the image and caption to Instagram and Facebook, waits for the upload to process, and confirms the post is published. After that, it saves all post details to Google Sheets and sends you a quick Discord notification.\n\n### How it works\n- Detects new Shopify products  \n- Prepares product info  \n- AI writes caption + hashtags  \n- Auto-posts to Instagram & Facebook  \n- Logs everything + sends Discord update  \n\n### Setup steps\n1. Connect Shopify, Meta, OpenAI, Sheets & Discord  \n2. Add your Facebook Page ID, Instagram Account ID & Access Token  \n3. Add your Shopify store link in the parser  \n4. Choose your Google Sheet  \n5. Test with any sample product  \n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "65e1f122-d111-4bea-9004-17d9af9526f8",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Log Product Post Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify Trigger": {
      "main": [
        [
          {
            "node": "parse product data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Configuration": {
      "main": [
        [
          {
            "node": "Create Instagram Media Container",
            "type": "main",
            "index": 0
          },
          {
            "node": "Download Image for Facebook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parse product data": {
      "main": [
        [
          {
            "node": "Generate caption and hashtags",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Processing": {
      "main": [
        [
          {
            "node": "Publish Instagram Media",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Product Post Data": {
      "main": [
        [
          {
            "node": "Notify Discord About Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Facebook Page": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish Instagram Media": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Download Image for Facebook": {
      "main": [
        [
          {
            "node": "Post to Facebook Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate caption and hashtags": {
      "main": [
        [
          {
            "node": "Set Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Instagram Media Container": {
      "main": [
        [
          {
            "node": "Wait for Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow listens for new products in Shopify and transforms the product data into polished social media content. It generates captions and hashtags using an AI model, then posts the product to Instagram and Facebook using the Facebook Graph API. It logs every post to Google…

Source: https://n8n.io/workflows/10817/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

The Problem That it Solves

Google Drive Trigger, OpenAI, Google Drive +5
AI & RAG

This workflow is perfect for e-commerce store owners using Shopify who want to automatically announce new products to their customer base through personalized WhatsApp messages. It's ideal for busines

Shopify Trigger, HTTP Request, Google Sheets +4
AI & RAG

Ask questions like “How much did I spend on food last month?” and get instant answers from your financial data — directly in Telegram.

Telegram Trigger, OpenAI, Google Sheets +2
AI & RAG

This intelligent email automation workflow helps you maximize engagement through domain-based outreach. It utilizes AI-powered personalization and strategic follow-ups to increase response rates. The

Gmail, HTTP Request, Google Sheets +1
AI & RAG

Note: Now includes an Apify alternative for Rapid API (Some users can't create new accounts on Rapid API, so I have added an alternative for you. But immediately you are able to get access to Rapid AP

Form Trigger, Google Sheets Trigger, OpenAI +2