Forum Academy Marketplace Showcase Pricing Features

Get result from API call triggered within html element

Ok, a tricky one here I think…

I’ve set up some API calls to timekit.io that works nice. This is a appointment scheduling service.
On a page in Bubble I have a html element that displays a timekit.io booking calendar that is configured based on some API calls I make in Bubble.

I have everything working except one thing…

In the calendar that is displayed inside the html element, a user can select a time slot and click “BOOK IT”. This triggers a POST call (within the html element,not in bubble) which generates a booking in timekit.io . I need to save the ID of this booking that is generated.
Thing is, since the POST call is generated within the html element, I don’t think I can access the results from the call.

Can anyone think of a way to work around this somehow?

Is it possible to have bubble somehow know that the “BOOK IT” button within the html element is clicked ? If so, maybe that could trigger a GET call to recieve the latest booking ID ?

Not really, except if you want to code manually a click handler and then use the workflow API to trigger something, but it involves quite some coding.

1 Like

@emmanuel, sorry for bothering you about this, but this is about the only thing thats setting me back from completing the functionality. Is this a possible solution?

From documentation for the widget that I embedded in bubbles html element I’ve found that there are callbacks available, that has the booking ID that I need. From the documentation:

CALLBACKS:
" You can hook into events happening throughout the user flow and perform asynchronous events. This is especially powerful for saving user data to your CRM system or redirect users to a payment gateway after booking is finished. "

I’ve confirmed that the booking-ID shows in console.log when using the following callback:

callbacks: {
createBookingSuccessful: function(response) { console.log(‘createBookingSuccessful’, response); },
}

Is it possible to let Bubble have access to this, maybe by replacing console.log with something?