Skip to content

BMI calculator

The chatbot asks for the height and the weight, checks them with a validator, then a custom component computes the BMI (body mass index) and its category. See Custom components for more.

  • numberBetween creates a validator for each step, with its own range.
  • BMIResult reads the answers with steps.height.value and steps.weight.value. The values are strings, so they are converted with Number.
  • asMessage: true shows the result inside a bot bubble.