AI assistant with MaviBot tables

Using a dedicated function developed by the MaviBot team, your AI chatbot can intelligently read values from a Google Sheet and store them in a system variable within your project settings. This creates a synchronized, dynamic data source for your assistant.

Practical applications

This capability is essential for scenarios such as:

  • Product catalog assistant: an AI that advises clients on your current product range, prices, and availability in real time.

  • Smart promotion bot: a bot that promotes your offerings by dynamically highlighting features, specs, or deals pulled directly from your sheet.

How to prepare your table for integration

To get started, go to the sheets section:

Next, you will see the "Add sheet" button, which opens a modal window in which you need to enter the name of the sheet:

Enter the name for the sheet and click on the "Done" button. Then a new sheet will be created in the project and will appear in the "Sheets" section:

Sheet settings

After creating the sheet, you need to add rows and columns. To do this, find the "Go to" button on the card of the desired sheet and click on it.

You see next settings:

To add column with a name, click the "+" button:

When you click the button, a modal window will open where you can enter a name for the new column.

Afte entering the column name, click on the "Done" button, then the new column will be added to the sheet. Add the required number of columns and then rows.

Now, you sheet looks like this.

Copy (remember) the sheet ID: to do this, click on the address bar:

Next, let's go to configuring the blocks in the builder.

Working in the Chatbot builder

Function get_records_from_table()

To use the get_info_from_table() function, you need one block in the chatbot builder.

Go to the appropriate tab in Mavibot and create a block with a trigger (Start block or Trigger block):

Define a variable (it will be used for the AI assistant's knowledge): in this example, the variable is 'record'.

Example of code from the Calculator

project.record = get_records_from_table(1)

  1. project. - is a constructor for setting a variable in the project configuration;

  2. record - name variable;

  3. get_records_from_table(1) - function, where the parameter is passed as table ID.

chevron-rightRead more about the get_record_from_table() functionhashtag

get_records_from_table(table_id, start_row, count, start_col, end_col) – to get records from a table

Parameter
Description
Note

! table_id

table ID (required parameter)

start_row

optional parameter, integer. Specifies the starting row of the range

accepts the row number from which to start reading the table values, inclusive. Must be specified without quotation marks

count

optional parameter, integer. Specifies the number of rows to retrieve

default value: 1000. Maximum: 5000. Must be specified without quotation marks

start_col

optional parameter, string. Specifies the starting column of the range

accepts the column name from which to start reading the table values, inclusive. Must be specified in quotation marks

end_col

optional parameter, string. Specifies the end column of the range

accepts the column name up to which to read the table values, inclusive. Must be specified in quotation marks

To read all data from a certain point: Specify only the start of the range. To read all data up to a certain point: Specify only the end of the range.

Instead of #{none}, we will write our variable in the message using the #{} construct to visually see what data has been written to the project variable.

circle-exclamation

Attention

circle-check

Please note

circle-info

The variable name can be any name that you like.

Data transfer block

Next, we will create "Chat" block for transferring data to the client's card.

"This block can also transmit a closing message from the bot, such as: 'I’m passing the information to the manager! The manager will connect within 10 minutes.'"

Next, copy the block ID. You will need it to configure the AI assistant in the "start_block_from_ai 11956" command and the test "Block call 11956" command, where instead of the block ID from the example, you need to insert your block ID.

circle-check

Please note

Reading a table

  1. Navigate to bot testing mode.

  2. Launch the block that contains the trigger for reading the table data.

The block has worked correctly. You can see this confirmed by the values now stored in the corresponding variable within your project settings.

To verify manually:

  1. Go to the Project settings section.

  2. Locate the variable to view its current data.

In the "Variables" tab in the project settings, you will see your variable with the values added in it from the table. So now, inside your project, there is a variable with goods, cost, and everything that you specified in the table.

Working in AI assistant

Go to the "AI assistant" section and start chatbot with AI settings.

You need to choose the "Sales assistant" role:

We will also set additional settings:

AI assistant settings

In the bot settings write the following data:

  1. The position and instructions for the bot.

  1. The command to call the block and transfer variables to the system is written as follows:

"If everything is correct, execute the command "start_block_from_ai 11956", where instead of N the block ID is written with the final message: the Chat block transmits data to the customer's card:

Bot knowledge

In the "Bot Knowledge" field, pass the variable that was previously cached as a block with the trigger.

Bot knowledge.

This way, the bot will take information from a variable in the project settings and advise your clients on the available product range.

Data format

In the format of the transmitted data, you specify the data you are collecting yourself (for example, a product), then enter the phrase with the "key" and assign a value to the key.

the client name with key client_name, the client phone number with key phone_number, the city and the address with key city_address, the chosen product with key product, the quantity of product with key quantity, the total order amount with key total_amount.

This way, when calling the block, variables will be passed to the client's card: then you can work with variables, for example, in the chatbot builder:

At this stage, the AI assistant setup is complete.

The remaining parameters can be set at your discretion:

Testing a bot

"If you already have bots running, specify in the AI assistant's launch condition to start only in the testing window."

Step 1. Click on the trigger builder

Step 2. Select the tab with the test window and click "Add trigger":

Now, in the trigger condition, you will see the following value:

circle-info

This way, the bot will run only in the test window and nowhere else.

After debugging the bot, remove this condition.

This message is being sent in test mode due to the command "Block call 3124105

After testing and debugging the bot, write the command in the settings of the bot "start_block_from_ai 31241050".

circle-check

Last updated