{
  "name": "Soke — Thumbnail Generation (Async)",
  "nodes": [
    {
      "parameters": {},
      "id": "f1b2c3d4-0006-4000-8000-000000000001",
      "name": "When clicking 'Test workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [180, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.usesoke.ai/api/v1/thumbnail/generate",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"manualTitle\": \"{{ $json.title || '10 Developer Productivity Hacks' }}\",\n  \"manualPrompt\": \"{{ $json.prompt || 'A developer at a clean desk with multiple monitors showing code' }}\",\n  \"colorGrading\": \"Cinematic\",\n  \"layoutType\": \"TextCenter\",\n  \"resolution\": \"1280x720\",\n  \"platform\": \"youtube\"\n}",
        "options": {}
      },
      "id": "f1b2c3d4-0006-4000-8000-000000000002",
      "name": "Start Thumbnail Generation",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [420, 300],
      "credentials": {
        "httpHeaderAuth": {
          "id": "CREDENTIAL_ID",
          "name": "Soke API"
        }
      }
    },
    {
      "parameters": {
        "amount": 5,
        "unit": "seconds"
      },
      "id": "f1b2c3d4-0006-4000-8000-000000000003",
      "name": "Wait 5s",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [660, 300],
      "webhookId": "soke-wait-thumb"
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://api.usesoke.ai/api/v1/thumbnail/{{ $('Start Thumbnail Generation').item.json.data.id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "id": "f1b2c3d4-0006-4000-8000-000000000004",
      "name": "Poll Thumbnail Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [900, 300],
      "credentials": {
        "httpHeaderAuth": {
          "id": "CREDENTIAL_ID",
          "name": "Soke API"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "condition-1",
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "Completed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "f1b2c3d4-0006-4000-8000-000000000005",
      "name": "Is Completed?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [1140, 300]
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"status\": \"completed\",\n  \"imageUrl\": \"{{ $json.data.imageUrl }}\",\n  \"generationId\": \"{{ $json.data.id }}\"\n}",
        "options": {}
      },
      "id": "f1b2c3d4-0006-4000-8000-000000000006",
      "name": "Thumbnail Ready",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1380, 200]
    },
    {
      "parameters": {
        "amount": 5,
        "unit": "seconds"
      },
      "id": "f1b2c3d4-0006-4000-8000-000000000007",
      "name": "Wait & Retry",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [1380, 420],
      "webhookId": "soke-wait-thumb-retry"
    }
  ],
  "connections": {
    "When clicking 'Test workflow'": {
      "main": [
        [{ "node": "Start Thumbnail Generation", "type": "main", "index": 0 }]
      ]
    },
    "Start Thumbnail Generation": {
      "main": [
        [{ "node": "Wait 5s", "type": "main", "index": 0 }]
      ]
    },
    "Wait 5s": {
      "main": [
        [{ "node": "Poll Thumbnail Status", "type": "main", "index": 0 }]
      ]
    },
    "Poll Thumbnail Status": {
      "main": [
        [{ "node": "Is Completed?", "type": "main", "index": 0 }]
      ]
    },
    "Is Completed?": {
      "main": [
        [{ "node": "Thumbnail Ready", "type": "main", "index": 0 }],
        [{ "node": "Wait & Retry", "type": "main", "index": 0 }]
      ]
    },
    "Wait & Retry": {
      "main": [
        [{ "node": "Poll Thumbnail Status", "type": "main", "index": 0 }]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "soke-template"
  },
  "tags": [
    { "name": "Soke", "id": "soke-tag-1" }
  ]
}
