{
  "id": "QfT5HDT3bofhxjwn",
  "name": "Rask Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "22b6b07b-c7fc-4619-a745-c35c8f000398",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "disabled": true,
      "position": [
        80,
        32
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "link"
            },
            {
              "name": "dst_lang"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "99d50f32-f827-4927-a2eb-43616249f12f",
      "name": "Upload media",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        288,
        32
      ],
      "parameters": {
        "url": "https://api.rask.ai/api/library/v1/media/link",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "link",
              "value": "={{ $json.link }}"
            },
            {
              "name": "kind",
              "value": "video"
            },
            {
              "name": "name",
              "value": "n8n"
            }
          ]
        },
        "genericAuthType": "oAuth2Api"
      },
      "credentials": {
        "oAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "61ca8c62-4fc4-4ebc-a474-322b71d9f3de",
      "name": "Get media",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        560,
        32
      ],
      "parameters": {
        "url": "=https://api.rask.ai/api/library/v1/media/{{ $json.id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api"
      },
      "credentials": {
        "oAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "23934d94-e09f-4e08-aacd-954142c4129f",
      "name": "Switch media status",
      "type": "n8n-nodes-base.switch",
      "position": [
        736,
        16
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Error",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "bb4b1d24-8001-4737-919d-267e9c673ab7",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "failed"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Ready",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a4c379b2-52cf-4c97-a2b6-5cc228866cea",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "ready"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Processing",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "909b6647-17b6-4534-a45d-f0fd5e856b9c",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "processing"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "6db094e3-bcbc-4107-832a-3288a691c33b",
      "name": "Create project",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1136,
        32
      ],
      "parameters": {
        "url": "https://api.rask.ai/v2/projects",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "video_id",
              "value": "={{ $('Get media').item.json.id }}"
            },
            {
              "name": "dst_lang",
              "value": "={{ $('When Executed by Another Workflow').item.json.dst_lang }}"
            },
            {
              "name": "name",
              "value": "n8n"
            }
          ]
        },
        "genericAuthType": "oAuth2Api"
      },
      "credentials": {
        "oAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "d95dc5d2-5931-46fc-a9fc-5f377647d402",
      "name": "Get project",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1408,
        32
      ],
      "parameters": {
        "url": "=https://api.rask.ai/v2/projects/{{ $json.id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api"
      },
      "credentials": {
        "oAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "40476eca-0f11-48fb-a47e-4b44892194c6",
      "name": "Wait media processing",
      "type": "n8n-nodes-base.wait",
      "position": [
        736,
        256
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "aa544bdb-9ea3-454e-b3a2-209c20b23efa",
      "name": "Switch project status",
      "type": "n8n-nodes-base.switch",
      "position": [
        1600,
        16
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Error",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "bb4b1d24-8001-4737-919d-267e9c673ab7",
                    "operator": {
                      "type": "string",
                      "operation": "endsWith"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "failed"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Ready",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a4c379b2-52cf-4c97-a2b6-5cc228866cea",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "merging_done"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Processing",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0cc0e027-4498-4988-ace2-865e306110fd",
                    "operator": {
                      "type": "string",
                      "operation": "notEquals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "merging_done"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "19a30888-4790-4e8a-8678-9ea43338b934",
      "name": "Wait project processing",
      "type": "n8n-nodes-base.wait",
      "position": [
        1600,
        256
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "c530c42f-d6f6-43cb-80ee-b413d1ba8533",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 640,
        "content": "### \ud83c\udfaf  Media processing\n\nThe [media entity](https://docs.api.rask.ai/api-reference/media/get_media) polling is used to wait until the media is ready.\n\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2e674346-b986-4e24-b8de-311e369a1e5d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1328,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 640,
        "content": "### \ud83c\udfaf Project processing\n\nThe [translation project entity](https://docs.api.rask.ai/api-reference/project/get_project) polling is used to wait until the project is ready. After that, the dubbing is complete and you can get all the necessary artifacts.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9344f77a-7342-4a21-9033-66894a1750e8",
      "name": "Uploading failed",
      "type": "n8n-nodes-base.stopAndError",
      "position": [
        912,
        -64
      ],
      "parameters": {
        "errorMessage": "Video uploading failed"
      },
      "typeVersion": 1
    },
    {
      "id": "0bfa6172-d8ab-46f9-a092-54c317cc5b43",
      "name": "Processing failed",
      "type": "n8n-nodes-base.stopAndError",
      "position": [
        1776,
        -64
      ],
      "parameters": {
        "errorMessage": "Project processing failed"
      },
      "typeVersion": 1
    },
    {
      "id": "e48713e4-8e3c-4ecb-afaf-cda65fb6a90d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        -496
      ],
      "parameters": {
        "width": 656,
        "height": 960,
        "content": "##  \ud83c\udfac Rask AI Video Translation Workflow\n\nThis workflow is designed to **translate a video accessible by URL** (supported sources: YouTube, Google Drive, S3, Vimeo, or a direct link) into [a language supported by Rask AI](https://docs.api.rask.ai/languages/destination).  \n\nIt automatically uploads your video, waits for it to finish processing, creates a translation project, and retrieves the final translated output.\n\nYou can use it to quickly build automations for localization, multilingual content creation, training materials, and more.\n\n###  \ud83d\udd10 Authentication\n\nTo run this workflow, make sure you have **OAuth2 authentication** configured in n8n under the name **`raskOAuth2`**.\n\nYour OAuth2 credentials must include **Client ID**  and **Client Secret**\n\nYou can find both in your Rask account settings:  \n\ud83d\udc49 https://app.rask.ai/account\n\nFor details on Rask authentication, refer to the official documentation:  \n\ud83d\udc49 https://docs.api.rask.ai/api-reference/authentication\n\nEnsure that the **`raskOAuth2`** authentication is selected in the following nodes: **Upload media**,  **Get media**, **Create project**, **Get project**\n\nThese nodes interact with the Rask API and require valid credentials.\n\n###  \ud83e\uddea Test Input\n\nYou can test the workflow using the following sample values (simply insert these values into your trigger or input node to run a full translation cycle end-to-end.):\n\n- **`link`**:  \n  `https://static.rask.ai/samples/sample_1.mp4`\n\n- **`dst_lang`** (target translation language):  \n  `en-us`\n--- \n\nHappy Translating! \ud83c\udf0d\u2728"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2872f57c-aec8-44e1-b894-d67ba6d15fb5",
  "connections": {
    "Get media": {
      "main": [
        [
          {
            "node": "Switch media status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get project": {
      "main": [
        [
          {
            "node": "Switch project status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload media": {
      "main": [
        [
          {
            "node": "Get media",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create project": {
      "main": [
        [
          {
            "node": "Get project",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch media status": {
      "main": [
        [
          {
            "node": "Uploading failed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create project",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait media processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch project status": {
      "main": [
        [
          {
            "node": "Processing failed",
            "type": "main",
            "index": 0
          }
        ],
        [],
        [
          {
            "node": "Wait project processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait media processing": {
      "main": [
        [
          {
            "node": "Get media",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait project processing": {
      "main": [
        [
          {
            "node": "Get project",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Upload media",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}