← Example scenarios

The bot tells a customer when you are free

A calendar reports busy time; the scenario works out the free slots itself and names them by the hour.

What the scenario looks like

«Когда вы свободны»
Календарь
Занятое время▶
Свободные окна▶
Ответ▶
Ответ▶
  • Execute + Data
  • Data
Open in your workspace →

“When are you free?” is a question a human answers by opening a calendar and doing the arithmetic. A bot can answer instantly, but there is one step between question and answer you would not expect: a calendar can only tell you when you are busy.

What is inside

  1. “When are you free” — the entry.
  2. Busy time asks the calendar for its busy intervals for the day.
  3. Free slots — a code node. It takes the working day, cuts it into hours and drops the ones that overlap anything busy.
  4. The answer prints what is left.

This is the only example on the page that genuinely needs code, and for that exact reason: interval arithmetic is slower and less reliable from a model, while code gets it right and costs nothing.

What to set up for yourself

  • The working day and the step — three constants on the first line of the code: start, end, slot length.
  • The calendar address on the busy node.
  • Time zones. The code works in UTC, as the calendar returns it. If you show slots to a customer, convert them to their zone or they will arrive three hours early.
  • Several calendars. Busy time can be requested across several at once; then free means free in all of them.

What to connect

A calendar over CalDAV. Answering about free slots does not need write access: the scenario only reads.