Skip to content

Commit

Permalink
feat: add transcription as attachment (#18740)
Browse files Browse the repository at this point in the history
* feat: add transcription as attachment

* fix: change style
  • Loading branch information
Udit-takkar authored Jan 21, 2025
1 parent 3eb5490 commit 30eb7ce
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions apps/web/public/static/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,7 @@
"download_transcript": "Download Transcript",
"recording_from_your_recent_call": "A recording from your recent call on {{appName}} is ready for download",
"transcript_from_previous_call": "Transcript from your recent call on {{appName}} is ready to download. Links are valid only for 1 Hour",
"you_can_download_transcript_from_attachments": "You can also download transcript from attachments",
"link_valid_for_12_hrs": "Note: The download link is valid only for 12 hours. You can generate new download link by following instructions <1>here</1>.",
"create_your_first_form": "Create your first form",
"create_your_first_form_description": "With Routing Forms you can ask qualifying questions and route to the correct person or event type.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { TFunction } from "next-i18next";

import { WEBAPP_URL, APP_NAME, COMPANY_NAME } from "@calcom/lib/constants";
import { WEBAPP_URL, COMPANY_NAME } from "@calcom/lib/constants";

import { V2BaseEmailHtml, CallToAction } from "../components";
import { V2BaseEmailHtml } from "../components";

interface DailyVideoDownloadTranscriptEmailProps {
language: TFunction;
Expand Down Expand Up @@ -55,13 +55,13 @@ export const DailyVideoDownloadTranscriptEmail = (
<>{props.language("hi_user_name", { name: props.name })},</>
</p>
<p style={{ fontWeight: 400, lineHeight: "24px", marginBottom: "40px" }}>
<>{props.language("transcript_from_previous_call", { appName: APP_NAME })}</>
<>{props.language("you_can_download_transcript_from_attachments")}</>
</p>

{props.transcriptDownloadLinks.map((downloadLink, index) => {
{props.transcriptDownloadLinks.map((_, index) => {
return (
<div
key={downloadLink}
key={`transcript-${index}`}
style={{
backgroundColor: "#F3F4F6",
padding: "32px",
Expand All @@ -87,7 +87,6 @@ export const DailyVideoDownloadTranscriptEmail = (
}}>
{props.date} Transcript {index + 1}
</p>
<CallToAction label={props.language("download_transcript")} href={downloadLink} />
</div>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ export default class AttendeeDailyVideoDownloadTranscriptEmail extends BaseEmail
this.t = attendee.language.translate;
}
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const attachments = await Promise.all(
this.transcriptDownloadLinks.map(async (url, index) => {
const response = await fetch(url);
const buffer = await response.arrayBuffer();
return {
filename: `transcript-${index + 1}.vtt`,
content: Buffer.from(buffer),
contentType: "text/vtt",
};
})
);

return {
to: `${this.attendee.name} <${this.attendee.email}>`,
from: `${this.calEvent.organizer.name} <${this.getMailerOptions().from}>`,
Expand All @@ -36,6 +48,7 @@ export default class AttendeeDailyVideoDownloadTranscriptEmail extends BaseEmail
language: this.t,
name: this.attendee.name,
}),
attachments,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ export default class OrganizerDailyVideoDownloadTranscriptEmail extends BaseEmai
this.t = this.calEvent.organizer.language.translate;
}
protected async getNodeMailerPayload(): Promise<Record<string, unknown>> {
const attachments = await Promise.all(
this.transcriptDownloadLinks.map(async (url, index) => {
const response = await fetch(url);
const buffer = await response.arrayBuffer();
return {
filename: `transcript-${index + 1}.vtt`,
content: Buffer.from(buffer),
contentType: "text/vtt",
};
})
);

return {
to: `${this.calEvent.organizer.email}>`,
from: `${EMAIL_FROM_NAME} <${this.getMailerOptions().from}>`,
Expand All @@ -35,6 +47,7 @@ export default class OrganizerDailyVideoDownloadTranscriptEmail extends BaseEmai
language: this.t,
name: this.calEvent.organizer.name,
}),
attachments,
};
}

Expand Down

0 comments on commit 30eb7ce

Please sign in to comment.