Wix Vibe Headless
WixOfficialPublished by Wix
- Skill
- Tool integration
- Automation and integrations
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
Wix Vibe Headless provides a set of dependency-free REST helpers and integration guides to connect existing frontend projects to live Wix sites. It enables developers to display Wix business data—such as store products, blog posts, bookings, and events—directly in their own applications without using the Wix SDK, backend infrastructure, or complex build steps. The skill is designed for read-only access to owner content, ensuring that data remains synchronized with the Wix dashboard.
What it does
- Connects frontends to Wix sites using a public WIX_CLIENT_ID.
- Provides REST helpers for Stores, Bookings, Blog, Events, and other Wix business solutions.
- Supports member login and gated content without redirecting to Wix-hosted pages.
- Maintains visitor sessions using tokens persisted in local storage.
- Offers structured guidance for wiring data into HTML, JSX, or Vite projects.
- Ensures consistent data rendering by using formatted values from Wix API objects.
When to use it
- When you need to display live Wix site data in a custom frontend application.
- When you want to add shopping, booking, or membership flows to an existing project.
- When you prefer a client-only, dependency-free integration over the Wix SDK.
- When you are working with a vibe-coded app, HTML/JSX, or a design-tool export.
Advantages
- No backend or build step required for integration.
- Dependency-free implementation using standard REST calls.
- Maintains a single source of truth for business data in the Wix dashboard.
- Supports custom UI design while leveraging Wix's business logic.
Usage examples
- “Connect my React app to my Wix store products.”
- The agent identifies the storefront vertical, copies the necessary REST helpers to the src directory, and provides instructions to wire the product grid component.
- “How do I add a blog feed to my Vite project using my Wix site?”
- The agent verifies the blog vertical, sets up the taxonomy context, and guides the integration of the shipped post-grid and post-detail components.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/wix/wix-vibe-headless/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip wix-vibe-headless.zip -d .agents/skills
Documentation by Wix
Wix Vibe Headless — client-only REST connectors
Wire an existing front end to a live Wix site from the browser, over the site's public
WIX_CLIENT_ID, using hand-rolled REST — no @wix/sdk, no backend, no build step, no
dependencies. One skill, one shared transport, and a copy-as-is REST layer per Wix
business solution. Everything is read-only over the owner's content: render live Wix
data or an honest empty state — never mock, never provision, never invent products,
posts, events, menus, plans, reviews, or counts.
When to use this skill
The user has (or is building) a front end — a vibe-coded app, plain HTML/JSX, a Vite/React project, a design-tool export — and wants it to show live data from their existing Wix site and complete real purchases/bookings, all from the client.
They hand you a public
WIX_CLIENT_IDand ask to "connect this to my Wix store / blog / bookings / events / …".They want to replace placeholder/mock data with real Wix content, or add a cart, checkout, booking, RSVP, ticketing, reservation, form, or subscribe flow over an app they already have.
When NOT to use this skill
| Scenario | Use instead |
|---|---|
| Build a new Wix site end-to-end from one prompt (discovery → design → build → host) | wix-headless |
The project should use the Wix SDK (@wix/sdk) and/or the Wix CLI, or be hosted on Wix | wix-headless |
| Manage/configure the site via REST (install apps, seed catalogs, set up business solutions) | wix-manage |
| Build a Wix app extension (dashboard page, widget, backend, plugin) | wix-app |
This skill is the deliberately client-only, REST-only path. It is independent from
wix-headless (which is SDK + CLI + hosting) — do not mix the two in one project.
The shared model (applies to every vertical)
Auth = one public client id.
WIX_CLIENT_IDis a buyer/visitor-facing credential — it only mints anonymous visitor tokens. It is not a secret; hardcoding and committing it is fine. The user provides it (their vibe/host platform surfaces a copyable prompt with the id filled in). Paste it intowix-config.jsin place of the<YOUR-CLIENT-ID>placeholder.Money/price fields are objects, never scalars. Every price/amount a Wix API returns — Stores
price.actualPrice, Bookings servicepayment.fixed.price, Events ticketregistration.tickets.lowestPrice, and the rest — has the shape{ value, currency, formattedValue }. RenderformattedValue(it already includes the currency symbol), or fall back to building fromvalue+currency. Never drop the object straight into the UI or treat it as a number/string — that renders[object Object]or a bare unformatted number. Donations exception: campaign prices use{ amount, formattedAmount }, with a decimal-stringamount; donation cartoptions.amountmust instead be a JSON number. Follow the Donations recipe.Visitor token = identity.
wix-client.jsmints an anonymous visitor token, persists the refresh token tolocalStorage, and refreshes on expiry. That token IS the identity of the cart / reservation / member session — never re-mint anonymously per load or the cart silently empties.Member login swaps the token set on the same client. The members vertical is custom login — the front owns its login UI; the member is never redirected to a Wix-hosted login page. On success it writes the member's tokens into the same store the visitor token used (
setSessionTokens), so every subsequentwixApiRequestruns as the member and the cart/session carries over. "My …" surfaces (plans, orders, bookings, registrations) light up only once logged in.⚠️ Once you're building on Wix, keep it on Wix — auth, member data, and other business features too. If you're wiring a Wix storefront/blog/etc. over
WIX_CLIENT_ID, prefer Wix for the rest of the app as well, rather than reaching for a host platform's own backend or login. Especially for auth: when the user wants members, log them in as a Wix member (membersvertical) — don't bolt on the host platform's auth. Likewise, member-generated content (likes, reviews, submissions, "my …" lists) goes in a Wix CMS collection (cmsvertical), not a host database.The split-brain trap: the most common failure is mixing the two — e.g. storing "likes" in the host's DB while identifying the member from the Wix session (or logging in with Wix members but keying data on a host user id). The two identities never match, ownership filters silently return nothing (a like vanishes on refresh), and the data never sits with the rest of the Wix content.
Rule of thumb: one store and one identity per feature. For a Wix-backed feature that's the Wix member + the Wix collection, with ownership on Wix's server-stamped
_owner(never a hand-stored or host-supplied member id). Using a host backend for genuinely host-only data is fine — just never straddle a single feature across both.
Never mock, never provision. These scaffolds are read-only over the owner's content. The owner adds products/posts/services/events/menus/plans in the Wix dashboard. If a collection is empty, show the empty state — never fabricate data, reviews, ratings, or counts.
Purchases go through Wix. Checkout/ticketing/plan purchase always complete via the Wix redirect-session / Wix-hosted form — never hand-build a
/checkoutor purchase URL.Fail loudly. The helpers throw on out-of-stock, empty carts, unbookable slots, expired holds, and payment-still-owed. A green path means it really worked — don't swallow the error.
Copy the shipped helpers as-is — don't rewrite their internals. Wire your UI to the exported functions; don't "refactor" or reimplement the helper bodies. Several Wix request shapes are exact and easy to break (the members
createRedirectSessionbody is the classic trap — a rewritten version returns 400 and login dies). Extend by calling the exports or adding a newwixApiRequestcall for a genuine gap — never by editing the shipped ones.Beyond the snippets, look it up — never guess. The templates and the shipped
references/<vertical>/helpers are the implementation — build from them first. When you hit a genuine gap (a field, an endpoint, or an error the snippets don't cover), extend the client withwixApiRequest— confirming the exact endpoint, method, and body first. For that iteration and troubleshooting — finding the right endpoint, reading a method's request/response schema, or diagnosing an API error — consult the official Wix API documentation using the documentation skill available in your environment to search methods, read pages, and inspect API schemas. Reference index: https://dev.wix.com/docs/api-reference.mdProvide the user with deep links to the Wix dashboard: In many cases, the user will need to modify the default vertical data in the Wix dashboard. Always provide the user with these links. The relevant information for each vertical's links is in its
INSTRUCTIONS.mdfile.
How this skill is structured
<SKILL_ROOT> is this file's directory (strip /SKILL.md). Each vertical supplies integration
code under references/<vertical>/app/: REST helpers in app/rest/, and, depending on the
vertical, utilities, hooks, context, components, or pages. All use the shared transport in
references/shared/app/ (app/rest/wix-client.js + wix-config.js, identical for every vertical).
Set WIX_CLIENT_ID (and WIX_METASITE_ID) in wix-config.js. Deploying references/<vertical>/app/
and references/shared/app/ into the app's src/ puts every file in place — the REST helpers land in
src/rest/, so their relative imports resolve.
Where these files live in the app, and how they get there (pre-installed at setup, or copied in) is your platform's call — follow your platform instructions for that.
Each vertical's INSTRUCTIONS.md specifies its prerequisites, supplied pieces, exported interfaces,
and the presentation you must build. Read it before implementation: reuse the supplied pieces
and build the missing presentation without reimplementing shipped logic. Follow the platform's
and vertical's completion guidance where provided.
Routing — pick the vertical(s) from the request
Load the vertical(s) the user's app needs; a project may combine several (e.g. a restaurant with a blog, or a store with pricing plans).
Each vertical's integration files ship in references/<vertical>/app/; copy that dir plus
references/shared/app/ into the app's src/ (base44 does this at install via deploy.cjs).
| The user wants… | Vertical | Read |
|---|---|---|
| Online store: products, categories, cart, checkout | storefront | references/storefront/INSTRUCTIONS.md |
| Donations: fundraising campaigns, one-time or recurring giving, hosted checkout | donations | references/donations/INSTRUCTIONS.md |
| Appointments: services, time slots, booking, checkout — and the form attached to a bookable service | bookings | references/bookings/INSTRUCTIONS.md |
| Rentals: an item hired for a length the customer picks (by the hour or by the day) — Wix Rentals runs on the Bookings APIs, so it is the same vertical | bookings | references/bookings/INSTRUCTIONS.md ("Rentals") |
| Blog/news: post feed, post pages, categories, tags | blog | references/blog/INSTRUCTIONS.md |
Events: browse, event page, RSVP, ticketing — an RSVP is here, not forms, even for one occasion with no tickets | events | references/events/INSTRUCTIONS.md |
| Portfolio/showcase: collections, projects, media galleries | portfolio | references/portfolio/INSTRUCTIONS.md |
| Restaurant: menu, online ordering, table reservations | restaurants | references/restaurants/INSTRUCTIONS.md |
Any visitor-fillable form: contact/enquiry, lead, signup, waitlist, application, feedback/survey, quote request, intake or registration. Not an event RSVP (events), per-service booking form (bookings) or donation contribution (donations) | forms | references/forms/INSTRUCTIONS.md |
CMS content: list/detail, filter/search, data CRUD. A visitor-fillable form is forms — cms only when the app must read the entries back | cms | references/cms/INSTRUCTIONS.md |
| Plans & pricing: memberships/subscriptions, subscribe, my plans | pricing-plans | references/pricing-plans/INSTRUCTIONS.md |
| Member accounts: custom login/sign-up (email+password, Google/Facebook, SSO), account area, gated content | members | references/members/INSTRUCTIONS.md |
⚠️ Anything a visitor fills in and submits is forms — with four exceptions:
The app must read the entries back →
cms. A public gallery, a listing, a member's "my submissions". A visitor cannot read Forms submissions, so those need a collection. Submit-only is alwaysforms: a form wired toinsertDataItemworks, but gives up the dashboard form builder, spam protection, submission notifications and CRM contact mapping, and needs the owner to set collection permissions by hand before anyone can submit at all.Confirming attendance to an event or occasion →
events. A wedding, party or gathering — events ships a built-in RSVP registration form. Route there even for a single occasion with no tickets.A form attached to a bookable service →
bookings.A contribution to a donation campaign →
donations. Recurring giving is not a Pricing Plans purchase; the donation form must preserve the campaign's amount/frequency rules and use its catalog reference.
When the request doesn't name a Wix Business Solution — ask, or check the site
Don't infer which Wix Business Solution to build (stores, bookings, blog, events, portfolio,
restaurants, CMS, pricing plans, members, etc..) from a vague brief. Ask the user one short
question — what do they offer (products? appointments? posts? events?) — or check what the
site actually has: call a cheap read from each likely solution's helper (queryProducts,
queryServices, queryPosts, queryEvents, …) — authenticated with a visitor token minted
from the WIX_CLIENT_ID, or with an admin token if you have one — and build for the solutions
that return real content. A 428 "app not installed" (blog: 401) means
that solution isn't on the site; sample-looking content ("Sample product 3") proves the app is
installed, not what the business is about. Never default to store/bookings on silence.
The run
Get
WIX_CLIENT_ID. It comes from the user (the handoff prompt from their Wix/vibe platform carries it). If it's missing, ask for it before wiring — nothing works without it.Pick the vertical(s) from the routing table — and when the request doesn't name any, ask or check the site (see above) instead of guessing. Open each picked vertical's
INSTRUCTIONS.md.Ensure the vertical's files are in place — copy
references/<vertical>/app/andreferences/shared/app/into the app'ssrc/, and setWIX_CLIENT_IDinwix-config.js. (Where and how they get there is your platform's call — see its instructions. On base44 the install step writes and verifieswix-config.jsfor you, so there's nothing to set by hand.)Build the presentation and wire the integration following the vertical's
INSTRUCTIONS.md. Reuse its supplied pieces through their documented interfaces, build the presentation it leaves to you, and connect routes/providers as specified. Do not reimplement shipped logic. Style new presentation using the existing platform theme.Complete the applicable platform and vertical guidance, including any required checks and handoff instructions they provide.
Some flows need Wix-side setup the user completes later (payments connected, the deployed domain allow-listed on the OAuth client for hosted-checkout return, collection permissions). Those are out of scope here — if a call fails for that reason, flag it and continue; don't fall back to mock data.
Files
- ATTRIBUTION.mdAdded by AutoGineer821 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md14.9 KiB
- install/deploy.cjsScript12.3 KiB
- install/pin-agents-md.cjsScript3.0 KiB
- platforms/README.md1.8 KiB
- platforms/base44-ecom-light-seed-with-install.md7.5 KiB
- platforms/base44-ecom-light-seed.md6.8 KiB
- platforms/base44-ecom-light.md5.1 KiB
- platforms/base44.md9.9 KiB
- platforms/generic.md7.9 KiB
- references/_shared/nav/nav.tanstack.jsScript1.2 KiB
- references/_shared/routing.md4.6 KiB
- references/blog/INSTRUCTIONS.md16.9 KiB
- references/blog/app/components/PostCard.jsxScript1.9 KiB
- references/blog/app/components/PostChips.jsxScript1.2 KiB
- references/blog/app/components/PostGrid.jsxScript506 B
- references/blog/app/context/TaxonomyContext.jsxScript1.5 KiB
- references/blog/app/hooks/usePostDetail.jsScript1.6 KiB
- references/blog/app/pages/Blog.jsxScript1.6 KiB
- references/blog/app/pages/CategoryPage.jsxScript2.3 KiB
- references/blog/app/pages/PostDetail.jsxScript2.4 KiB
- references/blog/app/pages/TagPage.jsxScript2.0 KiB
- references/blog/app/rest/wix-blog.jsScript8.0 KiB
- references/blog/seed/SEED.md6.4 KiB
- references/blog/seed/seed-blog.cjsScript14.4 KiB
- references/bookings/INSTRUCTIONS.md21.5 KiB
- references/bookings/app/components/BookingForm.jsxScript3.3 KiB
- references/bookings/app/components/RentalDurationPicker.jsxScript2.9 KiB
- references/bookings/app/components/ServiceCard.jsxScript2.8 KiB
- references/bookings/app/components/ServiceGrid.jsxScript537 B
- references/bookings/app/components/SlotPicker.jsxScript5.6 KiB
- references/bookings/app/hooks/useRentalDuration.jsScript5.1 KiB
- references/bookings/app/hooks/useServiceDetail.jsScript5.3 KiB
- references/bookings/app/hooks/useServices.jsScript2.7 KiB
- references/bookings/app/lib/serviceFacts.jsScript4.1 KiB
- references/bookings/app/pages/ServiceDetail.jsxScript4.4 KiB
- references/bookings/app/pages/Services.jsxScript3.5 KiB
- references/bookings/app/rest/wix-bookings-checkout.jsScript7.1 KiB
- references/bookings/app/rest/wix-bookings-rentals.jsScript11.6 KiB
- references/bookings/app/rest/wix-bookings-services.jsScript15.2 KiB
- references/bookings/seed/SEED.md10.6 KiB
- references/bookings/seed/seed-bookings.cjsScript16.0 KiB
- references/bookings/seed/seed-rentals.cjsScript11.5 KiB
- references/cms/INSTRUCTIONS.md14.3 KiB
- references/cms/app/collection.config.jsScript2.0 KiB
- references/cms/app/lib/wixImage.jsScript1.1 KiB
- references/cms/app/rest/wix-cms.jsScript10.8 KiB
- references/cms/seed/SEED.md9.1 KiB
- references/donations/INSTRUCTIONS.md5.9 KiB
- references/donations/app/rest/wix-donations.jsScript6.1 KiB
- references/donations/seed/SEED.md703 B
- references/donations/tests/donations.test.mjsScript15.0 KiB
- references/events/INSTRUCTIONS.md16.9 KiB
- references/events/app/components/CategoryFilter.jsxScript1.1 KiB
- references/events/app/components/EventCard.jsxScript2.5 KiB
- references/events/app/components/EventGrid.jsxScript502 B
- references/events/app/components/EventRegistration.jsxScript1.2 KiB
- references/events/app/components/RsvpForm.jsxScript2.6 KiB
- references/events/app/components/TicketPicker.jsxScript3.5 KiB
- references/events/app/hooks/useEventDetail.jsScript1.3 KiB
- references/events/app/hooks/useEventsList.jsScript2.3 KiB
- references/events/app/hooks/useRsvpForm.jsScript1.7 KiB
- references/events/app/hooks/useTicketing.jsScript3.3 KiB
- references/events/app/pages/EventDetail.jsxScript2.0 KiB
- references/events/app/pages/Events.jsxScript1.4 KiB
- references/events/app/rest/wix-events-browse.js6.4 KiB
- references/events/app/rest/wix-events-registration.js9.5 KiB
- references/events/seed/SEED.md7.1 KiB
- references/events/seed/seed-events.cjs12.4 KiB
- references/forms/INSTRUCTIONS.md30.6 KiB
- references/forms/app/hooks/useWixForm.js20.9 KiB
- references/forms/app/lib/wix-form-schema-utils.js8.7 KiB
- references/forms/app/rest/wix-forms-submissions.js11.8 KiB
- references/forms/app/rest/wix-forms.js5.6 KiB
- references/forms/seed/SEED.md70.8 KiB
- references/members/INSTRUCTIONS.md21.4 KiB
- references/members/app/components/LoginForm.jsx4.1 KiB
- references/members/app/components/MemberMenu.jsx1.5 KiB
- references/members/app/components/RequireAuth.jsx1.0 KiB
- references/members/app/components/SocialButtons.jsx1.4 KiB
- references/members/app/context/MemberContext.jsx2.3 KiB
- references/members/app/hooks/useLoginForm.js3.1 KiB
- references/members/app/pages/Account.jsx1.8 KiB
- references/members/app/pages/Callback.jsx1.4 KiB
- references/members/app/pages/Login.jsx1.3 KiB
- references/members/app/rest/wix-members-auth.js17.2 KiB
- references/members/install/Register.jsx1.1 KiB
- references/members/seed/SEED.md1.6 KiB
- references/portfolio/INSTRUCTIONS.md16.6 KiB
- references/portfolio/app/components/CollectionCard.jsx1.6 KiB
- references/portfolio/app/components/CollectionGrid.jsx567 B
- references/portfolio/app/components/ProjectCard.jsx1.9 KiB
- references/portfolio/app/components/ProjectGrid.jsx537 B
- references/portfolio/app/components/ProjectMedia.jsx1.3 KiB
- references/portfolio/app/hooks/useCollectionProjects.js1.4 KiB
- references/portfolio/app/hooks/usePortfolioGallery.js1.1 KiB
- references/portfolio/app/hooks/useProjectDetail.js1022 B
- references/portfolio/app/pages/CollectionPage.jsx1.6 KiB
- references/portfolio/app/pages/Portfolio.jsx1.1 KiB
- references/portfolio/app/pages/ProjectDetail.jsx2.3 KiB
- references/portfolio/app/rest/wix-portfolio.js8.9 KiB
- references/portfolio/seed/SEED.md6.1 KiB
- references/portfolio/seed/seed-portfolio.cjs11.4 KiB
- references/pricing-plans/INSTRUCTIONS.md16.9 KiB
- references/pricing-plans/app/components/OrderCard.jsx1.8 KiB
- references/pricing-plans/app/components/PlanCard.jsx2.2 KiB
- references/pricing-plans/app/components/PlanGrid.jsx652 B
- references/pricing-plans/app/components/PlanPrice.jsx1.5 KiB
- references/pricing-plans/app/hooks/useMyPlans.js1.3 KiB
- references/pricing-plans/app/hooks/usePlanDetail.js1.1 KiB
- references/pricing-plans/app/hooks/usePlans.js1.3 KiB
- references/pricing-plans/app/pages/MyPlans.jsx1.4 KiB
- references/pricing-plans/app/pages/PlanDetail.jsx2.1 KiB
- references/pricing-plans/app/pages/Plans.jsx1.1 KiB
- references/pricing-plans/app/rest/wix-pricing-plans.js6.7 KiB
- references/pricing-plans/seed/SEED.md5.3 KiB
- references/pricing-plans/seed/seed-pricing-plans.cjs11.9 KiB
- references/rentals/INSTRUCTIONS.md514 B
- references/restaurants/INSTRUCTIONS.md19.2 KiB
- references/restaurants/app/components/ItemDialog.jsx4.2 KiB
- references/restaurants/app/components/MenuItemCard.jsx3.3 KiB
- references/restaurants/app/components/MenuList.jsx1.9 KiB
- references/restaurants/app/components/OrderCartButton.jsx1.3 KiB
- references/restaurants/app/components/OrderCartDrawer.jsx3.9 KiB
- references/restaurants/app/context/OrderCartContext.jsx3.3 KiB
- references/restaurants/app/hooks/useItemOrder.js1.4 KiB
- references/restaurants/app/hooks/useReservation.js3.3 KiB
- references/restaurants/app/pages/Menu.jsx1.2 KiB
- references/restaurants/app/pages/Reservations.jsx4.8 KiB
- references/restaurants/app/rest/wix-restaurants-menu.js8.6 KiB
- references/restaurants/app/rest/wix-restaurants-ordering.js10.9 KiB
- references/restaurants/app/rest/wix-restaurants-reservations.js5.5 KiB
- references/restaurants/seed/SEED.md12.8 KiB
- references/restaurants/seed/seed-restaurants.cjs25.3 KiB
- references/shared/app/components/WixManageBanner.jsx2.8 KiB
- references/shared/app/lib/nav.js678 B
- references/shared/app/rest/wix-client.js6.5 KiB
- references/shared/app/rest/wix-config.js548 B
- references/storefront/INSTRUCTIONS.md27.4 KiB
- references/storefront/app/components/CartButton.jsx1.2 KiB
- references/storefront/app/components/CartDrawer.jsx9.8 KiB
- references/storefront/app/context/CartContext.jsx3.7 KiB
- references/storefront/app/hooks/useProductCard.js6.3 KiB
- references/storefront/app/hooks/useProductDetail.js8.4 KiB
- references/storefront/app/hooks/useShop.js3.9 KiB
- references/storefront/app/hooks/useVariantOptions.js2.7 KiB
- references/storefront/app/lib/storeImage.js3.5 KiB
- references/storefront/app/rest/wix-store-cart.js9.0 KiB
- references/storefront/app/rest/wix-store-catalog.js12.3 KiB
- references/storefront/seed/SEED.md12.0 KiB
- references/storefront/seed/seed-store.cjs27.6 KiB
references/bookings/seed/seed-bookings.cjs
// Bookings seed helpers — run at BUILD TIME via exec_tool (NOT shipped in the app).
// The agent requires this and calls the functions with plain data; all Wix Bookings
// request/response mechanics (the flat Services-V2 payload, the resourceId-vs-staff-id trap,
// the category-visibility invariant, the { event: {…} } session wrapper, the silent media.image
// drop) live here, once.
//
// **NOT yet live-verified — transcribed from setup-bookings.md.**
//
// Usage (build-time exec_tool):
// const { accessToken } = await base44.asServiceRole.connectors.getConnection("wix"); // Base44 (generic: use $TOKEN)
// const seed = require("/app/.agents/skills/wix-vibe-headless/references/bookings/seed/seed-bookings.cjs");
// const ctx = { token: accessToken, siteId: WIX_METASITE_ID };
//
// await seed.installBookingsApp(ctx); // if the site doesn't have Wix Bookings yet
//
// // ORDER MATTERS: resolve a staff resource (STEP 1) and a category (STEP 2) BEFORE services (STEP 3).
// const staff = await seed.queryStaffWithRetry(ctx); // polls: fresh install provisions the owner async
// const resourceId = staff[0].resourceId; // NB: resourceId, NOT staff id
// const cats = await seed.createCategories(ctx, ["Our Services"]);
// const services = await seed.createServices(ctx, [
// { type: "APPOINTMENT", name: "Consultation", description: "…", tagLine: "…",
// price: 75, duration: 60, categoryId: cats[0].id, staffMemberIds: [resourceId] },
// { type: "CLASS", name: "Morning Yoga", description: "…", capacity: 20,
// price: 20, categoryId: cats[0].id },
// ]);
// // STEP 4 (CLASS only): needs each class's returned scheduleId.
// await seed.scheduleClassSessions(ctx, services.filter(s => s.type === "CLASS").map(s => ({
// scheduleId: s.scheduleId, resourceId, start: "2026-08-10T09:00:00", end: "2026-08-10T10:00:00", capacity: 20,
// })));
// // optional — import the image url to Wix Media first (bookings binds by file id), then patch (revision-checked).
// // const file = await seed.importImage(ctx, imageUrl); // → { id, url } (Wix Media file id + wixstatic url)
// // await seed.attachServiceImage(ctx, { serviceId: s.id, revision: s.revision, image: { id: file.id, url: file.url, width: 1024, height: 1024 } });
//
// If any call fails with a shape the caller didn't expect, or you need an operation this module
// doesn't cover, fall back to the documentation skill available in your environment (search + read the live Wix API reference) —
// never guess. Source recipe (authoritative): wix-headless/references/inline-recipes/setup-bookings.md.
const API = "https://www.wixapis.com";
// Wix Bookings app id (from the recipe's "API surfaces" note).
const BOOKINGS_APP_ID = "13d21c63-b5ec-5912-8397-c3a5ddb27a97";
async function req(ctx, path, { method = "POST", body } = {}) {
const res = await fetch(API + path, {
method,
headers: {
Authorization: `Bearer ${ctx.token}`,
"wix-site-id": ctx.siteId,
"Content-Type": "application/json",
},
body: body ? JSON.stringify(body) : undefined,
});
const json = await res.json().catch(() => ({}));
if (!res.ok) throw new Error(`${method} ${path} -> ${res.status}: ${JSON.stringify(json).slice(0, 400)}`);
return json;
}
// name -> url slug fallback when item.mainSlug.name is absent (lowercase, non-alphanumerics -> hyphens, dedupe)
function slugify(name) {
return String(name || "")
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-+|-+$/g, "");
}
// plain service -> flat Services V2 create object. price omitted / free:true -> NO_FEE.
// sessionDurations is APPOINTMENT-only; staffMemberIds is required-non-empty for APPOINTMENT, omitted for CLASS.
function buildService(s) {
const isAppointment = s.type === "APPOINTMENT";
const free = s.free === true || s.price == null;
const out = {
type: s.type,
name: s.name,
description: s.description,
tagLine: s.tagLine,
defaultCapacity: s.capacity ?? (isAppointment ? 1 : undefined), // required for ALL types
onlineBooking: { enabled: true, requireManualApproval: false, allowMultipleRequests: false },
payment: free
? { rateType: "NO_FEE", options: { online: false, inPerson: true } }
: {
rateType: "FIXED",
fixed: { price: { value: String(s.price), currency: s.currency ?? "USD" } }, // value is a STRING; site currency wins
options: { online: true, inPerson: false },
},
category: { id: s.categoryId }, // mandatory for live-site visibility
locations: [{ type: "BUSINESS" }], // never OWNER_BUSINESS on the services endpoint
};
if (isAppointment) {
out.schedule = { availabilityConstraints: { sessionDurations: [s.duration] } }; // APPOINTMENT only, minutes
out.staffMemberIds = s.staffMemberIds; // resourceId(s) from STEP 1 — non-empty or MISSING_APPOINTMENT_RESOURCES
}
return out;
}
// ---- exported operations ----
async function installBookingsApp(ctx) {
return req(ctx, "/apps-installer-service/v1/app-instance/install", { body: {
tenant: { tenantType: "SITE", id: ctx.siteId },
appInstance: { appDefId: BOOKINGS_APP_ID, enabled: true },
} });
}
// The default "Business Owner" is a RESOURCE, not a service — it won't appear here.
async function listServices(ctx) {
const r = await req(ctx, "/bookings/v2/services/query", { body: { query: { paging: { limit: 100 } } } });
return (r.services ?? []).map((s) => ({ id: s.id, name: s.name }));
}
// STEP 1: resolve staff resources. Returns [{ resourceId, id, name }].
// ⚠️ staffMemberIds takes resourceId, NOT the staff id — read staffMember.resourceId.
async function queryStaff(ctx) {
const r = await req(ctx, "/bookings/v1/staff-members/query", {
body: { query: {}, fields: ["RESOURCE_DETAILS"] },
});
return (r.staffMembers ?? []).map((m) => ({ resourceId: m.resourceId, id: m.id, name: m.name }));
}
// installBookingsApp → provisioning is async (Wix signals completion via the App-Instance-Installed
// webhook, which an exec script can't receive). The default "Business Owner" resource isn't queryable
// in the same tick, so queryStaff returns [] (or throws "Business schedule not found") until it lands.
// Poll so the one-call path resolves the owner instead of failing APPOINTMENT services with
// MISSING_APPOINTMENT_RESOURCES. Already-provisioned sites return on the first try (no added latency).
async function queryStaffWithRetry(ctx, { tries = 10, delayMs = 2000 } = {}) {
let lastErr;
for (let i = 0; i < tries; i++) {
try { const s = await queryStaff(ctx); if (s.length) return s; }
catch (e) { lastErr = e; }
if (i < tries - 1) await new Promise((r) => setTimeout(r, delayMs));
}
if (lastErr) throw lastErr; // never provisioned → surface the real error rather than a silent []
return [];
}
// STEP 1 (optional): create named staff when the request names stylists/providers. staff: [{ name, description }].
// ⚠️ Omit email/phone unless you have a real value — V1 rejects empty strings. Returns [{ resourceId, id, name }].
async function createStaff(ctx, staff) {
const out = [];
for (const m of staff) {
const body = { staffMember: { name: m.name, description: m.description } };
const r = await req(ctx, "/bookings/v1/staff-members", { body });
out.push({ resourceId: r.staffMember?.resourceId, id: r.staffMember?.id, name: r.staffMember?.name });
}
return out;
}
// STEP 2: query existing categories (to reuse one created earlier this run). Returns [{ id, name }].
async function queryCategories(ctx) {
const r = await req(ctx, "/bookings/v2/categories/query", { body: { query: {} } });
return (r.categories ?? []).map((c) => ({ id: c.id, name: c.name }));
}
// STEP 2: create categories — every service needs a category.id or it's invisible on the live site.
// Independent (no shared revision, unlike Stores categories); looped here one call per category.
async function createCategories(ctx, names) {
// Reuse an existing same-named category instead of creating a duplicate. Bookings categories aren't
// unique-by-name, so a re-run (or a partial-failure retry — categories are created before services)
// would otherwise pile up dupes. Keeps the seed additive-but-idempotent.
const byName = new Map((await queryCategories(ctx)).map((c) => [c.name, c]));
const out = [];
for (const name of names) {
let cat = byName.get(name);
if (!cat) {
const r = await req(ctx, "/bookings/v2/categories", { body: { category: { name } } });
cat = { id: r.category?.id, name };
byName.set(name, cat);
}
out.push(cat);
}
return out;
}
/**
* STEP 3: bulk-create services (up to 100), one call. APPOINTMENT and CLASS may be mixed.
* MUST run AFTER staff (STEP 1) and category (STEP 2) are resolved.
* @param services [{ type:"APPOINTMENT"|"CLASS", name, description, tagLine?, categoryId,
* price?, currency?, free?, duration?(APPOINTMENT minutes), capacity?, staffMemberIds?(resourceIds, APPOINTMENT) }]
* @returns [{ id, slug, revision, type, scheduleId, index, success, error }]
* scheduleId feeds scheduleClassSessions (CLASS); revision feeds attachServiceImage.
* Retry only the items where success===false, ONCE, with the same body — don't loop, don't re-create successes.
*/
async function createServices(ctx, services) {
const body = { services: services.map(buildService), returnEntity: true };
const r = await req(ctx, "/bookings/v2/bulk/services/create", { body });
return (r.results ?? []).map((res, i) => {
const item = res.item ?? {};
return {
id: item.id ?? res.itemMetadata?.id,
slug: item.mainSlug?.name ?? slugify(item.name ?? services[i]?.name),
revision: item.revision,
type: item.type ?? services[i]?.type,
scheduleId: item.schedule?.id,
index: res.itemMetadata?.originalIndex ?? i,
success: res.itemMetadata?.success ?? false,
error: res.itemMetadata?.error,
};
});
}
/**
* STEP 4 (CLASS only): schedule sessions in one bulk Calendar-Events-V3 call. Skip for APPOINTMENT.
* @param sessions [{ scheduleId(CLASS item.schedule.id), resourceId(from STEP 1), start, end, capacity? }]
* start/end are LOCAL wall-clock "YYYY-MM-DDThh:mm:ss" (no Z), today-or-future.
* @returns [{ id, index, success, error }] — events send no returnEntity, so ids come from itemMetadata only.
* Retry only failed events once.
*/
async function scheduleClassSessions(ctx, sessions) {
const body = {
events: sessions.map((s) => ({
event: {
scheduleId: s.scheduleId,
type: "CLASS",
start: { localDate: s.start },
end: { localDate: s.end },
resources: [{ id: s.resourceId, permissionRole: "WRITER" }], // non-empty + WRITER, else UNKNOWN_ROLE 400
...(s.capacity != null ? { totalCapacity: s.capacity } : {}),
},
})),
};
const r = await req(ctx, "/calendar/v3/bulk/events/create", { body });
return (r.results ?? []).map((res, i) => ({
id: res.itemMetadata?.id,
index: res.itemMetadata?.originalIndex ?? i,
success: res.itemMetadata?.success ?? false,
error: res.itemMetadata?.error,
}));
}
// Fetch a service (for its current revision before an image patch, or to confirm an image landed).
async function getService(ctx, serviceId) {
return req(ctx, `/bookings/v2/services/${serviceId}`, { method: "GET" });
}
/**
* Import an external image URL into Wix Media → { id, url }. Bookings binds a service image by the
* Wix Media file **id** (`mainMedia.image.id`), NOT a url — so an external url (e.g. a base44
* generate_image result) MUST be imported first; the raw url as the id stores (200) but renders
* nothing. `id` is the wixstatic file id (`<hash>~mv2.png`), `url` the permanent wixstatic url.
*/
async function importImage(ctx, url, displayName = "image.png") {
const r = await req(ctx, "/site-media/v1/files/import", { body: { url, mimeType: "image/png", displayName } });
const f = r.file || r;
if (!f?.id) throw new Error(`import-file returned no file id: ${JSON.stringify(r).slice(0, 200)}`);
return { id: f.id, url: f.url };
}
/**
* Attach an image (optional). Writes under media.mainMedia + media.coverMedia; revision-checked.
* @param it { serviceId, revision, image: { id, url, width, height } } — `image.id` MUST be a Wix
* Media file id (from importImage), never a raw external url.
* ⚠️ Writing under media.image (not mainMedia/coverMedia) returns 200 but SILENTLY drops the image — a 200
* is not proof; confirm with getService and check media.mainMedia is populated. Never block on failure.
*/
async function attachServiceImage(ctx, it) {
return req(ctx, `/bookings/v2/services/${it.serviceId}`, {
method: "PATCH",
body: {
service: {
id: it.serviceId,
revision: it.revision,
media: { mainMedia: { image: it.image }, coverMedia: { image: it.image } },
},
},
});
}
/**
* ONE-CALL seed: install → resolve staff → categories → services → CLASS sessions → images, in the
* correct order, keeping ids in memory (no hand-threading of scheduleId/resourceId across exec
* calls). DEFAULT path — call it once instead of the individual functions.
*
* @param plan {{
* services: [{ type:"APPOINTMENT"|"CLASS", name, description, tagLine?, price?, free?, duration?,
* capacity?, category?(name), staffMemberIds?,
* sessions?: [{ start, end, capacity? }], // CLASS only; local "YYYY-MM-DDThh:mm:ss"
* imageUrl? }], // a plain image url; imported to Wix Media here, optional
* staffResourceId?: string, // defaults to the fresh install's owner (queryStaff()[0].resourceId)
* }}
* @returns { services:[...createServices], categories:[{id,name}], resourceId, sessionsScheduled, imagesAttached }
*/
async function setupBookings(ctx, { services = [], staffResourceId } = {}) {
await installBookingsApp(ctx);
let resourceId = staffResourceId;
if (!resourceId) {
const staff = await queryStaffWithRetry(ctx); // fresh install provisions the default owner async — poll
resourceId = staff[0]?.resourceId;
}
const catNames = [...new Set(services.map((s) => s.category).filter(Boolean))];
const cats = catNames.length ? await createCategories(ctx, catNames) : [];
const catIdByName = new Map(cats.map((c) => [c.name, c.id]));
const created = await createServices(ctx, services.map((s) => ({
type: s.type, name: s.name, description: s.description, tagLine: s.tagLine,
price: s.price, free: s.free, duration: s.duration, capacity: s.capacity,
categoryId: s.category ? catIdByName.get(s.category) : undefined,
staffMemberIds: s.staffMemberIds ?? (s.type === "APPOINTMENT" && resourceId ? [resourceId] : undefined),
})));
const sessions = [];
created.forEach((c, i) => {
const plan = services[i];
if (c.type === "CLASS" && Array.isArray(plan?.sessions)) {
for (const ses of plan.sessions) {
sessions.push({ scheduleId: c.scheduleId, resourceId, start: ses.start, end: ses.end, capacity: ses.capacity ?? plan.capacity });
}
}
});
const scheduled = sessions.length ? await scheduleClassSessions(ctx, sessions) : [];
let imagesAttached = 0;
for (let i = 0; i < created.length; i++) {
const url = services[i]?.imageUrl; // a plain image url (e.g. base44 generate_image) — imported here
if (!url || !created[i]?.id) continue;
try {
const file = await importImage(ctx, url, `${created[i].slug || "service"}.png`); // → Wix Media file id
await attachServiceImage(ctx, {
serviceId: created[i].id, revision: created[i].revision,
image: { id: file.id, url: file.url, width: 1024, height: 1024 },
});
imagesAttached++;
} catch { /* never block on image failure — leave the service text-only */ }
}
return { services: created, categories: cats, resourceId, sessionsScheduled: scheduled.length, imagesAttached };
}
module.exports = {
setupBookings,
installBookingsApp, listServices,
queryStaff, queryStaffWithRetry, createStaff, queryCategories, createCategories,
createServices, scheduleClassSessions, getService, importImage, attachServiceImage,
};
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
What our scanner noticed· Low risk
- Instructions that use the network
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Wix
- Publisher
- Wix (Official)
- Source
- wix/skills · skills/wix-vibe-headless · commit d168bc2
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Wix.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download wix-vibe-headless.zip