cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

[CAL-3752] Unreliable Triggering and Payload Inconsistencies in Calcom Webhooks

Open hussamkhatib opened this issue 1 year ago • 12 comments

Issue Summary

My team has been facing issues with calcom webhooks one after the other. The triggering of the webhooks isn't reliable, so is the payload of the triggers

MEETING_STARTED and MEETING_ENDED

  • Triggers at incorrect time (For eg both meeting start and end was triggered at 4:54:13) Screenshot 2024-05-16 at 7 21 31 PM

  • Sometimes it does not trigger at all. (It might be the case when the booking is booked very close to the current time)

  • Irregular Request body (main issue)

    • 1st variant
 {
       triggerEvent: 'MEETING_STARTED',
       id: 2030837,
       uid: 'b7bUM9yNBpURfEtRy5fSYM',
       idempotencyKey: 'c86af8f1-2d63-5a04-ad8d-d209fc691a56',
       userId: 64419,
       userPrimaryEmail: '[email protected]',
       eventTypeId: 788720,
       title: 'test between Hussam Khatib and Hussam',
       description: '',
       customInputs: {},
       responses: {
         name: 'Hussam',
         email: '[email protected]',
         guests: [],
         location: [Object]
       },
       startTime: '2024-05-14T18:49:02.000Z',
       endTime: '2024-05-14T18:50:02.000Z',
       location: 'integrations:daily',
       createdAt: '2024-05-14T18:48:07.759Z',
       updatedAt: null,
       status: 'ACCEPTED',
       paid: false,
       destinationCalendarId: null,
       cancellationReason: null,
       rejectionReason: null,
       dynamicEventSlugRef: null,
       dynamicGroupSlugRef: null,
       rescheduled: null,
       fromReschedule: 'hR5Lzz7BmE1s1erY6Zd5at',
       recurringEventId: null,
       smsReminderNumber: null,
       scheduledJobs: [],
       metadata: {
         videoCallUrl: 'https://app.cal.com/video/xxxxxxxx'
       },
       isRecorded: false,
       iCalUID: '[email protected]',
       iCalSequence: 0,
       rating: null,
       ratingFeedback: null,
       noShowHost: null,
       user: {
         email: '[email protected]',
         name: 'Hussam Khatib',
         timeZone: 'Asia/Calcutta',
         username: 'hussamkhatib'
       },
       attendees: [ [Object] ],
       payment: [],
       references: [],
       appsStatus: [ [Object] ]
     }
   }

  • I had opened an issue for it, we had decided to move ahead with handling these 2 triggerEvent differently only to find out that something attendees is not defined.
  • There's no organizer Object.

