Any way to view and debug webhooks? I am not sure ...
# api
v
Any way to view and debug webhooks? I am not sure if mine is firing. Also @Agusti webhooks are not documented in the postman collection you started.
a
Hi @Vikram Webhooks are a very recent addition to the API Suite. The documentation would follow fairly soon, along with postman collection. In the mean time, might I suggest using 'mockbin' as recipient to the webhook triggers. If the webhooks are triggering, you should receive a ping there.
v
@Ali I think the problem is that the webhooks are not triggering. I had them working the other day but now im not seeing any traffic coming in
a
Can you use the webhook API to fetch the webhook list and make sure there aren't any unintended associations with either event type or apps
v
Everything looks okay to me
Copy code
{
    "webhooks": [
        {
            "id": "78dc9b1a-26e0-410f-88c6-8d7f3a40d69f",
            "userId": ***,
            "eventTypeId": null,
            "subscriberUrl": "https://*****.<http://ngrok.io/wh/track-meeting-booked/|ngrok.io/wh/track-meeting-booked/>",
            "payloadTemplate": null,
            "createdAt": "2022-06-07T17:57:53.772Z",
            "active": true,
            "eventTriggers": [
                "BOOKING_CREATED",
                "BOOKING_RESCHEDULED",
                "BOOKING_CANCELLED"
            ],
            "appId": null
        }
    ]
}
a
Yep. Looks good
v
Do you have any insight into the logs/bug reports on your end?
a
Are you certain it isn't being pinged? Can you replace the subscriber URL with a sample mockbin url and test it out?
a
Hey @Ali they’re self-hsting I think, not using cal.com saas
a
I have tested it very recently and works like a charm. No bugs yet
v
we are not self hosting
🙏 1
a
Just using the API then right @Vikram sorry about the confusion
v
correct. We are trying to build booking system in a mobile app so we are purely using the API
👍 1
a
can you fire that webhook again
checking api live logs
v
just created a booking which should have fired the webhook
a
I only see this: ``````
Copy code
[POST] /v1/bookings?apiKey=cal_live_****
17:21:03:11
Function Status:
201
Edge Status:
201
Duration:
2001.13 ms
Init Duration:
N/A
Memory Used:
181 MB
ID:
cle1::iad1::rmlbq-1654701663108-747e0e359451
User Agent:
PostmanRuntime/7.29.0
userIduserId 24274
Is thatyour userId?
v
yup
a
Seems to be working then
v
thats the POST request to create the booking but can you confirm the webhook got triggered from that?
a
oh, right, no I can’t
a
Has there been a booking @Vikram?
a
I don’t think they’re getting logged, maybe we could look into adding some logs to webhooks @Ali?
a
Yeah, maybe we can consider adding erroneous logs. Definitely @Agusti
🙏 1
a
Maybe the problem is here the post /booking is not firing the webhook?
via API, and only does so via web?
@Ali how does to webhook work in that regard, detects changes on database? Or needs to be called? I’m thinking that might be the issue as the API started as CRUD only and we’re adding functionality to it as we grow
Like availability, I also need to work on a cancel booking that it’s not just a deletes booking but also actually cancels the meeting and notifys etc. prob it’s a similar issue?
v
Just talked with @Ali and the issue is definitely the fact that the bookings API does not trigger webhooks. We confirmed by booking using the website and the webhook successfully fired. A quick estimate by @Ali for getting this functionality was end of week (June 10th)
2
a
I'll try to expedite this as best as I can
🙏 1
Hey @Vikram a quick update. I've set the code to hook the webhooks with booking done using the API in my branch, however, I still need to test them and there would still need to be a few changes to the booking API itself before the webhook is fully usable (because of what fields are currently being used for the booking). Rest assured, I'll stay on it and try to get it over the line (and published) in the weekend itself.
🙏 1
v
Perfect! Thank you so much
also not sure if this matters but @Agusti and I talked about adding attendee emails and possibly other metadata to the booking api as well https://calendso.slack.com/archives/C02QT9R2HDW/p1654730872840089
a
Yes, I am having a discussion with @Agusti regarding the same right now. For the moment, we can get away with providing the same structure with null fields and they will be addressed and their value added to the webhook payload as the booking API grows more towards completion.
👍 1
Hey @Vikram Just to give you an update, the webhooks now fire when booking is made using the booking API. I still need to work on the same for cancelling a booking using the booking API or rescheduling, and also more information to be pulled/taken when creating a booking using the booking API but that needs work on the booking API first. So, this is still a work in progress but the first MVP is in place 🙏 I'll try to keep at it further next week and hopefully we'll be able to finish it all up 😄
v
wow thanks for the quick turn around. Ill play around with this today and let you know if i have any questions
@Ali im seeing some weird behavior. Seems like when i create a booking the webhook for the last booking i made gets fired. Almost like there is a queue of size 1 that never gets fired until the next booking is made
a
Hmm. I'll try to debug this today! Thanks for the info
Yeah, something isn't right. But it isn't that the previous one is getting fired. Sometimes it gets fired, and sometimes it doesn't. I'm debugging this now!