{
  "name": "E-commerce product launch campaign",
  "nodes": [
    {
      "parameters": {
        "content": "## E-commerce product launch campaign\n\n### How it works\n\n1. A manual trigger fetches the product, downloads its image, and uploads it to Posta as media.\n2. Your active social accounts are selected and de-duplicated to one post per platform.\n3. The product and platforms are combined and expanded into a multi-day campaign matrix.\n4. An LLM writes per-platform captions, which are parsed and merged back per account.\n5. Posta creates the scheduled launch posts across the campaign.\n\n### Setup steps\n\n- [ ] Add your Posta credential (API token) to the Posta nodes\n- [ ] Add your DeepSeek (LLM) credential to the 'Basic LLM Chain' model\n- [ ] Point 'Fetch product' at your product source (URL or API)\n- [ ] Confirm the accounts in 'Get many social accounts' and the campaign length in 'Expand to days'\n\n### Customization\n\nChange the number of campaign days and the per-platform caption prompt to fit your launch.",
        "width": 480,
        "height": 816
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1184,
        -336
      ],
      "id": "4e36d194-eb12-48fe-8ffd-09dbc45f5f14",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## Fetch product and media\n\nStarts the run, fetches the product, and uploads its image to Posta.",
        "width": 1056,
        "height": 272,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -624,
        -336
      ],
      "id": "a8f16864-4140-4359-86bb-f3aa5e912fac",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "## Select target accounts\n\nLoads social accounts, keeps active ones, and limits to one post per platform.",
        "width": 816,
        "height": 352,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -400,
        -32
      ],
      "id": "cff07305-37a3-4bd8-b7c6-b1b0d9e2e10b",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "## Build campaign matrix\n\nCombines product and platforms, then expands into a multi-day schedule.",
        "width": 448,
        "height": 304,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        544,
        -336
      ],
      "id": "c349713b-94a5-4985-9d16-51e00eda3b25",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "## Generate captions with AI\n\nAn LLM writes per-platform captions, which are then parsed into structured data.",
        "width": 544,
        "height": 544,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1104,
        -336
      ],
      "id": "43007709-31a8-4af9-9c38-8ed152ac2d3a",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "content": "## Assemble and publish\n\nMerges captions per account and creates the scheduled launch posts.",
        "width": 480,
        "height": 304,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1776,
        -112
      ],
      "id": "a6fabe76-fa14-4899-9761-9d80d672b198",
      "name": "Sticky Note5"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -576,
        -224
      ],
      "id": "71e9da98-d459-41ff-9796-09e645ad6de8",
      "name": "When clicking ‘Execute workflow’"
    },
    {
      "parameters": {
        "url": "https://fakestoreapi.com/products/1",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        -352,
        -224
      ],
      "id": "95935938-a652-4bff-b5ec-5ef6801aa73c",
      "name": "Fetch product"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Write ONE {{ $json.platform }} caption for day {{ $json.day }} of a 5-day campaign\n  for \"{{ $json.title }}\" ({{ $json.description }}, ${{ $json.price }}).\n  End with 3–5 relevant hashtags. Return only the caption — no preamble.",
        "messages": {
          "messageValues": [
            {
              "message": "You are the best social media marketing expert in the world."
            }
          ]
        },
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.9,
      "position": [
        1152,
        -208
      ],
      "id": "dce15ba8-975c-46f6-ac1c-2017bc9b480a",
      "name": "Basic LLM Chain"
    },
    {
      "parameters": {
        "model": "deepseek-v4-pro",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
      "typeVersion": 1,
      "position": [
        1152,
        48
      ],
      "id": "044989a2-8cf9-4865-a50a-51b2c58f72e8",
      "name": "DeepSeek Chat Model",
      "credentials": {
        "deepSeekApi": {
          "id": "xqHl99v85iZxuO1j",
          "name": "DeepSeek account"
        }
      }
    },
    {
      "parameters": {
        "resource": "socialAccount"
      },
      "type": "n8n-nodes-posta.posta",
      "typeVersion": 1,
      "position": [
        -352,
        80
      ],
      "id": "23da3937-9a5c-40d3-b871-82fbfd291199",
      "name": "Get many social accounts",
      "credentials": {
        "postaApi": {
          "id": "B35JRmx3PNisTqmS",
          "name": "Posta account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "965b8dcb-cbbf-4a09-be7d-91190b09681e",
              "leftValue": "={{ $json.isActive }}",
              "rightValue": false,
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            },
            {
              "id": "0650294d-1302-4d4b-97ed-14826faddb9a",
              "leftValue": "",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        -64,
        80
      ],
      "id": "886cbb0c-d24a-4344-a2d7-e9652ba78d56",
      "name": "Keep active accounts"
    },
    {
      "parameters": {
        "compare": "selectedFields",
        "fieldsToCompare": "platform",
        "options": {}
      },
      "type": "n8n-nodes-base.removeDuplicates",
      "typeVersion": 2,
      "position": [
        272,
        160
      ],
      "id": "40308f8a-15ff-4eaf-a450-2f8db59ea539",
      "name": "One post per platform"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineAll",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        592,
        -208
      ],
      "id": "a12e72fe-1ba7-4895-b419-097d34ca44ed",
      "name": "Combine product + platforms"
    },
    {
      "parameters": {
        "jsCode": "const ctx = $('Expand to days').all();\n  return $input.all().map((item, i) => {\n    const day = ctx[i].json.day;\n    return {\n      json: {\n        platform: ctx[i].json.platform,\n        day,\n        caption: item.json.text,\n        mediaId:  ctx[i].json.mediaId,\n        scheduledAt: $now\n          .plus({ days: day })                                  // day 1 = tomorrow, day 5 = +5\n          .set({ hour: 9, minute: 0, second: 0, millisecond: 0 }) // post at 09:00\n          .toUTC()\n          .toISO(),                                             // strict UTC ISO the API wants\n      },\n    };\n  });"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1504,
        -208
      ],
      "id": "70a87504-d83b-4a22-b4d3-ada5dcc09b30",
      "name": "Parse LLM captions"
    },
    {
      "parameters": {
        "jsCode": "return $input.all().flatMap(i =>\n    [1,2,3,4,5].map(day => ({ json: { ...i.json, day } }))\n  );"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        848,
        -208
      ],
      "id": "b12bdda8-009d-4a53-bfca-d213eb8153b3",
      "name": "Expand to days"
    },
    {
      "parameters": {
        "mode": "combine",
        "fieldsToMatchString": "platform",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        1824,
        16
      ],
      "id": "1447b440-295f-4586-b626-04641c2979bb",
      "name": "Merge captions per account"
    },
    {
      "parameters": {
        "resource": "post",
        "operation": "create",
        "socialAccountIds": "= {{ $json.id }}",
        "caption": "={{ $json.caption }}",
        "additionalFields": {
          "mediaIds": "= {{ $json.mediaId }}",
          "isDraft": false
        },
        "platformConfigurations": {}
      },
      "type": "n8n-nodes-posta.posta",
      "typeVersion": 1,
      "position": [
        2112,
        16
      ],
      "id": "60fbaf61-4f56-4607-b851-a0a1f10ef977",
      "name": "Create a post",
      "credentials": {
        "postaApi": {
          "id": "B35JRmx3PNisTqmS",
          "name": "Posta account"
        }
      }
    },
    {
      "parameters": {
        "url": "={{ $json.image }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        -96,
        -224
      ],
      "id": "d1f45c2b-c557-48da-b10a-708491d81c70",
      "name": "Download product image"
    },
    {
      "parameters": {
        "resource": "media"
      },
      "type": "n8n-nodes-posta.posta",
      "typeVersion": 1,
      "position": [
        80,
        -224
      ],
      "id": "b8d6ab49-2385-48fb-b7a3-b69bb6a95797",
      "name": "Upload media",
      "credentials": {
        "postaApi": {
          "id": "B35JRmx3PNisTqmS",
          "name": "Posta account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c5a46e5b-3a92-42b8-bf14-d473fee0281c",
              "name": "mediaId",
              "value": "={{ $json.media.id }}",
              "type": "string"
            },
            {
              "id": "7addd58f-f2da-4dbb-8865-cfaa061de77d",
              "name": "title",
              "value": "={{ $('Fetch product').first().json.title }}",
              "type": "string"
            },
            {
              "id": "ddbf23e7-facd-4b29-8406-d9c39d4d8f20",
              "name": "description",
              "value": "={{ $('Fetch product').first().json.description }}",
              "type": "string"
            },
            {
              "id": "ad5022e7-ddf4-48c6-9aa0-6f80b9cc5f31",
              "name": "price",
              "value": "={{ $('Fetch product').first().json.price }}",
              "type": "string"
            },
            {
              "id": "775e372b-c120-4ab2-ac72-c23527ca7dc2",
              "name": "image",
              "value": "={{ $('Fetch product').first().json.image }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        288,
        -224
      ],
      "id": "205d4483-bb45-4bd1-bcf7-525fd22f56eb",
      "name": "Attach product media id"
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Fetch product",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get many social accounts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch product": {
      "main": [
        [
          {
            "node": "Download product image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many social accounts": {
      "main": [
        [
          {
            "node": "Keep active accounts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep active accounts": {
      "main": [
        [
          {
            "node": "One post per platform",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One post per platform": {
      "main": [
        [
          {
            "node": "Combine product + platforms",
            "type": "main",
            "index": 1
          },
          {
            "node": "Merge captions per account",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Combine product + platforms": {
      "main": [
        [
          {
            "node": "Expand to days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Parse LLM captions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Expand to days": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse LLM captions": {
      "main": [
        [
          {
            "node": "Merge captions per account",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge captions per account": {
      "main": [
        [
          {
            "node": "Create a post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download product image": {
      "main": [
        [
          {
            "node": "Upload media",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload media": {
      "main": [
        [
          {
            "node": "Attach product media id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Attach product media id": {
      "main": [
        [
          {
            "node": "Combine product + platforms",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "4ddba110-25ff-4606-8e61-cf21aea05740",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "39a3102487046be4b62efd158285575e7be1bc28455490b873f61de6134af3c2"
  },
  "id": "ZIzfh6sIe4ToAqeC",
  "tags": [
    {
      "updatedAt": "2026-06-02T09:01:25.831Z",
      "createdAt": "2026-06-02T09:01:25.831Z",
      "id": "8xBogo6fq3RQfLdT",
      "name": "autopost"
    },
    {
      "updatedAt": "2026-06-02T09:01:40.639Z",
      "createdAt": "2026-06-02T09:01:40.639Z",
      "id": "ESvKanJ6OwKaH6u4",
      "name": "posta"
    },
    {
      "updatedAt": "2026-06-03T12:31:06.730Z",
      "createdAt": "2026-06-03T12:31:06.730Z",
      "id": "Yj8jMnpGLDXpmAr4",
      "name": "e-commerce"
    },
    {
      "updatedAt": "2026-06-03T12:31:12.744Z",
      "createdAt": "2026-06-03T12:31:12.744Z",
      "id": "ZG1V0O463Dgrj7Gj",
      "name": "product"
    }
  ]
}
