From 99a6069d3c58253c0a1ed028fbf62ac0504e2c1a Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 30 Jul 2025 16:55:24 -0400 Subject: [PATCH 1/4] updates --- .../create-captions/create-captions.mjs | 4 +- .../get-transcription/get-transcription.mjs | 87 ++--------------- .../transcribe-audio/transcribe-audio.mjs | 97 +++++++++++++++++++ components/assemblyai/package.json | 2 +- .../new-transcription-completed.mjs | 18 +++- 5 files changed, 123 insertions(+), 85 deletions(-) create mode 100644 components/assemblyai/actions/transcribe-audio/transcribe-audio.mjs diff --git a/components/assemblyai/actions/create-captions/create-captions.mjs b/components/assemblyai/actions/create-captions/create-captions.mjs index 8fb97f6f89717..4a80f50f5104e 100644 --- a/components/assemblyai/actions/create-captions/create-captions.mjs +++ b/components/assemblyai/actions/create-captions/create-captions.mjs @@ -2,9 +2,9 @@ import assemblyai from "../../assemblyai.app.mjs"; export default { name: "Create Captions", - description: "Export your completed transcripts in SRT (srt) or VTT (vtt) format, which can be used for subtitles and closed captions in videos. [See the documentation](https://www.assemblyai.com/docs/API%20reference/transcript)", + description: "Export your completed transcripts in SRT (srt) or VTT (vtt) format, which can be used for subtitles and closed captions in videos. [See the documentation](https://www.assemblyai.com/docs/api-reference/transcripts/get-subtitles)", key: "assemblyai-create-captions", - version: "0.0.2", + version: "0.0.3", type: "action", props: { assemblyai, diff --git a/components/assemblyai/actions/get-transcription/get-transcription.mjs b/components/assemblyai/actions/get-transcription/get-transcription.mjs index 0be26b1b831a9..fb83e5a1485f2 100644 --- a/components/assemblyai/actions/get-transcription/get-transcription.mjs +++ b/components/assemblyai/actions/get-transcription/get-transcription.mjs @@ -2,95 +2,26 @@ import assemblyai from "../../assemblyai.app.mjs"; export default { name: "Get Transcription", - description: "Fetches a specific transcribed result from the AssemblyAI API. [See the documentation](https://www.assemblyai.com/docs/API%20reference/transcript)", + description: "Fetches a specific transcribed result from the AssemblyAI API. [See the documentation](https://www.assemblyai.com/docs/api-reference/transcripts/get)", key: "assemblyai-get-transcription", - version: "0.0.4", + version: "0.0.1", type: "action", props: { assemblyai, - url: { - type: "string", - label: "URL", - description: "The URL of your media file to transcribe.", - }, - languageCode: { + transcriptId: { propDefinition: [ assemblyai, - "languageCode", + "transcriptId", ], }, - punctuate: { - type: "boolean", - label: "Punctuate", - description: "Enable Automatic Punctuation", - optional: true, - }, - speakerLabels: { - type: "boolean", - label: "Speaker Labels", - description: "Enable Speaker diarization", - optional: true, - }, - contentSafety: { - type: "boolean", - label: "Content Safety", - description: "Enable Content Moderation", - optional: true, - }, - sentimentAnalysis: { - type: "boolean", - label: "Sentiment Analysis", - description: "Enable Sentiment Analysis", - optional: true, - }, - webhookUrl: { - type: "string", - label: "Webhook URL", - description: "The URL we should send webhooks to when your transcript is complete", - optional: true, - }, - callbackWithRerun: { - type: "boolean", - label: "Callback With Rerun", - description: "Use the `$.flow.rerun` Node.js helper to rerun the step when the transcription is completed. Overrides the `webhookUrl` prop. This will increase execution time and credit usage as a result. [See the documentation(https://pipedream.com/docs/code/nodejs/rerun/#flow-rerun). Not available in Pipedream Connect.", - optional: true, - }, }, async run({ $ }) { - let response; - const context = $.context; - const run = context - ? context.run - : { - runs: 1, - }; - if (run.runs === 1) { - let webhookUrl = this.webhookUrl; - if (context && this.callbackWithRerun) { - ({ resume_url: webhookUrl } = $.flow.rerun(600000, null, 1)); - } - response = await this.assemblyai.createTranscript({ - data: { - audio_url: this.url, - language_code: this.languageCode, - punctuate: this.punctuate, - speaker_labels: this.speakerLabels, - content_safety: this.contentSafety, - sentiment_analysis: this.sentimentAnalysis, - webhook_url: webhookUrl, - }, - $, - }); - } - if (run.callback_request) { - response = await this.assemblyai.getTranscript({ - transcriptId: run.callback_request.body.transcript_id, - }); - } + const response = await this.assemblyai.getTranscript({ + transcriptId: this.transcriptId, + $, + }); - if (response?.id) { - $.export("$summary", `Successfully created transcription with ID ${response.id}.`); - } + $.export("$summary", `Successfully retrieved transcription for transcript with ID ${this.transcriptId}.`); return response; }, diff --git a/components/assemblyai/actions/transcribe-audio/transcribe-audio.mjs b/components/assemblyai/actions/transcribe-audio/transcribe-audio.mjs new file mode 100644 index 0000000000000..7e336c456b50e --- /dev/null +++ b/components/assemblyai/actions/transcribe-audio/transcribe-audio.mjs @@ -0,0 +1,97 @@ +import assemblyai from "../../assemblyai.app.mjs"; + +export default { + name: "Transcribe Audio", + description: "Create a transcript from a media file that is accessible via a URL. [See the documentation](https://www.assemblyai.com/docs/api-reference/transcripts/submit)", + key: "assemblyai-transcribe-audio", + version: "0.1.0", + type: "action", + props: { + assemblyai, + url: { + type: "string", + label: "URL", + description: "The URL of your media file to transcribe.", + }, + languageCode: { + propDefinition: [ + assemblyai, + "languageCode", + ], + }, + punctuate: { + type: "boolean", + label: "Punctuate", + description: "Enable Automatic Punctuation", + optional: true, + }, + speakerLabels: { + type: "boolean", + label: "Speaker Labels", + description: "Enable Speaker diarization", + optional: true, + }, + contentSafety: { + type: "boolean", + label: "Content Safety", + description: "Enable Content Moderation", + optional: true, + }, + sentimentAnalysis: { + type: "boolean", + label: "Sentiment Analysis", + description: "Enable Sentiment Analysis", + optional: true, + }, + webhookUrl: { + type: "string", + label: "Webhook URL", + description: "The URL we should send webhooks to when your transcript is complete", + optional: true, + }, + callbackWithRerun: { + type: "boolean", + label: "Callback With Rerun", + description: "Use the `$.flow.rerun` Node.js helper to rerun the step when the transcription is completed. Overrides the `webhookUrl` prop. This will increase execution time and credit usage as a result. [See the documentation(https://pipedream.com/docs/code/nodejs/rerun/#flow-rerun). Not available in Pipedream Connect.", + optional: true, + }, + }, + async run({ $ }) { + let response; + const context = $.context; + const run = context + ? context.run + : { + runs: 1, + }; + if (run.runs === 1) { + let webhookUrl = this.webhookUrl; + if (context && this.callbackWithRerun) { + ({ resume_url: webhookUrl } = $.flow.rerun(600000, null, 1)); + } + response = await this.assemblyai.createTranscript({ + data: { + audio_url: this.url, + language_code: this.languageCode, + punctuate: this.punctuate, + speaker_labels: this.speakerLabels, + content_safety: this.contentSafety, + sentiment_analysis: this.sentimentAnalysis, + webhook_url: webhookUrl, + }, + $, + }); + } + if (run.callback_request) { + response = await this.assemblyai.getTranscript({ + transcriptId: run.callback_request.body.transcript_id, + }); + } + + if (response?.id) { + $.export("$summary", `Successfully created transcription with ID ${response.id}.`); + } + + return response; + }, +}; diff --git a/components/assemblyai/package.json b/components/assemblyai/package.json index 512ce1a4a6e5d..3a56d27799cf4 100644 --- a/components/assemblyai/package.json +++ b/components/assemblyai/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/assemblyai", - "version": "0.2.2", + "version": "0.3.0", "description": "Pipedream AssemblyAI Components", "main": "assemblyai.app.mjs", "keywords": [ diff --git a/components/assemblyai/sources/new-transcription-completed/new-transcription-completed.mjs b/components/assemblyai/sources/new-transcription-completed/new-transcription-completed.mjs index 69df9c21c519e..e3baa5c299765 100644 --- a/components/assemblyai/sources/new-transcription-completed/new-transcription-completed.mjs +++ b/components/assemblyai/sources/new-transcription-completed/new-transcription-completed.mjs @@ -3,9 +3,9 @@ import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; export default { name: "New Transcription Completed", - description: "Emit new event when a transcribed audio file from AssemblyAI is ready. [See the documentation](https://www.assemblyai.com/docs/API%20reference/transcript)", + description: "Emit new event when a transcribed audio file from AssemblyAI is ready. [See the documentation](https://www.assemblyai.com/docs/api-reference/transcripts/list)", key: "assemblyai-new-transcription-completed", - version: "0.0.2", + version: "0.1.0", type: "source", dedupe: "unique", props: { @@ -30,7 +30,7 @@ export default { return; } this._setLastId(transcripts[0].id); - transcripts.reverse().forEach((transcript) => this.emitEvent(transcript)); + await this.emitTranscripts(transcripts); }, }, methods: { @@ -44,6 +44,14 @@ export default { const meta = this.generateMeta(transcript); this.$emit(transcript, meta); }, + async emitTranscripts(transcripts) { + for (const transcript of transcripts.reverse()) { + const data = await this.assemblyai.getTranscript({ + transcriptId: transcript.id, + }); + this.emitEvent(data); + } + }, generateMeta(transcript) { return { id: transcript.id, @@ -63,7 +71,9 @@ export default { if (!transcripts.length) { return; } - transcripts.forEach((transcript) => this.emitEvent(transcript)); + this._setLastId(transcripts[0].id); + + await this.emitTranscripts(transcripts); }, }; From 505ac2f7c77579831525fe911693a8b3f2032947 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 30 Jul 2025 16:57:13 -0400 Subject: [PATCH 2/4] pnpm-lock.yaml --- pnpm-lock.yaml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 777d319172859..49796287db305 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10018,8 +10018,7 @@ importers: specifier: ^0.10.0 version: 0.10.0 - components/pdf_munk: - specifiers: {} + components/pdf_munk: {} components/pdffiller: dependencies: @@ -11686,8 +11685,7 @@ importers: specifier: ^0.10.0 version: 0.10.0 - components/rocketskip: - specifiers: {} + components/rocketskip: {} components/rockset: dependencies: @@ -12292,8 +12290,7 @@ importers: specifier: ^3.0.3 version: 3.0.3 - components/serenity_ai_hub: - specifiers: {} + components/serenity_ai_hub: {} components/serpapi: dependencies: @@ -13698,8 +13695,7 @@ importers: specifier: ^1.6.0 version: 1.6.6 - components/templatedocs: - specifiers: {} + components/templatedocs: {} components/tento8: {} @@ -14341,8 +14337,7 @@ importers: components/typebot: {} - components/typeflo: - specifiers: {} + components/typeflo: {} components/typeflowai: dependencies: From eb4f022fe56fed28aec448c8b795b48a61bd92e3 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 30 Jul 2025 16:59:43 -0400 Subject: [PATCH 3/4] version --- .../assemblyai/actions/get-transcription/get-transcription.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/assemblyai/actions/get-transcription/get-transcription.mjs b/components/assemblyai/actions/get-transcription/get-transcription.mjs index fb83e5a1485f2..8c7ebfbf435fa 100644 --- a/components/assemblyai/actions/get-transcription/get-transcription.mjs +++ b/components/assemblyai/actions/get-transcription/get-transcription.mjs @@ -4,7 +4,7 @@ export default { name: "Get Transcription", description: "Fetches a specific transcribed result from the AssemblyAI API. [See the documentation](https://www.assemblyai.com/docs/api-reference/transcripts/get)", key: "assemblyai-get-transcription", - version: "0.0.1", + version: "0.1.0", type: "action", props: { assemblyai, From 4759ba1b56768167ca0fa9bf759f8abba603e918 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 30 Jul 2025 17:08:03 -0400 Subject: [PATCH 4/4] update --- .../assemblyai/actions/transcribe-audio/transcribe-audio.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/assemblyai/actions/transcribe-audio/transcribe-audio.mjs b/components/assemblyai/actions/transcribe-audio/transcribe-audio.mjs index 7e336c456b50e..1dd5c065aafa9 100644 --- a/components/assemblyai/actions/transcribe-audio/transcribe-audio.mjs +++ b/components/assemblyai/actions/transcribe-audio/transcribe-audio.mjs @@ -52,7 +52,7 @@ export default { callbackWithRerun: { type: "boolean", label: "Callback With Rerun", - description: "Use the `$.flow.rerun` Node.js helper to rerun the step when the transcription is completed. Overrides the `webhookUrl` prop. This will increase execution time and credit usage as a result. [See the documentation(https://pipedream.com/docs/code/nodejs/rerun/#flow-rerun). Not available in Pipedream Connect.", + description: "Use the `$.flow.rerun` Node.js helper to rerun the step when the transcription is completed. Overrides the `webhookUrl` prop. This will increase execution time and credit usage as a result. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun/#flow-rerun). Not available in Pipedream Connect.", optional: true, }, },