Table of Contents

How to let user select a time of booking (with a minimum 45 minutes notice)

Pau Sanchez Updated by Pau Sanchez

For Landbot (Web)

This is a specific case in which a user might want to offer users time to book a specific time, but having control over the possible delivery times.

In this example we will work under the case that the user can:

- Select only between 07:00 AM and 09:00 PM

- Booking must be with at least 45 minutes before the time of booking

  1. We start by getting the timestamp in HH: mm format to control the time. So we use and adapt the Timestamp

And make sure the order value is stored in the variable @timestamp:

  1. After the Timestamp Brick, we will add a Set Variable with the array that contains all the options (times) we want the user to select. In this case, we will do it every 15 min.

In case you want to use already built lists, you can check the Brick called "Select Time v0.1". You can change the content. In the case above we only keep the times between 07:00 to 21:00, and store all in the variable @times (as an Array)

  1. Now, we will use the variable @times in a Dynamic Data block (type Autocomplete) to display the values:

It's important that now we store the time selected by the user in the variable @choice.

  1. Once the options for the user had been addressed, we will take care of the calculations with 3 formula blocks. The goal is to get the minutes difference between the two selections:

  1. In the first formula, we pull the number of minutes for the time of booking (@bookingminutes)

Sum(
Product(
GetValue(Split(@choice,":"),0)
,60),
GetValue(Split(@choice,":"),1)
)
  1. In the second formula, we pull the number of minutes for the time of the timestamp (@timestampminutes)

Sum(
Product(
GetValue(Split(@timestamp,":"),0)
,60),
GetValue(Split(@timestamp,":"),1)
)

In the last formula, we check the difference and will be true or false, based on that we can ask the user to select another time of booking.

IsGreaterOrEqual(
Subtract(@bookingminutes,@timestampminutes),
45)

How did we do?

How to redirect user to another url in your site with Livechat open to continue conversation

Get the array's index of the user selection and extract information from array

Contact