urlcurlwebhookscalendly

Is this Calendly.com URL Valid?


I am using webhooks for the first time with calendly.com. I would like to create a subscription as described here. When I get to doing this

curl --header "X-TOKEN: <your_token>" --data "url=https://blah.foo/bar&events[]=invitee.created" https://calendly.com/api/v1/hooks

I am concerned that the url is not in a valid format. I tried replacing the & with a ? as in here

curl --header "X-TOKEN: <your_token>" --data "url=https://blah.foo/bar?events[]=invitee.created" https://calendly.com/api/v1/hooks

but I receive this error

{"events":{"events":["can't be blank]}}

Likewise, I try to leave the & and everything after it blank and it give the same error as above.

But using a url with the & and everything in it gives a 404 not found error. Can a url even have the format they are saying is required?


Solution

  • But using a url with the & and everything in it gives a 404 not found error.

    The URL part in the following is just the https://blah.foo/bar part before the & character.

    curl --header "X-TOKEN: <your_token>" --data "url=https://blah.foo/bar&events[]=invitee.created" https://calendly.com/api/v1/hooks
    

    The events[]=invitee.created part is a separate parameter and value. It’s not part of the url.

    See the Create A Webhook Subscription page in the calendy docs:

    calendly documentation

    So the URL is the site that runs your webhook; you don’t send the events parameter/value back to that site—instead you’re sending both the url param and events param to the calendly API endpoint at https://calendly.com/api/v1/hooks. The calendly backend presumably then calls to https://mywebsite.com/webhooks/invitee_created or https://blah.foo/bar whatever url you’ve given it—but without the events parameter, which is for calendly’s internal use.