{
  "name": "Automate Instagram complaint handling with Claude AI, tickets & SLA management",
  "nodes": [
    {
      "id": "eef4e527-de67-49a9-8a18-6140d80bd84b",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.cron",
      "position": [
        -1200,
        192
      ]
    },
    {
      "id": "d7484c3b-dd65-4022-9275-b9c26e3478ae",
      "name": "Get Instagram Posts",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -976,
        288
      ]
    },
    {
      "id": "914d5b44-4c73-4b89-9952-242d71d74ff6",
      "name": "Get Comments",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -752,
        288
      ]
    },
    {
      "id": "8893bd95-ed78-4971-b90d-5b98f38a16c6",
      "name": "Loop Over Comments",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -528,
        288
      ]
    },
    {
      "id": "291d84aa-0fe3-4d27-9ac4-331ab8419bbc",
      "name": "Capture Original Comment",
      "type": "n8n-nodes-base.set",
      "position": [
        -304,
        288
      ]
    },
    {
      "id": "96caa952-2e27-4fa0-a5de-e2d5b9077f2c",
      "name": "Detect Complaint (Claude AI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -80,
        288
      ]
    },
    {
      "id": "968c7049-8a02-4c32-8545-47075e7caee7",
      "name": "IF Complaint",
      "type": "n8n-nodes-base.if",
      "position": [
        144,
        288
      ]
    },
    {
      "id": "957df429-3800-4a0a-9a3e-e2db38519927",
      "name": "Check Ticket Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1280,
        480
      ]
    },
    {
      "id": "12351c78-a877-4e9a-8fdb-1ac0cd832083",
      "name": "IF SLA Breach Near",
      "type": "n8n-nodes-base.if",
      "position": [
        1488,
        480
      ]
    },
    {
      "id": "0958f6e6-2408-4b82-b767-53f80ce0d06b",
      "name": "Escalate to Manager (Slack)",
      "type": "n8n-nodes-base.slack",
      "position": [
        1712,
        288
      ]
    },
    {
      "id": "09c651d0-dad9-4e14-b705-09ea84d845e4",
      "name": "End (Non-Complaint Path)",
      "type": "n8n-nodes-base.set",
      "position": [
        368,
        384
      ]
    },
    {
      "id": "77975382-8091-4068-b041-bedbcca463de",
      "name": "Create Ticket (Google Sheet)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        816,
        192
      ]
    },
    {
      "id": "53f52cab-4d79-4886-86e7-ad2b7a31df82",
      "name": "Get Team Members",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        368,
        192
      ]
    },
    {
      "id": "6a908f02-66f2-4a99-b5d9-e5466061c0b9",
      "name": "Assign Ticket",
      "type": "n8n-nodes-base.set",
      "position": [
        592,
        192
      ]
    },
    {
      "id": "f60798bd-6ae5-4726-b92a-f71248013a2f",
      "name": "Notify Assignee (Slack)",
      "type": "n8n-nodes-base.slack",
      "position": [
        1040,
        96
      ]
    },
    {
      "id": "d4d82ec0-daad-498d-9d27-a760f59bb582",
      "name": "Wait for SLA Check",
      "type": "n8n-nodes-base.wait",
      "position": [
        1040,
        480
      ]
    },
    {
      "id": "0decaa7a-d955-4a89-a3f9-ca3dc0662588",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1200,
        384
      ]
    },
    {
      "id": "44235062-dc7a-4a1c-bbcc-594e176e0b4b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1248,
        32
      ],
      "parameters": {
        "width": 192,
        "height": 512,
        "content": "Runs every 15 minutes or via webhook (/complaint-handler)\n"
      }
    },
    {
      "id": "4e87a344-14d2-48ee-a5e6-26d8622cfb37",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        32
      ],
      "parameters": {
        "width": 160,
        "height": 512,
        "content": "Fetches recent posts from Instagram Graph API\n"
      }
    },
    {
      "id": "52a70bfe-9c19-418e-bb27-0efc07641ab0",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        32
      ],
      "parameters": {
        "width": 400,
        "height": 512,
        "content": "Uses AI to classify if complaint, extract issue/severity\n"
      }
    },
    {
      "id": "cba70d9f-9872-4651-80f9-53dfdff6ca34",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        32
      ],
      "parameters": {
        "width": 160,
        "height": 512,
        "content": "Branches: Proceed if yes, end if no\n"
      }
    },
    {
      "id": "edd42d16-01a1-46a4-9780-5ca92f864660",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        32
      ],
      "parameters": {
        "width": 160,
        "height": 512,
        "content": "Processes each comment individually to avoid rate limits\n"
      }
    },
    {
      "id": "0989217a-9bd3-4e29-9000-416d38de4ca2",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        32
      ],
      "parameters": {
        "width": 160,
        "height": 512,
        "content": "Retrieves comments for the latest post\n"
      }
    },
    {
      "id": "dcc47583-4ffe-4590-9ab9-caa1cb6489bc",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        32
      ],
      "parameters": {
        "width": 160,
        "height": 512,
        "content": "Loads team roster from TeamMembers sheet or Terminates non-complaint branches\n\n"
      }
    },
    {
      "id": "f98484e8-dc44-4290-bf7c-763a0d23d4e9",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        32
      ],
      "parameters": {
        "width": 160,
        "height": 320,
        "content": "Sets assignee via round-robin logic\n"
      }
    },
    {
      "id": "1e5b7f22-f750-445d-a600-1f4dc6b084bd",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        -64
      ],
      "parameters": {
        "width": 160,
        "height": 320,
        "content": "Alerts assigned team member\n"
      }
    },
    {
      "id": "d0d2424b-b7ba-4616-af91-9dac59373770",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        32
      ],
      "parameters": {
        "width": 160,
        "height": 320,
        "content": "Appends new ticket with details and SLA due date\n"
      }
    },
    {
      "id": "eb44c3ba-ab55-4ab2-987b-0a6da94c3ff2",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        352
      ],
      "parameters": {
        "width": 160,
        "height": 320,
        "content": "Looks up ticket status in sheet\n"
      }
    },
    {
      "id": "a819645a-e779-4993-b669-64f15293d1be",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        352
      ],
      "parameters": {
        "width": 160,
        "height": 320,
        "content": "Delays to near-SLA-breach point (e.g., 20 hours)\n"
      }
    },
    {
      "id": "455775ca-b8e8-4c92-86f0-73f361768dbd",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        144
      ],
      "parameters": {
        "width": 160,
        "height": 320,
        "content": "Notifies manager for urgent action\n"
      }
    },
    {
      "id": "cc928391-ba64-43a9-b6aa-d3a8a46002ad",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        352
      ],
      "parameters": {
        "width": 160,
        "height": 320,
        "content": "Checks if unresolved; escalates if yes\n"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Get Instagram Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Comments": {
      "main": [
        [
          {
            "node": "Loop Over Comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Complaint": {
      "main": [
        [
          {
            "node": "Get Team Members",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "End (Non-Complaint Path)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assign Ticket": {
      "main": [
        [
          {
            "node": "Create Ticket (Google Sheet)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Team Members": {
      "main": [
        [
          {
            "node": "Assign Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Instagram Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF SLA Breach Near": {
      "main": [
        [
          {
            "node": "Escalate to Manager (Slack)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Comments": {
      "main": [
        [
          {
            "node": "Capture Original Comment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for SLA Check": {
      "main": [
        [
          {
            "node": "Check Ticket Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Ticket Status": {
      "main": [
        [
          {
            "node": "IF SLA Breach Near",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Instagram Posts": {
      "main": [
        [
          {
            "node": "Get Comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Capture Original Comment": {
      "main": [
        [
          {
            "node": "Detect Complaint (Claude AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Ticket (Google Sheet)": {
      "main": [
        [
          {
            "node": "Notify Assignee (Slack)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Wait for SLA Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Detect Complaint (Claude AI)": {
      "main": [
        [
          {
            "node": "IF Complaint",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}