{
  "name": "bundle.social demo: Instagram post with fresh analytics",
  "nodes": [
    {
      "parameters": {
        "content": "## bundle.social node demo\n\nPublishes an image to Instagram, then pulls fresh analytics for the post and the account, both normalized and raw as Instagram returns them.\n\n**Setup (1 minute)**\n1. Create a **bundle.social API** credential with an API key from bundle.social > Organization > API Keys.\n2. In **Create Instagram post**, pick a team with a connected Instagram account in **Team**.\n3. Click **Execute workflow**.",
        "height": 320,
        "width": 420,
        "color": 4
      },
      "id": "b2e1d7a3-0001-4c8f-8b21-000000000001",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        -140
      ]
    },
    {
      "parameters": {
        "content": "### 1. Connection check\nReads the organization and lists teams with their connected social accounts.",
        "height": 260,
        "width": 480,
        "color": 7
      },
      "id": "b2e1d7a3-0002-4c8f-8b21-000000000002",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        -140
      ]
    },
    {
      "parameters": {
        "content": "### 2. Upload and publish\nbundle.social fetches a random image from Lorem Picsum, then the Instagram post is created with that upload and published right away.",
        "height": 260,
        "width": 480,
        "color": 7
      },
      "id": "b2e1d7a3-0003-4c8f-8b21-000000000003",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        460,
        -140
      ]
    },
    {
      "parameters": {
        "content": "### 3. Verify\nWaits for Instagram to accept the post, then reads it back.",
        "height": 260,
        "width": 720,
        "color": 7
      },
      "id": "b2e1d7a3-0004-4c8f-8b21-000000000004",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        980,
        -140
      ]
    },
    {
      "parameters": {
        "content": "### 4. Fresh analytics\nForces an immediate analytics refresh for the new post and for the Instagram account, reads the raw platform payloads, then shows normalized and raw metrics side by side.",
        "height": 260,
        "width": 1200,
        "color": 7
      },
      "id": "b2e1d7a3-0005-4c8f-8b21-000000000005",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1720,
        -140
      ]
    },
    {
      "parameters": {},
      "id": "b2e1d7a3-0010-4c8f-8b21-000000000010",
      "name": "Start demo",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -300,
        0
      ]
    },
    {
      "parameters": {
        "resource": "organization",
        "operation": "get"
      },
      "id": "b2e1d7a3-0011-4c8f-8b21-000000000011",
      "name": "Get organization",
      "type": "n8n-nodes-bundlesocial.bundleSocial",
      "typeVersion": 1,
      "position": [
        -20,
        0
      ]
    },
    {
      "parameters": {
        "resource": "team",
        "operation": "getAll",
        "limit": 10
      },
      "id": "b2e1d7a3-0012-4c8f-8b21-000000000012",
      "name": "List teams",
      "type": "n8n-nodes-bundlesocial.bundleSocial",
      "typeVersion": 1,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "resource": "upload",
        "operation": "createFromUrl",
        "url": "=https://picsum.photos/seed/{{ $now.toMillis() }}/1080/1350.jpg"
      },
      "id": "b2e1d7a3-0013-4c8f-8b21-000000000013",
      "name": "Upload image from Lorem Picsum",
      "type": "n8n-nodes-bundlesocial.bundleSocial",
      "typeVersion": 1,
      "position": [
        500,
        0
      ],
      "executeOnce": true
    },
    {
      "parameters": {
        "resource": "post",
        "operation": "create",
        "teamId": "",
        "title": "=n8n demo {{ $now.toFormat('yyyy-MM-dd HH:mm') }}",
        "postDate": "={{ $now.toISO() }}",
        "status": "SCHEDULED",
        "socialAccountTypes": [
          "INSTAGRAM"
        ],
        "dataInstagram": {
          "type": "POST",
          "text": "=Published from n8n with the bundle.social node ({{ $now.toFormat('HH:mm:ss') }})",
          "uploadIds": "={{ $json.id }}"
        }
      },
      "id": "b2e1d7a3-0014-4c8f-8b21-000000000014",
      "name": "Create Instagram post",
      "type": "n8n-nodes-bundlesocial.bundleSocial",
      "typeVersion": 1,
      "position": [
        740,
        0
      ]
    },
    {
      "parameters": {
        "amount": 60,
        "unit": "seconds"
      },
      "id": "b2e1d7a3-0015-4c8f-8b21-000000000015",
      "name": "Wait for publishing",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1020,
        0
      ],
      "webhookId": "b2e1d7a3-0015-4c8f-8b21-0000000000ff"
    },
    {
      "parameters": {
        "resource": "post",
        "operation": "get",
        "id": "={{ $('Create Instagram post').item.json.id }}"
      },
      "id": "b2e1d7a3-0016-4c8f-8b21-000000000016",
      "name": "Get post",
      "type": "n8n-nodes-bundlesocial.bundleSocial",
      "typeVersion": 1,
      "position": [
        1260,
        0
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "d3f2e8b4-0001-4d9a-9c32-000000000001",
              "leftValue": "={{ $json.status }}",
              "rightValue": "POSTED",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "b2e1d7a3-0017-4c8f-8b21-000000000017",
      "name": "Published?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1500,
        0
      ]
    },
    {
      "parameters": {
        "resource": "analytics",
        "operation": "refreshPostAnalytics",
        "additionalFields": {
          "postId": "={{ $json.id }}",
          "platformType": "INSTAGRAM"
        }
      },
      "id": "b2e1d7a3-0018-4c8f-8b21-000000000018",
      "name": "Refresh post analytics",
      "type": "n8n-nodes-bundlesocial.bundleSocial",
      "typeVersion": 1,
      "position": [
        1780,
        -20
      ]
    },
    {
      "parameters": {
        "resource": "analytics",
        "operation": "refreshSocialAccountAnalytics",
        "teamId": "={{ $('Get post').item.json.teamId }}",
        "platformType": "INSTAGRAM"
      },
      "id": "b2e1d7a3-0019-4c8f-8b21-000000000019",
      "name": "Refresh account analytics",
      "type": "n8n-nodes-bundlesocial.bundleSocial",
      "typeVersion": 1,
      "position": [
        2020,
        -20
      ]
    },
    {
      "parameters": {
        "resource": "analytics",
        "operation": "getRawPostAnalytics",
        "options": {
          "postId": "={{ $('Get post').item.json.id }}",
          "platformType": "INSTAGRAM"
        }
      },
      "id": "b2e1d7a3-0022-4c8f-8b21-000000000022",
      "name": "Get raw post analytics",
      "type": "n8n-nodes-bundlesocial.bundleSocial",
      "typeVersion": 1,
      "position": [
        2260,
        -20
      ]
    },
    {
      "parameters": {
        "resource": "analytics",
        "operation": "getRawSocialAccountAnalytics",
        "teamId": "={{ $('Get post').item.json.teamId }}",
        "platformType": "INSTAGRAM"
      },
      "id": "b2e1d7a3-0023-4c8f-8b21-000000000023",
      "name": "Get raw account analytics",
      "type": "n8n-nodes-bundlesocial.bundleSocial",
      "typeVersion": 1,
      "position": [
        2500,
        -20
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "e4a3f9c5-0001-4eab-8d43-000000000001",
              "name": "postLink",
              "value": "={{ $('Get post').item.json.externalData?.INSTAGRAM?.permalink ?? '' }}",
              "type": "string"
            },
            {
              "id": "e4a3f9c5-0002-4eab-8d43-000000000002",
              "name": "post",
              "value": "={{ { impressions: $('Refresh post analytics').item.json.impressions, views: $('Refresh post analytics').item.json.views, likes: $('Refresh post analytics').item.json.likes, comments: $('Refresh post analytics').item.json.comments, shares: $('Refresh post analytics').item.json.shares, saves: $('Refresh post analytics').item.json.saves } }}",
              "type": "object"
            },
            {
              "id": "e4a3f9c5-0003-4eab-8d43-000000000003",
              "name": "account",
              "value": "={{ { followers: $('Refresh account analytics').item.json.followers, following: $('Refresh account analytics').item.json.following, postCount: $('Refresh account analytics').item.json.postCount, impressions: $('Refresh account analytics').item.json.impressions, views: $('Refresh account analytics').item.json.views, likes: $('Refresh account analytics').item.json.likes, comments: $('Refresh account analytics').item.json.comments } }}",
              "type": "object"
            },
            {
              "id": "e4a3f9c5-0004-4eab-8d43-000000000004",
              "name": "rawPost",
              "value": "={{ $('Get raw post analytics').item.json.items?.[0]?.raw ?? {} }}",
              "type": "object"
            },
            {
              "id": "e4a3f9c5-0005-4eab-8d43-000000000005",
              "name": "rawAccount",
              "value": "={{ $('Get raw account analytics').item.json.items?.[0]?.raw ?? {} }}",
              "type": "object"
            }
          ]
        },
        "options": {}
      },
      "id": "b2e1d7a3-0020-4c8f-8b21-000000000020",
      "name": "Analytics summary",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2740,
        -20
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "e4a3f9c5-0011-4eab-8d43-000000000011",
              "name": "status",
              "value": "={{ $json.status }}",
              "type": "string"
            },
            {
              "id": "e4a3f9c5-0012-4eab-8d43-000000000012",
              "name": "error",
              "value": "={{ $json.error ?? '' }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "b2e1d7a3-0021-4c8f-8b21-000000000021",
      "name": "Not published yet",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1780,
        180
      ]
    }
  ],
  "connections": {
    "Start demo": {
      "main": [
        [
          {
            "node": "Get organization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get organization": {
      "main": [
        [
          {
            "node": "List teams",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List teams": {
      "main": [
        [
          {
            "node": "Upload image from Lorem Picsum",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload image from Lorem Picsum": {
      "main": [
        [
          {
            "node": "Create Instagram post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Instagram post": {
      "main": [
        [
          {
            "node": "Wait for publishing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for publishing": {
      "main": [
        [
          {
            "node": "Get post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get post": {
      "main": [
        [
          {
            "node": "Published?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Published?": {
      "main": [
        [
          {
            "node": "Refresh post analytics",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not published yet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Refresh post analytics": {
      "main": [
        [
          {
            "node": "Refresh account analytics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Refresh account analytics": {
      "main": [
        [
          {
            "node": "Get raw post analytics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get raw post analytics": {
      "main": [
        [
          {
            "node": "Get raw account analytics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get raw account analytics": {
      "main": [
        [
          {
            "node": "Analytics summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}
