onBookingRequestCreated( )


An event that fires when a booking request is created.

The onBookingRequestCreated() event handler runs when a new booking request is created for a service that requires manual booking confirmation.

The event object includes a trigger property that describes the action that triggered the event. The trigger value for this event is "VISITOR_BOOKING_REQUEST_CREATED".

Note: Backend events don't work when previewing your site.

Method Declaration
Copy
function onBookingRequestCreated(event: BookingEvent): void;
Method Parameters
eventBookingEventRequired

Information about a newly-created booking request.

An event when a booking request is created
JavaScript
// Place this code in the events.js file // of your site's Backend section. export function wixBookings_onBookingRequestCreated(event) { const eventTrigger = event.trigger; const bookingId = event.booking._id; } /* Full event object * { * "trigger": "VISITOR_BOOKING_REQUEST_CREATED", * "booking": { * "_id": "abcde6c0-312d-463f-ac15-12345db761a6", * "bookedResources": [ * { * "id": "dc19d7db-6996-494b-8d6d-943d64e1f32a", * "name": "Tom Jones", * "email": "tom@yoga.com" * } * ], * "status": "PENDING_APPROVAL", * "createdDate": "2021-02-23T13:25:08.447Z", * "bookingSource": { * "platform": "WEB", * "actor": "CUSTOMER", * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97", * "appName": "Wix Bookings" * }, * "bookedEntity": { * "serviceId": "49c7fac5-227c-44d0-a4f3-c1a5c511edf1", * "scheduleId": "4b21a5af-3b69-42ce-a3ba-9cf60d7b4422", * "singleSession": { * "sessionId":"mmoW0vwKcSFyxtOfCdMkx03iaGJPrwicZi6txH3v4xV1BjsDJnqagj * 6Kgq9OkF0yrmnAQoowvm9jGbIhun5QPTT3hBcxoTtd5zB", * "start": "2021-03-26T14:30:00Z", * "end": "2021-03-26T15:30:00Z" * }, * "title": "Meditation Tutorial", * "rate": { * "labeledPriceOptions": { * "general": { * "amount": "100", * "currency": "USD", * "downPayAmount": "0" * } * } * }, * "tags": [ * "INDIVIDUAL" * ], * "location": { * "address": "123 4th Street Fivetown", * "customAddress": { * "formatted": "123 4th Street Fivetown" * }, * "locationType": "CUSTOM" * } * }, * "paymentDetails": { * "balance": { * "finalPrice": { * "amount": "100", * "currency": "USD", * "downPayAmount": "0" * }, * "amountReceived": "0" * } * }, * "formInfo": { * "paymentSelection": [ * { * "rateLabel": "general", * "numberOfParticipants": 1 * } * ], * "additionalFields": [ * { * "id": "00000000-0000-0000-0000-000000000008", * "label": "Add Your Message", * "valueType": "LONG_TEXT" * }, * { * "id": "1b1ee05f-aa4d-4a9e-9086-aef1d9d98a49", * "label": "I need equipment", * "valueType": "CHECK_BOX" * } * ], * "contactDetails": { * "contactId": "f8937331-2452-4c9f-a090-69b6b384021b", * "firstName": "John Smith", * "email": "johnsmith@gmail.com", * "phone": "9998765", * "timeZone": "America/New_York", * "countryCode": "US", * "address": { * "formatted": "123 4th Street Fivetown" * } * } * } * }, * "previousBooking": { * "bookedEntity": { * "location": {} * }, * "paymentDetails": {}, * "formInfo": { * "contactDetails": {} * } * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?