> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Introduction

## Article: Introduction

## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/time-slots/availability-time-slots-configuration-service-plugin/introduction.md

## Article Content:

# About the Availability Time Slots Configuration Service Plugin

The Availability Time Slots Configuration service plugin allows you to customize how Wix calculates available time slots for booking services.

With this service plugin, you can:

- Configure service duration, split intervals, and buffer times.
- Specify which locations the service is offered at.
- Define which [resources](https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/introduction.md) are required and available for booking.
- Calculate duration based on the customer's selected duration variant from [service options and variants](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/introduction.md) and/or selected [add-ons](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/add-ons/introduction.md).
- Configure a bookable duration range for services where the customer selects how long to book. Use the `durationUnit` field to define the unit of time (`HOUR` or `DAY`) and the minimum and maximum durations a customer can choose.

Learn more about [service plugin extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/service-plugins/about-service-plugin-extensions.md).


## Before you begin

It's important to note the following point before starting to code:

- [Resources](https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/introduction.md) must exist before time slot calculation.


## Use cases

- [Provide custom time slot configurations during booking](https://dev.wix.com/docs/api-reference/business-solutions/bookings/time-slots/availability-time-slots-configuration-service-plugin/sample-flows.md#provide-custom-time-slot-configurations-during-booking).
- [Provide duration range configurations for flexible-duration services](https://dev.wix.com/docs/api-reference/business-solutions/bookings/time-slots/availability-time-slots-configuration-service-plugin/sample-flows.md#provide-duration-range-configurations-for-flexible-duration-services).


::::tabs
:::REST

## Get started

To enable Wix to communicate with your app:

1. Go to [Extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/about-extensions.md) in your app's dashboard.
1. Click **Create Extension** in the top right.
1. Filter by **Bookings** in the left menu, then find **Availability Time Slots Configuration service plugin** and click **Create**.
1. Provide the following configuration in the JSON editor and then click **Save**.

    | Name | Type | Description |
    | --- | --- | --- |
    | `deploymentUri`|string|**Required.** Base URI where your service plugin endpoints are deployed. For example, to call the List Availability Time Slot Configurations endpoint at `https://my-availability-provider.com/v2/list-availability-time-slot-configurations`, the base URI you provide here is `https://my-availability-provider.com/`. |
    | `providerName`|string|**Required.** Display name for your provider. |

:::
:::SDK

## Get started

Follow these steps to begin implementing your service plugin.

### Step 1 | Choose a framework

You can implement this service plugin with the following [frameworks](https://dev.wix.com/docs/build-apps/get-started/overview/wix-s-development-frameworks.md):

+ **Wix CLI:** Learn how to [implement a service plugin with the CLI and the SDK](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-cli/supported-extensions/backend-extensions/service-plugins/add-service-plugin-extensions-with-the-cli.md).
+ **Self-hosted:** Learn how to [implement a self-hosted service plugin with the SDK and the app dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/develop-a-self-managed-app/supported-extensions/backend-extensions/service-plugins/add-self-managed-service-plugin-extensions-with-the-sdk.md).

### Step 2 | Configure your service plugin

To configure and customize your plugin, you need to provide important information in the service plugin configuration file. You can [configure your plugin in your app's dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/develop-a-self-managed-app/supported-extensions/backend-extensions/service-plugins/add-self-managed-service-plugin-extensions-with-the-sdk.md). For details, see [Availability Time Slots Configuration Extension Configuration](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-time-slots-configuration-service-plugin/extension-config.md).

### Step 3 | Define handler functions

Use [`availabilityTimeSlotsConfiguration.provideHandlers()`](https://dev.wix.com/docs/build-apps/develop-your-app/develop-a-self-managed-app/supported-extensions/backend-extensions/service-plugins/add-self-managed-service-plugin-extensions-with-the-sdk.md) to define the following handler functions that implement your custom business logic. Make sure you define all required functions.

| Function                    | Required       |
|-----------------------------|----------------|
| [`listAvailabilityTimeSlotConfigurations()`](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-time-slots-configuration-service-plugin/list-availability-time-slot-configurations.md)    | Yes            |

## Code examples

Below is an example for implementing the Availability Time Slots Configuration service plugin in your code.

### CLI: Basic code structure

This is the basic code structure for implementing the Availability Time Slots Configuration service plugin with the Wix CLI:

```js
import { availabilityTimeSlotsConfiguration } from '@wix/bookings/service-plugins'

availabilityTimeSlotsConfiguration.provideHandlers({
  listAvailabilityTimeSlotConfigurations: async (payload) => {

    const {request, metadata} = payload;

    // Add your logic here

  }
});
  
```

### Self-hosted: Basic code structure

This is the basic code structure for implementing a self-hosted Availability Time Slots Configuration service plugin:

```js
import { createClient } from '@wix/sdk';
import { availabilityTimeSlotsConfiguration } from '@wix/bookings/service-plugins'

const wixClient = createClient({
  auth: {
    appId: <YOUR_APP_ID>,
    publicKey: <YOUR_APP_PUBLIC_KEY>
  },
  modules: { availabilityTimeSlotsConfiguration }
});

wixClient.availabilityTimeSlotsConfiguration.provideHandlers({
  listAvailabilityTimeSlotConfigurations: async (payload) => {

    const { request, metadata } = payload;

    // Add your logic here

  }
});

// Implement a router to process all requests
express.post('/plugins-and-webhooks/*', (req, res) => {
  wixClient.process(req);
});
  
```
:::
::::


## Terminology

For a comprehensive glossary of Wix Bookings terms, see [Terminology](https://dev.wix.com/docs/api-reference/business-solutions/bookings/terminology.md).

## See also
+ [About Service Plugin Extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/service-plugins/about-service-plugin-extensions.md)
+ [Add a Service Plugin Extension With the CLI](https://dev.wix.com/docs/build-apps/develop-your-app/frameworks/wix-cli/supported-extensions/backend-extensions/service-plugins/add-service-plugin-extensions-with-the-cli.md)
+ [Add a Self-hosted Service Plugin With the SDK](https://dev.wix.com/docs/build-apps/develop-your-app/develop-a-self-managed-app/supported-extensions/backend-extensions/service-plugins/add-self-managed-service-plugin-extensions-with-the-sdk.md)
+ [Add Self-hosted Service Plugin Extensions with REST](https://dev.wix.com/docs/build-apps/develop-your-app/develop-a-self-managed-app/supported-extensions/backend-extensions/service-plugins/add-self-managed-service-plugin-extensions-with-rest.md)
+ [Time Slots V2 API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/time-slots/time-slots-v2/introduction.md)
+ [Booking Policy service plugin](https://dev.wix.com/docs/api-reference/business-solutions/bookings/policies/booking-policy-service-plugin/introduction.md)

