{
  "name": "TurnScribe - Transcribe, Summarize & Translate",
  "nodes": [
    {
      "parameters": {},
      "id": "a1a1a1a1-0000-4000-8000-000000000001",
      "name": "When clicking 'Execute Workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [-1120, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b1b1b1b1-0000-4000-8000-000000000001",
              "name": "url",
              "value": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
              "type": "string"
            },
            {
              "id": "b1b1b1b1-0000-4000-8000-000000000002",
              "name": "target_lang",
              "value": "es",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "a1a1a1a1-0000-4000-8000-000000000002",
      "name": "Input",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [-900, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://turnscribe.com/api/v1/transcribe/",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Api-Key YOUR_API_KEY_HERE"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { \"url\": $json.url } }}",
        "options": {}
      },
      "id": "a1a1a1a1-0000-4000-8000-000000000003",
      "name": "Submit Transcription",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-680, 300]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c1c1c1c1-0000-4000-8000-000000000001",
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "a1a1a1a1-0000-4000-8000-000000000004",
      "name": "Already Completed?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [-460, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "d1d1d1d1-0000-4000-8000-000000000001",
              "name": "attempt",
              "value": "={{ ($json.attempt || 0) + 1 }}",
              "type": "number"
            },
            {
              "id": "d1d1d1d1-0000-4000-8000-000000000002",
              "name": "transcript_id",
              "value": "={{ $json.transcript_id }}",
              "type": "string"
            },
            {
              "id": "d1d1d1d1-0000-4000-8000-000000000003",
              "name": "task_id",
              "value": "={{ $json.task_id }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "a1a1a1a1-0000-4000-8000-000000000005",
      "name": "Increment Attempt",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [-460, 520]
    },
    {
      "parameters": {
        "amount": 10,
        "unit": "seconds"
      },
      "id": "a1a1a1a1-0000-4000-8000-000000000006",
      "name": "Wait 10s",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [-240, 520],
      "webhookId": "e1e1e1e1-0000-4000-8000-000000000001"
    },
    {
      "parameters": {
        "method": "GET",
        "url": "https://turnscribe.com/api/v1/transcribe/status/",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "transcript_id",
              "value": "={{ $json.transcript_id }}"
            },
            {
              "name": "task_id",
              "value": "={{ $json.task_id }}"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Api-Key YOUR_API_KEY_HERE"
            }
          ]
        },
        "options": {}
      },
      "id": "a1a1a1a1-0000-4000-8000-000000000007",
      "name": "Check Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [-20, 520]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c1c1c1c1-0000-4000-8000-000000000002",
              "leftValue": "={{ $json.status }}",
              "rightValue": "PENDING",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "id": "c1c1c1c1-0000-4000-8000-000000000003",
              "leftValue": "={{ $json.attempt }}",
              "rightValue": 30,
              "operator": {
                "type": "number",
                "operation": "lt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "a1a1a1a1-0000-4000-8000-000000000008",
      "name": "Still Pending?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [200, 520]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://turnscribe.com/api/v1/transcribe/summary/",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Api-Key YOUR_API_KEY_HERE"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { \"transcript_id\": $json.transcript_id } }}",
        "options": {}
      },
      "id": "a1a1a1a1-0000-4000-8000-000000000009",
      "name": "Generate Summary (Premium)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [420, 260]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://turnscribe.com/api/v1/transcribe/translate/",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Api-Key YOUR_API_KEY_HERE"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { \"transcript_id\": $json.transcript_id, \"target_lang\": $('Input').item.json.target_lang } }}",
        "options": {}
      },
      "id": "a1a1a1a1-0000-4000-8000-000000000010",
      "name": "Translate Transcript (Premium)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [420, 420]
    },
    {
      "parameters": {},
      "id": "a1a1a1a1-0000-4000-8000-000000000011",
      "name": "Done",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [640, 340]
    }
  ],
  "connections": {
    "When clicking 'Execute Workflow'": {
      "main": [[{ "node": "Input", "type": "main", "index": 0 }]]
    },
    "Input": {
      "main": [[{ "node": "Submit Transcription", "type": "main", "index": 0 }]]
    },
    "Submit Transcription": {
      "main": [[{ "node": "Already Completed?", "type": "main", "index": 0 }]]
    },
    "Already Completed?": {
      "main": [
        [{ "node": "Generate Summary (Premium)", "type": "main", "index": 0 }],
        [{ "node": "Increment Attempt", "type": "main", "index": 0 }]
      ]
    },
    "Increment Attempt": {
      "main": [[{ "node": "Wait 10s", "type": "main", "index": 0 }]]
    },
    "Wait 10s": {
      "main": [[{ "node": "Check Status", "type": "main", "index": 0 }]]
    },
    "Check Status": {
      "main": [[{ "node": "Still Pending?", "type": "main", "index": 0 }]]
    },
    "Still Pending?": {
      "main": [
        [{ "node": "Increment Attempt", "type": "main", "index": 0 }],
        [{ "node": "Generate Summary (Premium)", "type": "main", "index": 0 }]
      ]
    },
    "Generate Summary (Premium)": {
      "main": [[{ "node": "Translate Transcript (Premium)", "type": "main", "index": 0 }]]
    },
    "Translate Transcript (Premium)": {
      "main": [[{ "node": "Done", "type": "main", "index": 0 }]]
    }
  },
  "pinData": {},
  "meta": {
    "instanceId": "turnscribe-example-workflow"
  }
}
