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.

To work with an online booking and an artificial intelligence chatbot, we need:
A customized branch with categories and services themselves, as well as a completed staff schedule.
Pay attention! Do not forget to assign a position to employees in the Service settings, otherwise the function for reading services will not work!
There are two blocks in the funnel constructor;
AI assistant.
Workflow builder
Step 1. Go to the funnel constructor and create the "Start" block:

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.

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:

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

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.
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.
Step 2 Create a second block - “Chat”, where you need to register:
A function for creating booking
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:
! service_name
required parameter, service name
! date
date in the format dd.mm.yyyy
! date_time
service time in hh:mm format
company_id
Branch ID, optional If it is specified, an entry will be created for the service with the specified name, which belongs to this particular branch. This parameter may be needed if several branches have services with the same name.
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.

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:

The prepared settings can be selected at your discretion:

What determines the choice of our settings?:
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.
Step-by-step data entry - you will need to enter step-by-step data for the formation of the application and variables.
Do not learn from messages - to limit the influence of third parties on the bot and prevent it from being corrupted by intruders.
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:

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.

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.
After the client clicks on the button, the AI will advise them on the cost and the service itself:

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.

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.

"Then execute command “start_block_from_ai 11916" - 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:

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.

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

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

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.

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.

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.

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.

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


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