Search.../

setAttendance( )

Sets the number of people who actually attended the session for the given booking.

Description

The setAttendance() function returns a Promise that resolves when attendance information has been updated.

The number of attendees can be greater than 1 when the booking is made for a group of people. Set the attended boolean to true if the customer making the booking or anyone from their group attended.

Notes:

  • There is no validation on the number of attendees or on the relationship between numberOfAttendees and attended.
  • Only users with Bookings Admin permissions can set the attendance for a booking. You can override the permissions by setting the suppressAuth options to true.

Syntax

function setAttendance(bookingId: string, attendanceInfo: AttendanceInfo, [options: Options]): Promise<Booking>

setAttendance Parameters

NAME
TYPE
DESCRIPTION
bookingId
string

ID of the Booking to be updated.

attendanceInfo
AttendanceInfo

Attendance information for the booking

options
Optional
Options

An object representing the available options for setting attendance.

Returns

Return Type:

Promise<Booking>
NAME
TYPE
DESCRIPTION
_id
string

Booking ID.

bookedEntity
BookedEntity

An object describing the entity that was booked.

bookedResources
Array<BookedResource>

List of booked resources. Currently, only one is supported. The booked resource would be the staff-member giving the session.

formInfo
Form

Form information submitted when booking. FormInfo contains contact details, participants, and other form fields, set up for the service.

paymentDetails
PaymentDetails

Payment Details.

status
string

Booking status.

One of:

  • "PENDING_CHECKOUT" The booking is waiting to be checked out.
  • "CONFIRMED" The booking has beed approved by the owner.
  • "CANCELED" The booking has been canceled.
  • "PENDING" The booking has been created.
  • "PENDING_APPROVAL" The booking is waiting for the owner to approve or decline.
  • "DECLINED" The booking was declined by the owner.
attendanceInfo
AttendanceInfo

Attendance information.

bookingSource
BookingSource

An object describing the platform and application that made the booking.

externalUserId
string

External ID provided by the client app on creation.

_createdDate
Date

Date and time the booking was created.

Was this helpful?

Set attendance information

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { bookings } from 'wix-bookings-backend';
3
4export const setAttendance = webMethod(Permissions.Anyone, async () => {
5 const bookingId = '25a285ec-fc3b-4ca3-bb05-42ec7b510c2e';
6 const attendanceInfo = {
7 attended: true,
8 numberOfAttendees: 3
9 };
10
11 try {
12 const booking = await bookings.setAttendance(bookingId, attendanceInfo);
13 return booking;
14 } catch (error) {
15 return error;
16 }
17});
18
19/* Returns a promise that resolves to a booking object:
20 *
21 * {
22 * "_id": "7125331e-75e6-4889-809a-5dea10648b30",
23 * "bookedEntity": {
24 * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441",
25 * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179",
26 * "singleSession": {
27 * "sessionId": * "1ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7ExgIRM1* HujEPUQ0IeScwcTFJNXEmLG2g6Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADFiCPyyy5* IVtDpF30FnQDoG8I60n21QAlhok4LHNlkBszoGZ67jGMeDOqxS8PXZgJx87ByXwfgsN* 3AbndYxESrFnttLnRSFzcsolPAjYhaRCdJBhUj8rAoBoj71MgiFi4Tw3FDyVZz2OeOH* GmwRi0ELuqZvw0Y5tmMXrIKa48SvG8sr2MyOQsaIbMHy8YX1Q8anAgfdt",
28 * "start": "2021-01-22T10:30:00Z",
29 * "end": "2021-01-22T11:00:00Z"
30 * },
31 * "title": "Yoga Class",
32 * "location": {
33 * "locationType": "OWNER_BUSINESS"
34 * },
35 * "rate": {
36 * "labeledPriceOptions": {
37 * "general": {
38 * "amount": "50",
39 * "currency": "USD",
40 * "downPayAmount": "0"
41 * }
42 * }
43 * },
44 * "tags": [
45 * "GROUP"
46 * ]
47 * },
48 * "bookedResources": [
49 * {
50 * "_id": "76570209-101f-409b-af97-b445bdb63125",
51 * "name": "John Smith",
52 * "email": "jsmith@gmail.com"
53 * }
54 * ],
55 * "status": "PENDING_CHECKOUT",
56 * "_createdDate": "2021-01-11T08:45:00.214Z",
57 * "attendanceInfo": {
58 * "attendanceStatus": true,
59 * "numberOfAttendees": 1
60 * },
61 * "bookingSource": {
62 * "platform": "WEB",
63 * "actor": "CUSTOMER",
64 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",
65 * "appName": "Wix Bookings"
66 * },
67 * "formInfo": {
68 * "paymentSelection": [
69 * {
70 * "rateLabel": "general",
71 * "numberOfParticipants": 1
72 * }
73 * ],
74 * "additionalFields": [
75 * {
76 * "_id": "00000000-0000-0000-0000-000000000008",
77 * "value": "Cant wait to start",
78 * "label": "Add Your Message",
79 * "valueType": "LONG_TEXT"
80 * }
81 * ],
82 * "contactDetails": {
83 * "contactId": "a6d4c19e-1882-4e29-9eb3-411e1aeeb874",
84 * "firstName": "Joe Green",
85 * "email": "JoeGreen@hmail.com",
86 * "phone": "9998765",
87 * "timeZone": "America/New_York",
88 * "countryCode": "US"
89 * }
90 * },
91 * "paymentDetails": {
92 * "balance": {
93 * "finalPrice": {
94 * "amount": "50",
95 * "currency": "USD",
96 * "downPayAmount": "0"
97 * },
98 * "amountReceived": "0"
99 * },
100 * "state": "PENDING_CASHIER",
101 * "wixPayMultipleDetails": [
102 * {
103 * "orderId": "dd702e88-68e0-4faa-94b2-4996136a9828",
104 * "orderAmount": "50",
105 * "orderStatus": "UNDEFINED"
106 * }
107 * ]
108 * }
109 * }
110 *
111 */