Skip to main content
function isCalendlyEvent(e) {
return e.data.event &&
e.data.event.indexOf('calendly') === 0;
};

window.addEventListener(
'message',
function(e) {
if (isCalendlyEvent(e)) {
console.log(e.data);
}
}
);

I am using the PopupWidget in a project. I am subscribing to the popup notifications as indicated in the documentation and updating the front-end accordingly.
The problem is that, when an event is cancelled through the popup, it doesn't emit any event, so I can't know at that moment that the user cancelled the event.
How can I solve this? Is there any way to detect it?

Hey there @Tobias15201!

Calendly has an open API that supports webhooks. With the v2 API, you can build a webhook to receive real-time Calendly meeting data at a specified URL, when an event is scheduled or canceled.

Specifically, you can subscribe to:

  • Invitee Created Events to receive notifications when a new Calendly event is scheduled
  • Invitee Canceled Events to receive notifications when a Calendly event is canceled
  • Routing Form Submissions to receive notifications when a user submits a Calendly routing form (whether an event is scheduled or not)

That second bullet point is what’s important to your question! =) 

To create a webhook subscription, you will need to authenticate with either a personal access token or an OAuth application. For more ways to use the Calendly API, view Calendly's API Use Cases.

For more information on how to create a webhook subscription, please visit our Developer Portal.

Once you've created a webhook, event data will be received at the endpoint you've specified. For sample payload data, view Webhook Payload.

To delete a webhook subscription, refer to Delete Webhook Subscription.

If an admin within your organization creates webhooks and later has their role demoted, or is removed from the organization, those webhooks remain active. You will need to delete them if necessary.

You can read more on all of this here! Let us know if you need further help. We’ll be here and happy to offer it!  

p.s. check out our New User Guide and our Company Admin Guide - they’re both full of tips + tricks that are super handy to have while you get started and learn the Calendly ropes, here! Happy scheduling! 🤗


Hey @Tobias15201 I just wanted to add some additional info to support my colleagues previous comment. I can confirm that if you want to track cancelled events, the webhook subscription is the best way to do this as it tracks the cancellation and sends that data in the payload. 

 

The code you leveraged, which was supplied in our documentation here: Notify the parent window is for 4 events: 

  1. Profile page viewed
  2. Event type viewed
  3. Invitee selects date and time
  4. Invitee schedules an event

So you will need to get creative in order to see when the popup is closed. You could use an analytics tool like Google analytics to pass data and compare a conversion event (scheduling an event) to the page views to get a rough popup close rate. You can learn more about our Google Analytics integration here