# AI chatbot for online booking

Mavibot services - is one of the sections related to the CRM system that allows you to automate the filling of employees' schedules with online booking through a bot.

<div data-with-frame="true"><figure><img src="/files/eKMmSdEL9WtHqRMi1oXO" alt="" width="375"><figcaption></figcaption></figure></div>

To work with an online booking and an artificial intelligence chatbot, we need:

1. A customized branch with categories and services themselves, as well as a completed staff schedule.

{% hint style="warning" %}
Pay attention! \
Do not forget to assign a position to employees in the Service settings, otherwise the function for reading services will not work!
{% endhint %}

2. There are two blocks in the funnel constructor;
3. AI assistant.&#x20;

## Workflow builder

Step 1. Go to the funnel constructor and create the "Start" block:

<div data-with-frame="true"><figure><img src="/files/bHqWyjK0CGEYAzEiW8I5" alt=""><figcaption></figcaption></figure></div>

The block need to be created before the assistant settings, because we will use it to add a variable with information about services and employee time to the project settings.

Also, the information from the variable will be available to all your clients.

To do this, write project before the declared variable, then the name of the service\_info variable, then assign it the value of the function for reading available services in the get\_info\_for\_booking branch.

<div data-with-frame="true"><figure><img src="/files/0ThZRtgq6UYD2OgrJZCQ" alt="" width="563"><figcaption></figcaption></figure></div>

In total, we get: project.service\_info = get\_info\_for\_booking().

To understand that the block has started, add any system message, and also to display the values stored in a variable, output it using the #{} construction:

<div data-with-frame="true"><figure><img src="/files/XCJBR8nRo2iUQuKXaYvT" alt="" width="563"><figcaption></figcaption></figure></div>

Next, go to the testing window of the bot and launch the block for caching the variable in the project settings:

<div data-with-frame="true"><figure><img src="/files/l2w1fmbDozJ7xUQ3is8a" alt="" width="375"><figcaption></figcaption></figure></div>

If you have done everything correctly, you will receive a response from the bot in the form of a message that you have specified in this block (in our example, "Variable updated") and the value contained in the variable.

{% hint style="success" %}
Pay attention!

After setting up the AI chatbot and online booking, do not delete the "Start" block

You will need it if you update your range of services or add new employees.

To update the service\_info variable in the project, simply launch this block in the test window, then the updated data will be included in the variable value.
{% endhint %}

Step 2 Create a second block - “Chat”, where you need to register:

1. A function for creating booking

&#x20;create\_booking\_by\_name function (service\_name, date, date\_time, company\_id) creates booking based on the data transmitted by the AI assistant to the system.

The function takes three required parameters to generate booking:

<table><thead><tr><th width="297">parameters</th><th>description</th></tr></thead><tbody><tr><td><mark style="color:$danger;"><strong>!</strong></mark> service_name</td><td>required parameter, service name</td></tr><tr><td><mark style="color:$danger;"><strong>!</strong></mark> date</td><td>date in the format dd.mm.yyyy</td></tr><tr><td><mark style="color:$danger;"><strong>!</strong></mark> date_time</td><td>service time in hh:mm format</td></tr><tr><td>company_id</td><td>Branch ID, optional<br>If it is specified, an entry will be created for the service with the specified name, which belongs to this particular branch.<br>This parameter may be needed if several branches have services with the same name.</td></tr></tbody></table>

2. project.service\_info = get\_info\_for\_booking() - is in order to configure and make an booking into the CRM system, these free services were provided to users due to the availability of additional service information.

<div data-with-frame="true"><figure><img src="/files/psLSV2owvTgbFwmBhss5" alt=""><figcaption></figcaption></figure></div>

In the message block field, write the required bot response after the client selects the service and time.

## How to work as an AI assistant

Next, go to the AI assistant, where you need to set up the settings for online booking.

Let's choose the assistant role - it should be an online booking:

<div data-with-frame="true"><figure><img src="/files/Uer85azOK4W8av3nQYVm" alt="" width="330"><figcaption></figcaption></figure></div>

The prepared settings can be selected at your discretion:

<div data-with-frame="true"><figure><img src="/files/OjMhcs2J9NLDMXl2YzJm" alt="" width="563"><figcaption></figcaption></figure></div>

What determines the choice of our settings?:

1. Minimizing fantasies - is an option necessary in order for the bot to be less creative and to advise the client only on the available data.
2. Step-by-step data entry - you will need to enter step-by-step data for the formation of the application and variables.
3. Do not learn from messages - to limit the influence of third parties on the bot and prevent it from being corrupted by intruders.
4. Buttons - so that the client does not independently enter the date, time and service during the process of making an application in the bot.

Next, go to the settings of the bot, where we will describe its main tasks:

<div data-with-frame="true"><figure><img src="/files/xlCli6eKLhKZrmEiJCjh" alt=""><figcaption></figcaption></figure></div>

