Okay
  Public Ticket #2752441
More documentation on Web Hooks
Closed

Comments

  • José Pedro Correia started the conversation

    Hi there,

    We are planning to develop a service to process Amelia data into our internal data platforms. For that we are going to use your web hooks feature. I was looking through the documentation on that topic, but couldn't find the details I need.

    Do you have any detailed documentation on the requests (especially regarding the data format) that are triggered by each type and action available for web hooks?

    Cheers,

    Pedro

  • [deleted] replied

    Hi, Jose!

    Sorry for the delayed response, we don't work on weekends.

    I'm afraid, the only documentation we have at the moment is the one on our site: https://wpamelia.com/web-hooks-settings/

    We also have API Routes for the Amelia app, but most of them are protected depends on of the permissions that is set in WordPress Accounts. You can check those API Routes in this file ../wp-content/plugins/ameliabooking/src/Infrastructure/Routes/Routes.php

    At the moment we have some JavaScript hooks that are triggered depending on the view:

    window.beforeAddToCalendarLoaded()
    window.beforeBookingLoaded()
    window.beforeSearchLoaded()
    window.beforeSearchFiltered()
    window.afterSearchFiltered()
    window.beforeConfirmedBooking()
    window.beforeCatalogLoaded()
    window.afterSelectCatalogCategory(object_category)
    window.beforeCatalogCategoryLoaded(object_category)
    window.beforeCatalogServiceLoaded(object_category, object_service)
    window.afterSearchActivateService(object_appointment, object_serviceActive)
    window.afterSearchGoToSecondStep(object_appointment, object_serviceActive)
    window.afterBookingSelectDateAndTime(object_appointment, object_serviceId, object_providerId, object_locationId)
    window.afterBookingSelectService(object_appointment, object_serviceId, object_providerId, object_locationId)
    window.beforeConfirmBookingLoaded(object_appointment, object_service, object_provider, object_location)
    window.afterConfirmBooking(object_appointment, object_service, object_provider, object_location)

    JS files are modified (minimized) in the public version of the plugin (in our development environment is accessible), but unfortunately, I can not send you our source code because that is the policy of our company.

    All those files that have extension .vue are compressed and minimized in JS files that is very hard and not recommended modifying. So in order to add some other features, you can extract the js and customize it.

    Hope that will help.

    Best Regards. 

  • José Pedro Correia replied

    Hi Liza,

    Thanks for your reply. 

    Reverse-engineering your code does not sound like a good approach to me. What we're implementing is a backend service to process the data for those events, so I'm mainly just interested in the format of the data that is sent for each event. Is there no data schema that you could share?

    I can get there by setting up the web hooks and seeing what I get on the other side, but ideally I would prefer to have the definition of the data from you guys.

    In case that's not possible, do you at least have an idea of how often the format changes?

    Thanks in advance,

    Pedro

  • [deleted] replied

    Hi again, Pedro,

    Sure, I will forward your question to our developers, and let's see if we can help you with that.

    PS Sorry for mixing up your name, I didn't notice the signature before.

    Best Regards. 


  • [deleted] replied

    Hi, Pedro!

    Our developers confirmed that we don't have the data format in our documentation and we don't change the format of existing fields because of our old users.

    This is an example JSON that is sent via WebHook:

    {"appointment":{"id":1951,"bookings":{"0":{"id":2060,"customerId":194,"customer":{"id":194,"firstName":"John","lastName":"Doe","birthday":null,"email":"[email protected]","phone":null,"type":"customer","status":"visible","note":null,"zoomUserId":null,"countryPhoneIso":"rs","externalId":null,"pictureFullPath":null,"pictureThumbPath":null,"gender":null},"status":"approved","extras":{},"couponId":null,"price":0,"coupon":null,"customFields":{"1":{"label":"Application","value":{},"type":"file"}},"info":"{\"firstName\":\"\\John\",\"lastName\":\"Doe\",\"phone\":null,\"locale\":\"en_US\",\"timeZone\":\"Europe\\\/Berlin\"}","appointmentId":1951,"persons":1,"token":"1ce0dd376b","payments":{"0":{"id":1774,"customerBookingId":2060,"packageCustomerId":null,"amount":0,"gateway":"onSite","gatewayTitle":"","dateTime":"2021-05-23 09:00:00","status":"paid","data":""}},"utcOffset":120,"aggregatedPrice":false,"isChangedStatus":true,"packageCustomerService":null,"cancelUrl":"","customerPanelUrl":""}},"notifyParticipants":1,"internalNotes":"","status":"approved","serviceId":1,"parentId":null,"providerId":121,"locationId":null,"provider":{"id":121,"firstName":"Jane","lastName":"Jane","birthday":null,"email":"[email protected]","phone":"","type":"provider","status":"visible","note":null,"zoomUserId":null,"countryPhoneIso":"rs","externalId":19,"pictureFullPath":"","pictureThumbPath":"","weekDayList":{"0":{"id":196,"dayIndex":7,"startTime":"09:00:00","endTime":"13:00:00","timeOutList":{},"periodList":{"0":{"id":198,"startTime":"09:00:00","endTime":"13:00:00","locationId":null,"periodServiceList":{}}}}},"serviceList":{},"dayOffList":{},"specialDayList":{},"locationId":null,"googleCalendar":null,"outlookCalendar":null},"service":{"id":1,"name":"Service","description":"","color":"#774DFB","price":0,"deposit":0,"depositPayment":"disabled","depositPerPerson":false,"pictureFullPath":"","pictureThumbPath":"","extras":{"0":{"id":5,"name":"Extra Hour","description":null,"price":5,"maxQuantity":1,"position":1,"duration":3600,"serviceId":null,"aggregatedPrice":true,"translations":""}},"coupons":{},"position":null,"settings":"{\"payments\":{\"onSite\":true,\"payPal\":{\"enabled\":true},\"stripe\":{\"enabled\":true}},\"zoom\":{\"enabled\":true},\"general\":{\"minimumTimeRequirementPriorToBooking\":600},\"activation\":{\"version\":\"3.2\"}}","minCapacity":1,"maxCapacity":5,"duration":3600,"timeBefore":null,"timeAfter":null,"bringingAnyone":true,"show":true,"aggregatedPrice":false,"status":"visible","categoryId":1,"category":null,"priority":{},"gallery":{},"recurringCycle":null,"recurringSub":null,"recurringPayment":999,"translations":""},"location":null,"googleCalendarEventId":null,"outlookCalendarEventId":null,"zoomMeeting":null,"bookingStart":"2021-05-23 09:00:00","bookingEnd":"2021-05-23 10:00:00","type":"appointment","isRescheduled":null},"bookings":{"0":{"id":2060,"customerId":194,"customer":{"id":194,"firstName":"John","lastName":"Doe","birthday":null,"email":"[email protected]","phone":null,"type":"customer","status":"visible","note":null,"zoomUserId":null,"countryPhoneIso":"rs","externalId":null,"pictureFullPath":null,"pictureThumbPath":null,"gender":null},"status":"approved","extras":{},"couponId":null,"price":0,"coupon":null,"customFields":{"1":{"label":"Application","value":{},"type":"file"}},"info":"{\"firstName\":\"\\John\",\"lastName\":\"Doe\",\"phone\":null,\"locale\":\"en_US\",\"timeZone\":\"Europe\\\/Berlin\"}","appointmentId":1951,"persons":1,"token":"1ce0dd376b","payments":{"0":{"id":1774,"customerBookingId":2060,"packageCustomerId":null,"amount":0,"gateway":"onSite","gatewayTitle":"","dateTime":"2021-05-23 09:00:00","status":"paid","data":""}},"utcOffset":120,"aggregatedPrice":false,"isChangedStatus":true,"packageCustomerService":null,"isRecurringBooking":false,"isPackageBooking":false,"cancelUrl":"","customerPanelUrl":""}}}

    Hope that will help.

    Best Regards.

  • José Pedro Correia replied

    Hi Liza,

    That's a shame you don't have that documentation, but I'll use that example to get started.

    Thank you for your help!

  • [deleted] replied

    Pedro,

    If you have a couple of minutes, you can suggest that as a "feature request" here, so our developers will know there's a demand for this kind of documentation.

    Please feel free to contact us if you have any other questions.

    Best Regards.