Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: RECORDING_TRANSCRIPTION_GENERATED webhook #15589

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Udit-takkar
Copy link
Contributor

@Udit-takkar Udit-takkar commented Jun 26, 2024

What does this PR do?

TODO:

  • Add unit tests

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have added a Docs issue here if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

It'll be a little difficult to test this locally

  1. Create a event type and create a new trigger TRANSCRIPTION_GENERATED

  2. Now Create a booking with that event type.

  3. comment L185 and in L187 replace bookingReference.bookingId with booking ID that you created above (in file apps/web/pages/api/recorded-daily-video.ts)

    const booking = await getBooking(bookingReference.bookingId as number);
     const booking = await getBooking(YOUR_BOOKING_ID);
    

    and comment line const computed_signature = computeSignature(hmacSecret, req.body, req.headers["x-webhook-timestamp"]);

  4. Now make a POST request to /api/recorded-daily-video with this payload https://github.com/calcom/cal.com/pull/15589/files#r1660164633

Copy link

linear bot commented Jun 26, 2024

@github-actions github-actions bot added High priority Created by Linear-GitHub Sync webhooks area: webhooks, callback, webhook payload ✨ feature New feature or request ❗️ migrations contains migration files and removed ✨ feature New feature or request High priority Created by Linear-GitHub Sync webhooks area: webhooks, callback, webhook payload labels Jun 26, 2024
@keithwillcode keithwillcode added consumer core area: core, team members only labels Jun 26, 2024
Copy link

vercel bot commented Jun 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ai ⬜️ Ignored (Inspect) Visit Preview Jun 30, 2024 0:37am
cal ⬜️ Ignored (Inspect) Visit Preview Jun 30, 2024 0:37am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Jun 30, 2024 0:37am

@github-actions github-actions bot added High priority Created by Linear-GitHub Sync webhooks area: webhooks, callback, webhook payload ✨ feature New feature or request labels Jun 27, 2024
@Udit-takkar Udit-takkar changed the title feat: RECORDING_TRANSCRIPTION_READY webhook feat: RECORDING_TRANSCRIPTION_GENERATED webhook Jun 29, 2024
Comment on lines +53 to +102
const BATCH_PROCESSOR_JOB_FINSISHED_PAYLOAD = {
version: "1.1.0",
type: "batch-processor.job-finished",
id: "77b1cb9e-cd79-43cd-bad6-3ccaccba26be",
payload: {
id: "77b1cb9e-cd79-43cd-bad6-3ccaccba26be",
status: "finished",
input: {
sourceType: "recordingId",
recordingId: "eb9e84de-783e-4e14-875d-94700ee4b976",
},
output: {
transcription: [
{
format: "json",
s3Config: {
key: "transcript.json",
bucket: "daily-bucket",
region: "us-west-2",
},
},
{
format: "srt",
s3Config: {
key: "transcript.srt",
bucket: "daily-bucket",
region: "us-west-2",
},
},
{
format: "txt",
s3Config: {
key: "transcript.txt",
bucket: "daily-bucket",
region: "us-west-2",
},
},
{
format: "vtt",
s3Config: {
key: "transcript.vtt",
bucket: "daily-bucket",
region: "us-west-2",
},
},
],
},
},
event_ts: 1717688213.803,
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

payload received by endpoint /recorded-daily-video

@Udit-takkar Udit-takkar marked this pull request as ready for review June 30, 2024 12:36
@graphite-app graphite-app bot requested a review from a team June 30, 2024 12:36
@dosubot dosubot bot added the automated-tests area: unit tests, e2e tests, playwright label Jun 30, 2024
@dosubot dosubot bot added this to the v4.3 milestone Jun 30, 2024

const log = logger.getSubLogger({ prefix: ["daily-video-webhook-handler"] });

const commonSchema = z
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zod schemas moved to other file

Comment on lines -266 to -268
if (!bookingReference || !bookingReference.bookingId) {
return res.status(200).send({ message: "Booking reference not found" });
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added these checks inside getBookingReference

@@ -348,11 +166,57 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
const evt = await getCalendarEvent(booking);
await sendDailyVideoTranscriptEmails(evt, transcripts);

return res.status(200).json({ message: "Success" });
} else if (req.body?.type === "batch-processor.job-finished") {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new payload type that i added

Comment on lines +180 to +184
const roomName = await getRoomNameFromRecordingId(input.recordingId);

const bookingReference = await getBookingReference(roomName);

const booking = await getBooking(bookingReference.bookingId as number);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the payload didn't have roomName or bookingId. we first get the roomName from recordingId and then get bookingId from bookingReference

Copy link

graphite-app bot commented Jun 30, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (06/30/24)

1 reviewer was added to this PR based on Keith Williams's automation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automated-tests area: unit tests, e2e tests, playwright consumer core area: core, team members only ✨ feature New feature or request High priority Created by Linear-GitHub Sync ❗️ migrations contains migration files webhooks area: webhooks, callback, webhook payload
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-3976] TRANSCRIPTION_READY Webhook
2 participants