-
Notifications
You must be signed in to change notification settings - Fork 7k
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Ignored Deployments
|
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, | ||
}; |
There was a problem hiding this comment.
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
|
||
const log = logger.getSubLogger({ prefix: ["daily-video-webhook-handler"] }); | ||
|
||
const commonSchema = z |
There was a problem hiding this comment.
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
if (!bookingReference || !bookingReference.bookingId) { | ||
return res.status(200).send({ message: "Booking reference not found" }); | ||
} |
There was a problem hiding this comment.
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") { |
There was a problem hiding this comment.
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
const roomName = await getRoomNameFromRecordingId(input.recordingId); | ||
|
||
const bookingReference = await getBookingReference(roomName); | ||
|
||
const booking = await getBooking(bookingReference.bookingId as number); |
There was a problem hiding this comment.
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
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. |
What does this PR do?
TODO:
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
It'll be a little difficult to test this locally
Create a event type and create a new trigger TRANSCRIPTION_GENERATED
Now Create a booking with that event type.
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)
and comment line const computed_signature = computeSignature(hmacSecret, req.body, req.headers["x-webhook-timestamp"]);
Now make a POST request to /api/recorded-daily-video with this payload https://github.com/calcom/cal.com/pull/15589/files#r1660164633