Pular para conteúdo

AWS TRANSCRIBE - Get Job (Consultar Transcrição)

O que é esta operação?

A operação getJob do AWS Transcribe é responsável por consultar o status e resultado de um trabalho de transcrição.

Código

private async getJob(client: TranscribeClient, data: any, context: ExecutionContext): Promise<any> {
  const jobName = this.replaceVariables(data.jobName, context.variables);
  const command = new GetTranscriptionJobCommand({
    TranscriptionJobName: jobName,
  });
  const response = await client.send(command);
  return {
    transcriptionJob: response.TranscriptionJob,
    status: response.TranscriptionJob?.TranscriptionJobStatus,
    transcriptFileUri: response.TranscriptionJob?.Transcript?.TranscriptFileUri,
    languageCode: response.TranscriptionJob?.LanguageCode,
  };
}

Parâmetros

Campo Tipo Obrigatório Descrição
operation string Sim "getJob"
jobName string Sim Nome do job para consultar
responseVariable string Sim Variável para resultado

Exemplo: Polling de Status

{
  "name": "Verificar Status da Transcrição",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "transcribe_1",
      "type": "aws_transcribe",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "Verificar Status",
        "operation": "getJob",
        "config": {
          "region": "us-east-1",
          "accessKeyId": "KEY",
          "secretAccessKey": "SECRET"
        },
        "jobName": "{{transcriptionJobName}}",
        "responseVariable": "jobStatus"
      }
    },
    {
      "id": "condition_1",
      "type": "condition",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Status?",
        "parameters": {
          "variableA": "{{jobStatus.status}}",
          "operator": "equals",
          "variableB": "COMPLETED"
        }
      }
    },
    {
      "id": "message_ready",
      "type": "message",
      "position": { "x": 700, "y": 50 },
      "data": {
        "label": "Pronto",
        "parameters": {
          "message": "✅ Transcrição completa!\n\nDownload: {{jobStatus.transcriptFileUri}}"
        }
      }
    },
    {
      "id": "message_wait",
      "type": "message",
      "position": { "x": 700, "y": 150 },
      "data": {
        "label": "Aguardar",
        "parameters": {
          "message": "⏳ Status: {{jobStatus.status}}\n\nAinda processando..."
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "transcribe_1" },
    { "source": "transcribe_1", "target": "condition_1" },
    { "source": "condition_1", "target": "message_ready", "label": "true" },
    { "source": "condition_1", "target": "message_wait", "label": "false" },
    { "source": "message_ready", "target": "end_1" },
    { "source": "message_wait", "target": "end_1" }
  ]
}

Resposta

{
  "status": "COMPLETED",
  "transcriptFileUri": "https://s3.amazonaws.com/bucket/transcript.json",
  "languageCode": "pt-BR"
}

💡 Dica: O transcriptFileUri contém o JSON com o texto transcrito completo.

startJob | deleteJob