#### **Important configuration note**

This role has been pre-configured by the MaviBot developers with core functionality. In the settings, you only need to specify **additional key commands** that are outside the bot’s presumed knowledge base.

**Guideline:**

There is no need to instruct the bot on its primary purpose—it is already fully capable of advising clients about your services. Focus instead on unique workflows, specific product details, or exceptional scenarios.

<div data-with-frame="true"><figure><img src="/files/Cl8mqRjiVodXHirwNoyN" alt="" width="375"><figcaption></figcaption></figure></div>

{% hint style="success" %}

## **Please note**

**Button-based service selection**

With the pre-configured **"Button"** settings, the AI assistant presents available services as interactive buttons.

**Key benefit:** clients no longer need to manually type service names—they can simply click the relevant button for instant selection.
{% endhint %}

After the client clicks on the button, the AI will advise them on the cost and the service itself:

<div data-with-frame="true"><figure><img src="/files/DYH8sNnpzortrJ9lyppB" alt="" width="375"><figcaption></figcaption></figure></div>

b) Next, the bot will independently show the free days and time for the service selected by the client, since this is also set in the bot settings.

<div data-with-frame="true"><figure><img src="/files/KsRV1kvLFHX8n6CnGfK6" alt="" width="375"><figcaption></figcaption></figure></div>

2. Please note the following command in the bot settings:

**Write without changing start\_block\_from\_ai N**

This command ensures the AI assistant responds without altering the initial logic defined in the `start_block_from_ai` function.

<div data-with-frame="true"><figure><img src="/files/g6mvuISEz7J1fZojZDT2" alt=""><figcaption></figcaption></figure></div>

"Then execute command “start\_block\_from\_ai <mark style="color:green;">**11916**</mark>" - instead of the numbers marked in green, write down the ID of the "Chat" block, which was created earlier in the funnel constructor. It contains the necessary function for generating a booking in the Booking system:

<div data-with-frame="true"><figure><img src="/files/9uLIvj8EgDsBnDcm6E7z" alt=""><figcaption></figcaption></figure></div>

Copy the block ID and set it to the command 'Then execute command  "start\_block\_from\_ai N"', where substitute the ID instead of N.

### Other assistant settings

**To use a cached variable:** Reference the variable cached in the **"Start"** block within the bot's knowledge settings.

<div data-with-frame="true"><figure><img src="/files/2A1gx0SMJHg52Vk5hk4z" alt=""><figcaption></figcaption></figure></div>

In the knowledge of the bot, a variable need to be written as a variable using the construction #{}

<div data-with-frame="true"><figure><img src="/files/D7qD2CiLDvB8J1bW19gv" alt="" width="563"><figcaption></figcaption></figure></div>

In the “Format of transmitted data” field, enter the value and key:

<div data-with-frame="true"><figure><img src="/files/TasQDWKTydgHVHN6UwDj" alt=""><figcaption></figcaption></figure></div>

These variables will be transferred to the system after calling the block, and using our create\_booking\_by\_name(service\_name, date, date\_time) function, a Booking will be created.

<div data-with-frame="true"><figure><img src="/files/zSmPORBpNpIYiBSvex2c" alt=""><figcaption></figcaption></figure></div>

In the same **"Chat"** block, we re-register the `service_info` variable. This ensures that after a client completes a booking, the variable—populated by its function—automatically updates with the latest available time slots.

Now, let's test the assistant to verify the update process works correctly.

<div data-with-frame="true"><figure><img src="/files/tjgBUPiXzPgEsR3nhYRa" alt="" width="314"><figcaption></figcaption></figure></div>

The assistant has worked correctly.

In the example, you saw that in the last message sent to the client, the result of the function is displayed: after debugging the AI assistant's work with the online booking function, you can remove the variable `#{result}` from the message in the **Chat** block.

<div data-with-frame="true"><figure><img src="/files/5ush4mfnS8gIZJxr3ahH" alt="" width="375"><figcaption></figcaption></figure></div>

After testing and debugging the AI assistant with online booking, you can remove the `#{result}` construct from the message in the Chat block of the chatbot builder.

<div data-with-frame="true"><figure><img src="/files/SxfF59IhZK5mYGRrfqgi" alt=""><figcaption></figcaption></figure></div>

Now let's look at the calendar in the "Booking" section:

<div data-with-frame="true"><figure><img src="/files/aW6Y2YgRG42MYK4IObc1" alt="" width="563"><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/ewRiNKhHnKA6oXF9YFWb" alt=""><figcaption></figcaption></figure></div>

A corresponding entry is automatically created in the Calendar, factoring in the duration required for the booked service.

{% hint style="success" %}

#### **Summary**

With this approach, you can effectively **create distinct service branches** and **fully automate customer registration** using your AI bot.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mavibot.ai/chatbot/ai/online-booking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
