@wix/agent-skills 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +2 -1
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +14 -0
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +11 -6
- package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +3 -17
- package/skills/wix-app/references/editor-react-component/SSR.md +119 -0
- package/skills/wix-design-system/SKILL.md +1 -1
- package/skills/wix-headless/references/BUILD-astro.md +5 -7
- package/skills/wix-headless/references/SETUP.md +1 -1
- package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +41 -333
- package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +58 -428
- package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +4 -7
- package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +158 -143
- package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +104 -162
- package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +17 -13
- package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +16 -78
- package/skills/wix-headless/references/astro/templates/bookings/bookingDriver.ts +245 -0
- package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +122 -179
- package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +61 -9
- package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +10 -2
- package/skills/wix-headless/references/bookings/FLOW.md +185 -0
- package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +60 -76
- package/skills/wix-headless/references/custom/bookings/WIRING.md +123 -65
- package/skills/wix-headless/references/verticals/bookings.md +6 -8
- package/skills/wix-manage/SKILL.md +12 -0
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +3 -27
- package/skills/wix-manage/references/bookings/create-appointment-service.md +266 -0
- package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +37 -0
- package/skills/wix-manage/references/bookings/create-class-service.md +245 -0
- package/skills/wix-manage/references/bookings/create-course-service.md +249 -0
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +2 -1
- package/skills/wix-manage/references/cms/cms-schema-management.md +1 -1
- package/skills/wix-manage/references/stores/create-product-from-image.md +154 -2
- package/skills/wix-headless/references/astro/templates/bookings/ManageBooking.tsx +0 -84
- package/skills/wix-headless/references/astro/templates/bookings/api/confirm-booking.ts +0 -34
- package/skills/wix-headless/references/astro/templates/bookings/api/waitlist.ts +0 -74
- package/skills/wix-headless/references/astro/templates/bookings/manage-booking.astro +0 -76
|
@@ -1,88 +1,146 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: custom-bookings-wiring
|
|
3
|
-
description: "Integration-mode wiring subagent for the bookings capability. Wires a services list + availability + a
|
|
3
|
+
description: "Integration-mode wiring subagent for the bookings capability. Wires a services list + availability + a schema-driven booking form into a brought-in site, then books via the ecom Cart V2 sequence (createBooking → cart → placeOrder / hosted-checkout redirect). Client-side @wix/sdk; no server runtime, no confirmBooking."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Bookings — integration wiring
|
|
6
|
+
# Bookings — integration wiring (own / static)
|
|
7
7
|
|
|
8
|
-
You wire the **bookings capability**
|
|
8
|
+
You wire the **bookings capability** into a brought-in site (`frontend = "custom"`).
|
|
9
|
+
Client-side `@wix/sdk` — CDN imports for `none`-build, bundled for `own`-build
|
|
10
|
+
(same calls). Read `INSTRUCTIONS.md` § "The technical spine" + § "Wiring discipline".
|
|
9
11
|
|
|
10
|
-
> **
|
|
12
|
+
> **The logic is shared.** The step model, the booking SDK sequence, the
|
|
13
|
+
> schema-driven form, and the gotchas are in `../../bookings/FLOW.md` — read it
|
|
14
|
+
> first. The astro vertical's React examples
|
|
15
|
+
> (`../../astro/templates/bookings/*` incl. `bookingDriver.ts`) are the reference
|
|
16
|
+
> implementation; here you run the **same SDK calls** through an `OAuthStrategy`
|
|
17
|
+
> visitor client (adapt the React idiom to whatever framework the site uses).
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
> **Scope (same as the astro vertical — the astro/own distinction collapses).**
|
|
20
|
+
> Services display + a week-calendar availability picker + a schema-driven booking
|
|
21
|
+
> form + the **ecom Cart V2 booking sequence**, all client-side under the visitor
|
|
22
|
+
> identity (no server elevation): `createBooking` (→ `CREATED`) → `createCart` →
|
|
23
|
+
> `calculateCart` → `isCheckoutRequired ? ecomCheckout redirect : placeOrder`.
|
|
24
|
+
> **No `confirmBooking`** — the cart holds the seat, so a client-only site
|
|
25
|
+
> completes the whole flow.
|
|
13
26
|
|
|
27
|
+
## Inputs (inlined in your prompt)
|
|
14
28
|
- **`appId`** — `OAuthStrategy` `clientId`.
|
|
15
|
-
- **Seeded services** — read your `bookings` slice from `.wix/seeded.json
|
|
29
|
+
- **Seeded services** — read your `bookings` slice from `.wix/seeded.json`.
|
|
16
30
|
- The site's CSS token names (style additively from them).
|
|
17
31
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// Bind into the existing markup: name s.name, tagline s.tagLine, slug s.mainSlug?.name,
|
|
31
|
-
// duration s.schedule?.availabilityConstraints?.sessionDurations?.[0] (APPOINTMENT),
|
|
32
|
-
// price s.payment?.fixed?.price ({ value, currency } — value is a string; format from
|
|
33
|
-
// the returned currency, the site business locale wins over what was seeded).
|
|
34
|
-
</script>
|
|
32
|
+
## The client (acquire once)
|
|
33
|
+
```js
|
|
34
|
+
import { createClient, OAuthStrategy } from "https://esm.sh/@wix/sdk@1"; // bundled for own-build
|
|
35
|
+
import { services, availabilityTimeSlots, eventTimeSlots, bookings } from "https://esm.sh/@wix/bookings@1";
|
|
36
|
+
import { forms } from "https://esm.sh/@wix/forms@1";
|
|
37
|
+
import * as cartV2 from "https://esm.sh/@wix/auto_sdk_ecom_cart-v-2@1";
|
|
38
|
+
import { redirects } from "https://esm.sh/@wix/redirects@1";
|
|
39
|
+
|
|
40
|
+
const wix = createClient({
|
|
41
|
+
modules: { services, availabilityTimeSlots, eventTimeSlots, bookings, forms, redirects, ...cartV2 },
|
|
42
|
+
auth: OAuthStrategy({ clientId: "REPLACE_WITH_APP_ID" }),
|
|
43
|
+
});
|
|
35
44
|
```
|
|
36
45
|
|
|
37
|
-
##
|
|
38
|
-
|
|
46
|
+
## Render services
|
|
39
47
|
```js
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
+
// The filter MUST include appId; pass conditionalFields, then .find().
|
|
49
|
+
const BOOKING_APP_ID = "13d21c63-b5ec-5912-8397-c3a5ddb27a97";
|
|
50
|
+
const { items } = await wix.services.queryServices({
|
|
51
|
+
query: { filter: { appId: BOOKING_APP_ID }, paging: { limit: 100 } },
|
|
52
|
+
conditionalFields: ["STAFF_MEMBER_DETAILS"],
|
|
53
|
+
}).find();
|
|
54
|
+
const visible = items.filter((s) => !s.hidden);
|
|
55
|
+
// name s.name · tagline s.tagLine · slug s.mainSlug?.name ·
|
|
56
|
+
// duration s.schedule?.availabilityConstraints?.sessionDurations?.[0] ·
|
|
57
|
+
// price s.payment?.fixed?.price ({ value, currency } — value is a string).
|
|
58
|
+
```
|
|
48
59
|
|
|
60
|
+
## Availability (week calendar)
|
|
61
|
+
Render a **week calendar** (day strip → the day's times), not a flat grid — see
|
|
62
|
+
`../../bookings/FLOW.md` § 5. `fromLocalDate`/`toLocalDate` are **local** strings
|
|
63
|
+
(`YYYY-MM-DDThh:mm:ss`, no `Z`) + a `timeZone`.
|
|
64
|
+
```js
|
|
65
|
+
// APPOINTMENT — serviceId is a single GUID STRING:
|
|
66
|
+
const a = await wix.availabilityTimeSlots.listAvailabilityTimeSlots({ serviceId, fromLocalDate, toLocalDate, timeZone, bookable: true, cursorPaging: { limit: 100 } });
|
|
67
|
+
// slots a.timeSlots[] — localStartDate/localEndDate/scheduleId at the TOP level.
|
|
49
68
|
// CLASS — different namespace, PLURAL serviceIds; slots carry eventInfo.eventId, no scheduleId:
|
|
50
|
-
const c = await wix.eventTimeSlots.listEventTimeSlots({
|
|
51
|
-
serviceIds: [serviceId], fromLocalDate, toLocalDate, timeZone, includeNonBookable: false,
|
|
52
|
-
});
|
|
69
|
+
const c = await wix.eventTimeSlots.listEventTimeSlots({ serviceIds: [serviceId], fromLocalDate, toLocalDate, timeZone, includeNonBookable: false });
|
|
53
70
|
```
|
|
54
71
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Same pattern as the ecom guide's hosted checkout: create a redirect session for the chosen slot and send the visitor to Wix.
|
|
60
|
-
|
|
72
|
+
## Booking form — schema-driven
|
|
73
|
+
The booking form is a `@wix/forms` form on the service (`service.form._id`). Read
|
|
74
|
+
its schema and render fields by `componentType`, collecting values keyed by
|
|
75
|
+
`target` (`../../bookings/FLOW.md` § 4):
|
|
61
76
|
```js
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
timezone: timeZone,
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
timezone: timeZone,
|
|
76
|
-
},
|
|
77
|
-
callbacks: { postFlowUrl: window.location.href }, // return to the brought-in site after checkout
|
|
78
|
-
});
|
|
79
|
-
window.location.href = redirectSession.fullUrl;
|
|
77
|
+
const { form } = await wix.forms.getForm(service.form._id);
|
|
78
|
+
const RENDERABLE = ["TEXT_INPUT", "PHONE_INPUT", "DROPDOWN"];
|
|
79
|
+
const fields = (form.formFields ?? []).filter(
|
|
80
|
+
(f) => f.fieldType === "INPUT" && !f.hidden &&
|
|
81
|
+
RENDERABLE.includes(f.inputOptions?.stringOptions?.componentType),
|
|
82
|
+
);
|
|
83
|
+
// render each by f.inputOptions.stringOptions.componentType; collect values by f.inputOptions.target.
|
|
84
|
+
// SKIP complex object-valued fields (e.g. multi-line ADDRESS, no string componentType) —
|
|
85
|
+
// sending a string for them fails createBooking with "must be object". Only
|
|
86
|
+
// first_name/last_name/email are enforced, so skipping optional complex fields is safe.
|
|
80
87
|
```
|
|
81
88
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
## Book — the ecom Cart V2 sequence
|
|
90
|
+
Mirror `../../astro/templates/bookings/bookingDriver.ts` (the exact payloads).
|
|
91
|
+
Run the same sequence through `wix.*`; the cart holds the seat, so no elevation.
|
|
92
|
+
```js
|
|
93
|
+
const BOOKING_APP_ID = "13d21c63-b5ec-5912-8397-c3a5ddb27a97";
|
|
94
|
+
const STAFF_MEMBER_RESOURCE_TYPE_ID = "1cd44cf8-756f-41c3-bd90-3e2ffcaf1155";
|
|
95
|
+
|
|
96
|
+
// Build the slot. APPOINTMENT carries scheduleId; CLASS carries eventId (Wix
|
|
97
|
+
// derives the rest). No staff chosen → the ANY_RESOURCE fallback.
|
|
98
|
+
const slot =
|
|
99
|
+
slotType === "CLASS"
|
|
100
|
+
? { serviceId, eventId, timezone }
|
|
101
|
+
: {
|
|
102
|
+
serviceId, scheduleId, startDate, endDate, timezone,
|
|
103
|
+
resourceSelections: [{ resourceTypeId: STAFF_MEMBER_RESOURCE_TYPE_ID, selectionMethod: "ANY_RESOURCE" }],
|
|
104
|
+
location: { locationType: "OWNER_BUSINESS" },
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// selectedPaymentOption must match the service: online-only → ONLINE,
|
|
108
|
+
// in-person-only → OFFLINE, else ONLINE. DERIVE it — do not hardcode ONLINE: a
|
|
109
|
+
// free / pay-in-person service booked ONLINE is rejected by the cart with
|
|
110
|
+
// INSUFFICIENT_INVENTORY (it's the only service kind that reaches placeOrder).
|
|
111
|
+
const o = service.payment?.options;
|
|
112
|
+
const selectedPaymentOption =
|
|
113
|
+
o?.online && !o?.inPerson ? "ONLINE" : !o?.online && o?.inPerson ? "OFFLINE" : "ONLINE";
|
|
114
|
+
|
|
115
|
+
// 1. createBooking → CREATED. Arg 1 is the BOOKING object (slot nested under
|
|
116
|
+
// bookedEntity); formSubmission/sendSmsReminder go in the options arg.
|
|
117
|
+
const { booking } = await wix.bookings.createBooking(
|
|
118
|
+
{ selectedPaymentOption, totalParticipants: 1, bookedEntity: { slot } },
|
|
119
|
+
{ formSubmission, sendSmsReminder: true }, // formSubmission keyed by each field's `target`
|
|
120
|
+
);
|
|
121
|
+
// 2. createCart — one catalog item per booking._id, catalogReference.appId = BOOKING_APP_ID, channel WEB.
|
|
122
|
+
const cart = await wix.createCart({ catalogItems: [{ quantity: 1, catalogReference: { catalogItemId: booking._id, appId: BOOKING_APP_ID } }], cart: { source: { channelType: "WEB" } } });
|
|
123
|
+
// 3. calculateCart → { cart, summary }, then compute the checkout decision.
|
|
124
|
+
const { cart: calc, summary } = await wix.calculateCart(cart._id);
|
|
125
|
+
const checkoutRequired =
|
|
126
|
+
service.bookingPolicy?.cancellationFeePolicy?.enabled
|
|
127
|
+
? true
|
|
128
|
+
: Number(summary?.priceSummary?.total?.amount ?? 0) === 0
|
|
129
|
+
? false
|
|
130
|
+
: calc?.lineItems?.[0]?.paymentConfig?.paymentOption !== "FULL_PAYMENT_OFFLINE";
|
|
131
|
+
// 4. paid → redirect (ecomCheckout.checkoutId = cartId) ; free/offline → placeOrder.
|
|
132
|
+
if (checkoutRequired) {
|
|
133
|
+
const { redirectSession } = await wix.redirects.createRedirectSession({ ecomCheckout: { checkoutId: cart._id }, callbacks: { postFlowUrl: window.location.href } });
|
|
134
|
+
window.location.href = redirectSession.fullUrl;
|
|
135
|
+
} else {
|
|
136
|
+
await wix.placeOrder(cart._id); // booked — no redirect
|
|
137
|
+
}
|
|
138
|
+
```
|
|
85
139
|
|
|
86
|
-
|
|
140
|
+
> Confirm the `@wix/auto_sdk_ecom_cart-v-2` function registration shape on a
|
|
141
|
+
> CDN/own client at wiring time; the payloads above match the astro `bookingDriver.ts`.
|
|
87
142
|
|
|
88
|
-
|
|
143
|
+
## Out of v1
|
|
144
|
+
Waitlist and on-site manage/cancel — out of scope (same as the astro vertical).
|
|
145
|
+
Show bookable slots only; post-booking self-service is handled by the Wix-hosted
|
|
146
|
+
flow / member area.
|
|
@@ -6,13 +6,11 @@ requires: []
|
|
|
6
6
|
|
|
7
7
|
features:
|
|
8
8
|
- name: "Services catalog"
|
|
9
|
-
description: "Browse bookable services
|
|
9
|
+
description: "Browse bookable appointment services with descriptions, duration, and pricing."
|
|
10
10
|
- name: "Online booking"
|
|
11
|
-
description: "Pick an available time slot, complete
|
|
12
|
-
- name: "
|
|
13
|
-
description: "
|
|
14
|
-
- name: "Manage booking"
|
|
15
|
-
description: "View and cancel a booking from the confirmation page or a shared manage link, no account login required."
|
|
11
|
+
description: "Pick an available time slot on a calendar, complete the service's booking form, and confirm."
|
|
12
|
+
- name: "Secure checkout"
|
|
13
|
+
description: "Free or pay-in-person bookings confirm instantly; paid services hand off to Wix's secure hosted checkout."
|
|
16
14
|
|
|
17
15
|
apps:
|
|
18
16
|
- name: "Wix Bookings"
|
|
@@ -24,8 +22,8 @@ routes:
|
|
|
24
22
|
name: "Service Detail"
|
|
25
23
|
- route: "/booking-confirmation"
|
|
26
24
|
name: "Booking Confirmation"
|
|
27
|
-
- route: "
|
|
28
|
-
name: "
|
|
25
|
+
- route: "Hosted by Wix"
|
|
26
|
+
name: "Secure Checkout"
|
|
29
27
|
|
|
30
28
|
disabled: false
|
|
31
29
|
---
|
|
@@ -52,6 +52,18 @@ These recipes do NOT cover frontend development or SDK usage for displaying data
|
|
|
52
52
|
### [Create and Update Booking Services](references/bookings/create-and-update-booking-services.md)
|
|
53
53
|
**Technical:** Full CRUD operations for Wix Bookings services using Services API. Covers service types (APPOINTMENT, CLASS, COURSE), pricing configuration, location setup, and schedule management.
|
|
54
54
|
|
|
55
|
+
### [Create Booking Service from Prompt](references/bookings/create-booking-service-from-prompt.md)
|
|
56
|
+
**Technical:** Use when the user wants to create a booking service — e.g. "create a yoga class for $50", "set up consultations", "add a personal training appointment". Routes to the correct type-specific recipe (APPOINTMENT, CLASS, or COURSE), gathers business context, applies defaults, and creates the service.
|
|
57
|
+
|
|
58
|
+
### [Create Appointment Service](references/bookings/create-appointment-service.md)
|
|
59
|
+
**Technical:** Use when the user wants to create an appointment/consultation/1-on-1 service — e.g. "set up consultations for $75", "create a meeting service". Handles staff assignment, session duration, and pricing via bulkCreateServices API.
|
|
60
|
+
|
|
61
|
+
### [Create Class Service](references/bookings/create-class-service.md)
|
|
62
|
+
**Technical:** Use when the user wants to create a group class — e.g. "create a yoga class for $50", "set up a pilates class". Handles group capacity, recurring sessions, and pricing via bulkCreateServices API.
|
|
63
|
+
|
|
64
|
+
### [Create Course Service](references/bookings/create-course-service.md)
|
|
65
|
+
**Technical:** Use when the user wants to create a multi-session course — e.g. "create a 6-week workshop", "set up a training program for $300". Handles group capacity, full-course pricing, and fixed series via bulkCreateServices API.
|
|
66
|
+
|
|
55
67
|
### [End-to-End Booking Flow](references/bookings/end-to-end-booking-flow.md)
|
|
56
68
|
**Technical:** Complete booking flow from service discovery to payment. Query services, check availability with Time Slots V2, create bookings, and process payment via eCommerce checkout.
|
|
57
69
|
|
|
@@ -4,7 +4,7 @@ description: Installs Wix apps on a site using Apps Installer API. Covers enabli
|
|
|
4
4
|
---
|
|
5
5
|
# Install Wix Apps on a Site
|
|
6
6
|
|
|
7
|
-
This recipe guides you through installing Wix apps on a site using the Apps Installer REST API
|
|
7
|
+
This recipe guides you through installing Wix apps on a site using the Apps Installer REST API.
|
|
8
8
|
|
|
9
9
|
## Prerequisites
|
|
10
10
|
|
|
@@ -51,30 +51,8 @@ Use the returned `appId` as the `appDefId` in Step 2.
|
|
|
51
51
|
- The `appDefId` field in the install request and the `appId` field returned here are the same value
|
|
52
52
|
- If multiple results come back, match on `basicInfo.name` to confirm you have the right app before installing
|
|
53
53
|
- Only listings with `status: "PUBLISHED"` can be installed
|
|
54
|
-
## Step 1: Enable Velo (Wix Code) if Needed
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
**Endpoint**: `POST https://www.wixapis.com/mcp-serverless/v1/velo/provision`
|
|
59
|
-
|
|
60
|
-
**Request**:
|
|
61
|
-
```bash
|
|
62
|
-
curl -X POST \
|
|
63
|
-
'https://www.wixapis.com/mcp-serverless/v1/velo/provision/' \
|
|
64
|
-
-H 'Authorization: <AUTH>' \
|
|
65
|
-
-H 'Content-Type: application/json' \
|
|
66
|
-
-d '{}'
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Response**: Empty body on success.
|
|
70
|
-
|
|
71
|
-
### IMPORTANT NOTES:
|
|
72
|
-
- Only call this endpoint if you receive the `WDE0110` error
|
|
73
|
-
- This is a one-time operation per site
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## Step 2: Install the Wix App
|
|
55
|
+
## Install the Wix App
|
|
78
56
|
|
|
79
57
|
Use the Apps Installer API to install any Wix app on a site.
|
|
80
58
|
|
|
@@ -122,6 +100,7 @@ Some common apps:
|
|
|
122
100
|
| Wix Blog | `14bcded7-0066-7c35-14d7-466cb3f09103` |
|
|
123
101
|
| Wix Events | `140603ad-af8d-84a5-2c80-a0f60cb47351` |
|
|
124
102
|
| Wix Pricing Plans | `1522827f-c56c-a5c9-2ac9-00f9e6ae12d3` |
|
|
103
|
+
| Wix CMS | `e593b0bd-b783-45b8-97c2-873d42aacaf4` |
|
|
125
104
|
|
|
126
105
|
### IMPORTANT NOTES:
|
|
127
106
|
- NEVER guess the `appDefId`. For Wix-built apps, use the table above. For any other app, resolve the ID using Step 0 (Search Market Listings).
|
|
@@ -135,9 +114,6 @@ Some common apps:
|
|
|
135
114
|
### App Not Installed Error
|
|
136
115
|
If you receive an error indicating a required app is not installed, use this recipe to install it before proceeding.
|
|
137
116
|
|
|
138
|
-
### WDE0110: Wix Code not enabled
|
|
139
|
-
Call the Velo provision endpoint (Step 1) first, then retry the original operation.
|
|
140
|
-
|
|
141
117
|
---
|
|
142
118
|
|
|
143
119
|
## Next Steps
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Create Appointment Service"
|
|
3
|
+
description: "Create an appointment booking service — e.g. 'set up consultations', 'create a 1-on-1 session', 'add a personal training appointment', 'create a meeting service for $25'. Handles staff assignment (required), session duration, pricing, and 1-on-1 capacity defaults via bulkCreateServices API."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Create Appointment Service from Prompt
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- User wants to create an appointment-based service: "set up consultations", "create a 1-on-1 session", "add a personal training appointment", "create a meeting service"
|
|
11
|
+
- The service type is APPOINTMENT — customer picks an available time slot during staff working hours
|
|
12
|
+
- For general service creation where the type is ambiguous, see [Create Booking Service from Prompt](./create-booking-service-from-prompt.md)
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
- **Wix Bookings app installed** (App ID: `13d21c63-b5ec-5912-8397-c3a5ddb27a97`). Use [List Installed Apps](../app-installation/list-installed-apps.md) to verify, and [Install Wix Apps](../app-installation/install-wix-apps.md) to install if missing.
|
|
17
|
+
- For full API field definitions, validation rules, and troubleshooting, see [Create and Update Booking Services](./create-and-update-booking-services.md)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Step 1: Gather Business Context
|
|
22
|
+
|
|
23
|
+
Run these queries to collect site data for informed defaults.
|
|
24
|
+
|
|
25
|
+
### 1a. Query Staff Members (CRITICAL for Appointments)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
curl -X POST 'https://www.wixapis.com/bookings/v1/staff-members/query' \
|
|
29
|
+
-H 'Authorization: <AUTH>' \
|
|
30
|
+
-H 'Content-Type: application/json' \
|
|
31
|
+
-d '{
|
|
32
|
+
"query": {},
|
|
33
|
+
"fields": ["RESOURCE_DETAILS"]
|
|
34
|
+
}'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Save each staff member's `resourceId` (not `id`). Note which one has `default: true`.
|
|
38
|
+
|
|
39
|
+
**APPOINTMENT services REQUIRE at least one staff member.** If no staff members exist, create one first using [Bookings Staff Setup](./bookings-staff-setup.md).
|
|
40
|
+
|
|
41
|
+
### 1b. Query Service Categories
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
curl -X POST 'https://www.wixapis.com/bookings/v2/categories/query' \
|
|
45
|
+
-H 'Authorization: <AUTH>' \
|
|
46
|
+
-H 'Content-Type: application/json' \
|
|
47
|
+
-d '{ "query": {} }'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 1c. Get Site Currency
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
curl -X GET 'https://www.wixapis.com/site-properties/v4/properties' \
|
|
54
|
+
-H 'Authorization: <AUTH>'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Extract `properties.paymentCurrency`. Fall back to `USD` if unavailable.
|
|
58
|
+
|
|
59
|
+
### 1d. Query Existing Services (Duplicate Check)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
curl -X POST 'https://www.wixapis.com/bookings/v2/services/query' \
|
|
63
|
+
-H 'Authorization: <AUTH>' \
|
|
64
|
+
-H 'Content-Type: application/json' \
|
|
65
|
+
-d '{ "query": { "paging": { "limit": 100 } } }'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Warn the user if a service with a similar name already exists.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Step 2: Apply Appointment Defaults
|
|
73
|
+
|
|
74
|
+
For any fields the user did not explicitly specify:
|
|
75
|
+
|
|
76
|
+
| Field | Default | Notes |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| Duration | 60 minutes | Set via `schedule.availabilityConstraints.sessionDurations` |
|
|
79
|
+
| Capacity | 1 | Appointments are typically 1-on-1 |
|
|
80
|
+
| Staff | Auto-assign | Use `default: true` staff, or first available |
|
|
81
|
+
| Online booking | Enabled | `onlineBooking.enabled: true` |
|
|
82
|
+
|
|
83
|
+
### Pricing (if not specified)
|
|
84
|
+
|
|
85
|
+
- Use the site's currency from Step 1c
|
|
86
|
+
- If user specifies a price → `rateType: "FIXED"`
|
|
87
|
+
- If user says "free" → `rateType: "NO_FEE"`, `options.inPerson: true`, `options.online: false`
|
|
88
|
+
- If no price mentioned → infer from context (consultations ~$50-100, sessions ~$30-60) or default to free
|
|
89
|
+
|
|
90
|
+
### Staff Assignment
|
|
91
|
+
|
|
92
|
+
- **1 staff member** → auto-assign using their `resourceId`
|
|
93
|
+
- **Multiple staff members** → use the one with `default: true`, or the first one
|
|
94
|
+
- **No staff members** → create one first using [Bookings Staff Setup](./bookings-staff-setup.md), then proceed
|
|
95
|
+
|
|
96
|
+
### Category
|
|
97
|
+
|
|
98
|
+
- If categories exist → assign the most relevant one
|
|
99
|
+
- If no categories exist → create a "General" category:
|
|
100
|
+
```bash
|
|
101
|
+
curl -X POST 'https://www.wixapis.com/bookings/v2/categories' \
|
|
102
|
+
-H 'Authorization: <AUTH>' \
|
|
103
|
+
-H 'Content-Type: application/json' \
|
|
104
|
+
-d '{ "category": { "name": "General" } }'
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Service Name & Description
|
|
108
|
+
|
|
109
|
+
- Use the user's wording for the service name
|
|
110
|
+
- Generate a brief, professional description (1-2 sentences)
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Step 3: Create the Appointment Service
|
|
115
|
+
|
|
116
|
+
**Paid appointment:**
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
curl -X POST 'https://www.wixapis.com/bookings/v2/bulk/services/create' \
|
|
120
|
+
-H 'Authorization: <AUTH>' \
|
|
121
|
+
-H 'Content-Type: application/json' \
|
|
122
|
+
-d '{
|
|
123
|
+
"services": [{
|
|
124
|
+
"name": "<SERVICE_NAME>",
|
|
125
|
+
"description": "<GENERATED_DESCRIPTION>",
|
|
126
|
+
"type": "APPOINTMENT",
|
|
127
|
+
|
|
128
|
+
"onlineBooking": { "enabled": true },
|
|
129
|
+
"staffMemberIds": ["<RESOURCE_ID>"],
|
|
130
|
+
"schedule": {
|
|
131
|
+
"availabilityConstraints": {
|
|
132
|
+
"sessionDurations": [<DURATION_MINUTES>]
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"payment": {
|
|
136
|
+
"rateType": "FIXED",
|
|
137
|
+
"options": { "online": true, "inPerson": false },
|
|
138
|
+
"fixed": {
|
|
139
|
+
"price": { "value": "<PRICE>", "currency": "<CURRENCY>" }
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"category": {
|
|
143
|
+
"id": "<CATEGORY_ID>"
|
|
144
|
+
}
|
|
145
|
+
}]
|
|
146
|
+
}'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Free appointment:**
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
curl -X POST 'https://www.wixapis.com/bookings/v2/bulk/services/create' \
|
|
153
|
+
-H 'Authorization: <AUTH>' \
|
|
154
|
+
-H 'Content-Type: application/json' \
|
|
155
|
+
-d '{
|
|
156
|
+
"services": [{
|
|
157
|
+
"name": "<SERVICE_NAME>",
|
|
158
|
+
"description": "<GENERATED_DESCRIPTION>",
|
|
159
|
+
"type": "APPOINTMENT",
|
|
160
|
+
|
|
161
|
+
"onlineBooking": { "enabled": true },
|
|
162
|
+
"staffMemberIds": ["<RESOURCE_ID>"],
|
|
163
|
+
"schedule": {
|
|
164
|
+
"availabilityConstraints": {
|
|
165
|
+
"sessionDurations": [<DURATION_MINUTES>]
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"payment": {
|
|
169
|
+
"rateType": "NO_FEE",
|
|
170
|
+
"options": { "online": false, "inPerson": true }
|
|
171
|
+
},
|
|
172
|
+
"category": {
|
|
173
|
+
"id": "<CATEGORY_ID>"
|
|
174
|
+
}
|
|
175
|
+
}]
|
|
176
|
+
}'
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### APPOINTMENT-Specific Reminders
|
|
180
|
+
|
|
181
|
+
- `staffMemberIds` is **required** — uses `resourceId` values, not staff member `id`
|
|
182
|
+
- `schedule.availabilityConstraints.sessionDurations` sets the appointment length
|
|
183
|
+
- Availability is based on the assigned staff member's working hours schedule
|
|
184
|
+
|
|
185
|
+
Save the `serviceId` from the response: `results[0].item.service.id`
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Step 4: Navigate to Service Form
|
|
190
|
+
|
|
191
|
+
Use the **RUN_IN_BROWSER** tool to navigate the user to the service form for final review:
|
|
192
|
+
|
|
193
|
+
```javascript
|
|
194
|
+
window.location.href = `/bookings/services/form/${serviceId}?fromAria=true`;
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
This executes in the user's browser and redirects them to the service editing page.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Step 5: Summary Message
|
|
202
|
+
|
|
203
|
+
Provide a summary including:
|
|
204
|
+
|
|
205
|
+
1. **What was created** — service name, price, duration, assigned staff member
|
|
206
|
+
2. **Assumptions made** — list defaults used (e.g., "I set the duration to 60 minutes since you didn't specify")
|
|
207
|
+
3. **Next steps** — "Click Save to finalize, then set up your availability"
|
|
208
|
+
4. **Offer to adjust** — "Want me to change the price, duration, or staff assignment?"
|
|
209
|
+
|
|
210
|
+
**Example:**
|
|
211
|
+
|
|
212
|
+
> I created **"Strategy Consultation"**:
|
|
213
|
+
>
|
|
214
|
+
> - **Type**: Appointment (1-on-1)
|
|
215
|
+
> - **Price**: $75 per session
|
|
216
|
+
> - **Duration**: 60 minutes
|
|
217
|
+
> - **Staff**: Assigned to Sarah Johnson
|
|
218
|
+
> - **Category**: Consulting
|
|
219
|
+
>
|
|
220
|
+
> I assumed a 60-minute duration since you didn't specify. You can review and adjust the details in the service form.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Error Handling
|
|
225
|
+
|
|
226
|
+
| Error | Cause | Action |
|
|
227
|
+
|---|---|---|
|
|
228
|
+
| 428 "App not installed" | Bookings not installed | Install using [Install Wix Apps](../app-installation/install-wix-apps.md) |
|
|
229
|
+
| 400 "staffMemberIds required" | No staff assigned | Query staff; if none exist, create one via [Bookings Staff Setup](./bookings-staff-setup.md) |
|
|
230
|
+
| 400 "INVALID_PAYMENT_OPTIONS" | Payment misconfigured | Free: `inPerson: true`, `online: false`. Paid: price > 0 |
|
|
231
|
+
| 403 | Permission denied | Inform user they lack permission |
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Payment Validation Quick Reference
|
|
236
|
+
|
|
237
|
+
| rateType | `options.online` | `options.inPerson` | Valid? |
|
|
238
|
+
|----------|------------------|-------------------|--------|
|
|
239
|
+
| FIXED | true | false | ✓ |
|
|
240
|
+
| FIXED | false | true | ✓ |
|
|
241
|
+
| FIXED | true | true | ✓ |
|
|
242
|
+
| NO_FEE | false | true | ✓ |
|
|
243
|
+
| NO_FEE | true | false | ✗ |
|
|
244
|
+
| Any | false | false | ✗ |
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## What This Skill Does NOT Cover
|
|
249
|
+
|
|
250
|
+
- **Schedule/availability setup** — staff working hours need separate configuration. See [Bookings Staff Setup](./bookings-staff-setup.md)
|
|
251
|
+
- **Pricing plans** — memberships and session packs are separate. See [Create and Update Pricing Plans](../pricing-plans/create-and-update-pricing-plans.md)
|
|
252
|
+
- **Service images** — requires Media Manager API (see [create-and-update-booking-services.md](./create-and-update-booking-services.md))
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## API Documentation Reference
|
|
257
|
+
|
|
258
|
+
- [Bulk Create Services](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/bulk-create-services)
|
|
259
|
+
- [Query Services](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/query-services)
|
|
260
|
+
- [Query Categories](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/categories-v2/query-categories)
|
|
261
|
+
- [Create Category](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/categories-v2/create-category)
|
|
262
|
+
- [Query Staff Members](https://dev.wix.com/docs/api-reference/business-solutions/bookings/staff-members/staff-members/query-staff-members)
|
|
263
|
+
- [Create Staff Member](https://dev.wix.com/docs/api-reference/business-solutions/bookings/staff-members/staff-members/create-staff-member)
|
|
264
|
+
- [Site Properties](https://dev.wix.com/docs/api-reference/business-management/site-management/site-properties/properties/read)
|
|
265
|
+
- [About Service Types](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/about-service-types)
|
|
266
|
+
- [About Service Payments](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/about-service-payments)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Create Booking Service from Prompt"
|
|
3
|
+
description: "Create a booking service from a user prompt — e.g. 'create a yoga class for $50', 'set up consultations for $75', 'add a personal training appointment', 'create a 6-week photography workshop'. Determines the service type (APPOINTMENT, CLASS, or COURSE) and delegates to the type-specific recipe."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Create Booking Service from Natural Language Prompt
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- User describes a service they want to create using natural language (e.g., "create a yoga class for $50", "set up consultation sessions", "add a personal training appointment")
|
|
11
|
+
- The intent is autonomous creation — fill in reasonable defaults rather than asking the user for every field
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- **Wix Bookings app installed** (App ID: `13d21c63-b5ec-5912-8397-c3a5ddb27a97`)
|
|
16
|
+
- If Bookings is not installed, use [Install Wix Apps](../app-installation/install-wix-apps.md) to install it first
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Step 1: Determine Service Type
|
|
21
|
+
|
|
22
|
+
| User mentions | Type | Recipe |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| consultation, appointment, meeting, 1-on-1, one-on-one, session | `APPOINTMENT` | [Create Appointment Service](./create-appointment-service.md) |
|
|
25
|
+
| class, yoga, pilates, group session, group workout, bootcamp class | `CLASS` | [Create Class Service](./create-class-service.md) |
|
|
26
|
+
| workshop, program, course, training program, multi-session | `COURSE` | [Create Course Service](./create-course-service.md) |
|
|
27
|
+
| (unclear or unspecified) | `APPOINTMENT` | [Create Appointment Service](./create-appointment-service.md) |
|
|
28
|
+
|
|
29
|
+
## Step 2: Follow the Type-Specific Recipe
|
|
30
|
+
|
|
31
|
+
Once the service type is determined, follow the corresponding recipe linked above. Each recipe covers:
|
|
32
|
+
|
|
33
|
+
1. Gathering business context (staff, categories, currency, duplicate check)
|
|
34
|
+
2. Applying type-specific defaults (pricing, capacity, duration, staff assignment)
|
|
35
|
+
3. Creating the service via `bulkCreateServices`
|
|
36
|
+
4. Navigating to the service form for user review
|
|
37
|
+
5. Providing a summary of what was created and assumptions made
|