RECORDING_READY

  • Does not trigger at all. (Note: It's been only few days since we are facing this Issue, it used to work fine a few days back)
  • Also has a different payload.
export interface RECORDING_READY {
  type: string
  title: string
  startTime: string
  endTime: string
  organizer: Organizer
  attendees?: AttendeesEntity[] | null
  uid: string
  downloadLink: string
}

Steps to Reproduce

Follow the steps mentioned in the docs to setup webhooks and print logs of the request body with timestamps Use the link provided in the meeting(CAL video) and record the meeting

Actual Results

  • You will find no logs printed for RECORDING_READY webhook
  • You should find a different payload for MEETING_STARTED and MEETING_ENDED than what is mentioned in the docs.

Evidence

  • The snippets above are Response of actual booking made app.cal.com

CAL-3752

hussamkhatib avatar May 16 '24 14:05 hussamkhatib

Hey @hussamkhatib, great to see you back! 😀 We definitely remember working through some challenges together. I'm diving into the details of what you've shared and will circle back with a comprehensive response soon.

dosubot[bot] avatar May 16 '24 14:05 dosubot[bot]

Additionally, the automated emails the calcom would send to all attendees and the organizer once the recording is completed, no longer get sent

l0g1x avatar May 16 '24 14:05 l0g1x

To address the issues you're encountering with Cal.com webhooks, let's dive into specifics:

  1. MEETING_STARTED and MEETING_ENDED Events Timing and Triggering:

    • The Cal.com system schedules triggers for MEETING_STARTED and MEETING_ENDED events based on the booking's start and end times, ensuring that events are triggered as expected, even for bookings made close to the current time. This process is managed through the scheduleTrigger function, which prepares and schedules the event triggers in the database.
  2. Payload Inconsistencies:

  3. RECORDING_READY Event and Automated Emails:

    • The RECORDING_READY event and the process for sending automated emails upon recording completion involve initializing classes with event and attendee details to prepare email payloads. Recent changes, such as the addition of RECORDING_READY to the WebhookTriggerEvents enum, could impact the triggering of this event and the email sending process. It's crucial to ensure that the application's logic is updated to handle this new event type properly.

For further assistance, please share more details about your Cal.com codebase version, the steps you're following to set up and trigger the webhooks, and any specific error messages or logs. This information will be vital for diagnosing and resolving the issues more effectively.

Details

Sources


About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

dosubot[bot] avatar May 16 '24 14:05 dosubot[bot]

Triggers at incorrect time (For eg both meeting start and end was triggered at 4:54:13)

Our meeting ended and started trigger doesn't trigger at the exact time as we have a corn job running every 5 minute that then triggers all webhooks. Your meeting starts at 4:50 and ends at 4:51, that's why both were triggered at the same time at 4:54

Sometimes it does not trigger at all. (It might be the case when the booking is booked very close to the current time)

That can happen when the trigger time is closer than 5 minutes to the current time. Also there was a current fix for another issue related to that https://github.com/calcom/cal.com/pull/14864, however old bookings that were created before the fix can still cause the issue

Irregular Request body (main issue)

We are currently working on fixing the request body of the meeting started and meeting ended trigger https://github.com/calcom/cal.com/pull/15036

RECORDING_READY Does not trigger at all. (Note: It's been only few days since we are facing this Issue, it used to work fine a few days back)

Tagging @Udit-takkar for this one


@hussamkhatib Let me know if I didn't address everything and if you have any questions to that

CarinaWolli avatar May 16 '24 19:05 CarinaWolli

added highest priority

PeerRich avatar May 17 '24 09:05 PeerRich

Thanks @CarinaWolli, that’s helpful!

hussamkhatib avatar May 17 '24 09:05 hussamkhatib

RECORDING_READY Does not trigger at all. (Note: It's been only few days since we are facing this Issue, it used to work fine a few days back)

This was fixed yesterday.

Udit-takkar avatar May 17 '24 10:05 Udit-takkar

We can’t figure out which PR you are referring to, mind linking it?

On Fri, May 17, 2024 at 5:14 AM Udit Takkar @.***> wrote:

RECORDING_READY Does not trigger at all. (Note: It's been only few days since we are facing this Issue, it used to work fine a few days back)

This was fixed yesterday.

— Reply to this email directly, view it on GitHub https://github.com/calcom/cal.com/issues/15078#issuecomment-2117225304, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJ4JMSPRB77FD5EOE6RDVTZCXJ6RAVCNFSM6AAAAABH2KLRFSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJXGIZDKMZQGQ . You are receiving this because you commented.Message ID: <calcom/cal. @.***>

l0g1x avatar May 17 '24 10:05 l0g1x

@l0g1x No PR was required for this. I had to make a POST request to restart subscribing to recording ready event.

Udit-takkar avatar May 17 '24 10:05 Udit-takkar

RECORDING_READY Does not trigger at all. (Note: It's been only few days since we are facing this Issue, it used to work fine a few days back)

This was fixed yesterday.

Thanks @Udit-takkar, It works now

hussamkhatib avatar May 17 '24 12:05 hussamkhatib

@Udit-takkar We had a Meeting an hour back, the recording ready din't trigger again.

hussamkhatib avatar May 20 '24 16:05 hussamkhatib

@Udit-takkar We had a Meeting an hour back, the recording ready din't trigger again.

Restarted this again. investigating why it's failing sometimes

Udit-takkar avatar May 20 '24 17:05 Udit-takkar

@Udit-takkar is this now working?

keithwillcode avatar Jul 24 '24 23:07 keithwillcode