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

[CAL-3718] Improvement in webhooks documentation #15033

Open
hussamkhatib opened this issue May 14, 2024 · 2 comments · May be fixed by #15036
Open

[CAL-3718] Improvement in webhooks documentation #15033

hussamkhatib opened this issue May 14, 2024 · 2 comments · May be fixed by #15036
Labels
docs area: docs, documentation, cal.com/docs webhooks area: webhooks, callback, webhook payload
Milestone

Comments

@hussamkhatib
Copy link
Contributor

hussamkhatib commented May 14, 2024

Issue Summary

  1. The documentation has mentioned general payload structure for common events like BOOKING_CREATED, BOOKING_RESHEDULED. This isn't the case for all events, for example the payload for RECORDING_READY is as show below
export interface RECORDING_READY {
  type: string
  title: string
  startTime: string
  endTime: string
  organizer: Organizer
  attendees?: AttendeesEntity[] | null
  uid: string
  downloadLink: string
}
  1. When does the MEETING_ENDED webhook trigger, does it trigger at the endDate of booking or when the meeting end call button is pressed.? Upon testing it looks like it is triggered upon the booking end date, but I got payload as undefined for this particular event, which again isn't documented. Is there a webhook that can be triggerred upon the end call button press ?
  2. Is there a guide on how to test each of the webhook locally ? Right now because of the 1st 2 issues mentioned above I can't rely upon the payload structure and handle each event without testing.

Steps to Reproduce

  1. Have webhook setup done
  2. Book a meeting & wait for few hours so that MEETING_ENDED webhook gets triggered (Make sure to add logs to view the payload)
  3. Payload will be logged as undefined

Evidence

image

{
     triggerEvent: 'BOOKING_CREATED',
     payload: {
       bookerUrl: 'https://cal.com',
       type: 'test',
       title: 'test between Hussam Khatib and Hussam',
       description: '',
       additionalNotes: '',
       customInputs: {},
       startTime: '2024-05-14T18:44:50Z',
       endTime: '2024-05-14T18:45:50Z',
       organizer: {
         id: 64419,
         name: 'Hussam Khatib',
         email: 'XXXX',
         username: 'hussamkhatib',
         timeZone: 'Asia/Calcutta',
         language: [Object],
         timeFormat: 'h:mma',
         utcOffset: 330
       },
       responses: {
         name: [Object],
         email: [Object],
         location: [Object],
         title: [Object],
         notes: [Object],
         guests: [Object],
         rescheduleReason: [Object]
       },
       userFieldsResponses: {},
       attendees: [ [Object] ],
       location: 'integrations:daily',
       destinationCalendar: null,
       hideCalendarNotes: false,
       requiresConfirmation: false,
       eventTypeId: 788720,
       seatsShowAttendees: true,
       seatsPerTimeSlot: null,
       seatsShowAvailabilityCount: true,
       schedulingType: null,
       iCalUID: 'hR5Lzz7BmE1s1erY6Zd5at@Cal.com',
       iCalSequence: 0,
       uid: 'hR5Lzz7BmE1s1erY6Zd5at',
       conferenceData: { createRequest: [Object] },
       videoCallData: {
         type: 'daily_video',
         id: 'ALdi4m4zTcloI3TojObR',
         password: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyIjoiQUxkaTRtNHpUY2xvSTNUb2pPYlIiLCJleHAiOjE3MTY5MjE5NTAsIm8iOnRydWUsImQiOiJiYmQ5OGE3MS0xOWM5LTRiYjEtYTVjNS1jYWYxZWM1YmQxMDUiLCJpYXQiOjE3MTU3MTIyNDJ9.YZadx_BZXTp6yEc3I3rpIX_h9Tay5NiLQouaHOGJWWQ',
         url: 'https://meetco.daily.co/ALdi4m4zTcloI3TojObR'
       },
       appsStatus: [ [Object] ],
       eventTitle: 'test',
       eventDescription: '',
       price: 0,
       currency: 'usd',
       length: 1,
       bookingId: 2030802,
       metadata: {
         videoCallUrl: 'https://app.cal.com/video/hR5Lzz7BmE1s1erY6Zd5at'
       },
       status: 'ACCEPTED'
     },
     reqBody: {
       triggerEvent: 'BOOKING_CREATED',
       createdAt: '2024-05-14T18:44:03.645Z',
       payload: {
         bookerUrl: 'https://cal.com',
         type: 'test',
         title: 'test between Hussam Khatib and Hussam',
         description: '',
         additionalNotes: '',
         customInputs: {},
         startTime: '2024-05-14T18:44:50Z',
         endTime: '2024-05-14T18:45:50Z',
         organizer: [Object],
         responses: [Object],
         userFieldsResponses: {},
         attendees: [Array],
         location: 'integrations:daily',
         destinationCalendar: null,
         hideCalendarNotes: false,
         requiresConfirmation: false,
         eventTypeId: 788720,
         seatsShowAttendees: true,
         seatsPerTimeSlot: null,
         seatsShowAvailabilityCount: true,
         schedulingType: null,
         iCalUID: 'hR5Lzz7BmE1s1erY6Zd5at@Cal.com',
         iCalSequence: 0,
         uid: 'hR5Lzz7BmE1s1erY6Zd5at',
         conferenceData: [Object],
         videoCallData: [Object],
         appsStatus: [Array],
         eventTitle: 'test',
         eventDescription: '',
         price: 0,
         currency: 'usd',
         length: 1,
         bookingId: 2030802,
         metadata: [Object],
         status: 'ACCEPTED'
       }
     }
   }
{
     triggerEvent: 'MEETING_STARTED',
     payload: undefined,
     reqBody: {
       triggerEvent: 'MEETING_STARTED',
       id: 2030837,
       uid: 'b7bUM9yNBpURfEtRy5fSYM',
       idempotencyKey: 'c86af8f1-2d63-5a04-ad8d-d209fc691a56',
       userId: 64419,
       userPrimaryEmail: 'hussamkhatib20@gmail.com',
       eventTypeId: 788720,
       title: 'test between Hussam Khatib and Hussam',
       description: '',
       customInputs: {},
       responses: {
         name: 'Hussam',
         email: 'hussam@shippercrm.com',
         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/hR5Lzz7BmE1s1erY6Zd5at'
       },
       isRecorded: false,
       iCalUID: 'hR5Lzz7BmE1s1erY6Zd5at@Cal.com',
       iCalSequence: 0,
       rating: null,
       ratingFeedback: null,
       noShowHost: null,
       user: {
         email: 'hussamkhatib20@gmail.com',
         name: 'Hussam Khatib',
         timeZone: 'Asia/Calcutta',
         username: 'hussamkhatib'
       },
       attendees: [ [Object] ],
       payment: [],
       references: [],
       appsStatus: [ [Object] ]
     }
   }

