Search.../

onBookingRequestCreated( )

An event that fires when a booking request is created.

Description

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.

Syntax

function onBookingRequestCreated(event: BookingEvent): void

onBookingRequestCreated Parameters

NAME
TYPE
DESCRIPTION
event
BookingEvent

Information about a newly-created booking request.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event when a booking request is created

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3export function wixBookings_onBookingRequestCreated(event) {
4 const eventTrigger = event.trigger;
5 const bookingId = event.booking._id;
6}
7
8/* Full event object
9 * {
10 * "trigger": "VISITOR_BOOKING_REQUEST_CREATED",
11 * "booking": {
12 * "_id": "abcde6c0-312d-463f-ac15-12345db761a6",
13 * "bookedResources": [
14 * {
15 * "id": "dc19d7db-6996-494b-8d6d-943d64e1f32a",
16 * "name": "Tom Jones",
17 * "email": "tom@yoga.com"
18 * }
19 * ],
20 * "status": "PENDING_APPROVAL",
21 * "createdDate": "2021-02-23T13:25:08.447Z",
22 * "bookingSource": {
23 * "platform": "WEB",
24 * "actor": "CUSTOMER",
25 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",
26 * "appName": "Wix Bookings"
27 * },
28 * "bookedEntity": {
29 * "serviceId": "49c7fac5-227c-44d0-a4f3-c1a5c511edf1",
30 * "scheduleId": "4b21a5af-3b69-42ce-a3ba-9cf60d7b4422",
31 * "singleSession": {
32 * "sessionId":"mmoW0vwKcSFyxtOfCdMkx03iaGJPrwicZi6txH3v4xV1BjsDJnqagj
33 * 6Kgq9OkF0yrmnAQoowvm9jGbIhun5QPTT3hBcxoTtd5zB",
34 * "start": "2021-03-26T14:30:00Z",
35 * "end": "2021-03-26T15:30:00Z"
36 * },
37 * "title": "Meditation Tutorial",
38 * "rate": {
39 * "labeledPriceOptions": {
40 * "general": {
41 * "amount": "100",
42 * "currency": "USD",
43 * "downPayAmount": "0"
44 * }
45 * }
46 * },
47 * "tags": [
48 * "INDIVIDUAL"
49 * ],
50 * "location": {
51 * "address": "123 4th Street Fivetown",
52 * "customAddress": {
53 * "formatted": "123 4th Street Fivetown"
54 * },
55 * "locationType": "CUSTOM"
56 * }
57 * },
58 * "paymentDetails": {
59 * "balance": {
60 * "finalPrice": {
61 * "amount": "100",
62 * "currency": "USD",
63 * "downPayAmount": "0"
64 * },
65 * "amountReceived": "0"
66 * }
67 * },
68 * "formInfo": {
69 * "paymentSelection": [
70 * {
71 * "rateLabel": "general",
72 * "numberOfParticipants": 1
73 * }
74 * ],
75 * "additionalFields": [
76 * {
77 * "id": "00000000-0000-0000-0000-000000000008",
78 * "label": "Add Your Message",
79 * "valueType": "LONG_TEXT"
80 * },
81 * {
82 * "id": "1b1ee05f-aa4d-4a9e-9086-aef1d9d98a49",
83 * "label": "I need equipment",
84 * "valueType": "CHECK_BOX"
85 * }
86 * ],
87 * "contactDetails": {
88 * "contactId": "f8937331-2452-4c9f-a090-69b6b384021b",
89 * "firstName": "John Smith",
90 * "email": "johnsmith@gmail.com",
91 * "phone": "9998765",
92 * "timeZone": "America/New_York",
93 * "countryCode": "US",
94 * "address": {
95 * "formatted": "123 4th Street Fivetown"
96 * }
97 * }
98 * }
99 * },
100 * "previousBooking": {
101 * "bookedEntity": {
102 * "location": {}
103 * },
104 * "paymentDetails": {},
105 * "formInfo": {
106 * "contactDetails": {}
107 * }
108 * }
109 * }
110 */