From SyncLinear.com | CAL-3718

Copy link

dosubot bot commented May 14, 2024

To address your concerns:

  1. The payload for RECORDING_READY you've mentioned seems to be missing some fields based on the current implementation in the repository. The actual structure includes additional fields such as recording_id, end_ts, room_name, start_ts, status, max_participants, duration, and s3_key. It's important to cross-reference with the latest codebase for the most accurate structure.

  2. The MEETING_ENDED webhook triggers at the booking's end date, not when the end call button is pressed. The issue with the payload being undefined could be due to how properties are accessed; if the base object is null, any further property access will result in undefined.

  3. For local testing of webhook events, you can simulate webhook events by sending test requests that match the expected schema to specific endpoints, as outlined in the repository's documentation. Make sure your environment is correctly set up with the necessary variables for a successful test.

This approach should help you handle each event more reliably and test them effectively in your local environment.

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 dosubot bot added docs area: docs, documentation, cal.com/docs webhooks area: webhooks, callback, webhook payload labels May 14, 2024
@Udit-takkar
Copy link
Contributor

Is there a guide on how to test each of the webhook locally ? Right now because of the 1st 2 issues mentioned above I can't rely upon the payload structure and handle each event without testing.

you just have to set sendgrid credentials variables locally. There was also a single button "test webhook" but we had to remove it to prevent abuse/spam.

@dosubot dosubot bot added this to the v4.1 milestone May 15, 2024
@keithwillcode keithwillcode modified the milestones: v4.1, v4.2 May 15, 2024
@keithwillcode keithwillcode changed the title Improvement in webhooks documentation [CAL-3718] Improvement in webhooks documentation May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs area: docs, documentation, cal.com/docs webhooks area: webhooks, callback, webhook payload
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants