Input types problem

(Govher Abbas Zade) #1

Hi everbody. I want to learn how can I write the clients age. For example >18 and <70.And if age is more than 18 it must be OK. how can I set that telegram bot for clients input


(Karen Barker) #2

Hi Govher,

There’s a few ways you could do this.

  1. Give choices such as “Which bracket does your age fall into <18, 18 < > 70, < 70”. Then you can use the users answer to decide whether the user is in the right bracket and can move forward through the bot using filters.

  2. Ask for the users age and then filter the next actions based on age is greater than 18 and age is less than 70.

  3. Ask for the users date of birth and use the Date and Time Service to calculate the age. Again the next actions would need a filter based on age is greater than 18 and age is less than 70.

I hope this helps. :slight_smile:

1 Like

(Govher Abbas Zade) #3

is there a template about it?


(Daniel Beckett) #4

The first two options that Karen shared would be the easiest way to handle it. You can just ask for an age in a question and then use filters to control how the flow should progress.

For the third option you can calculate a person’s age by using a combination of the Date & Time Service and the Number service.

First, you would need to format the date using a custom format from the supported list here. There’s an option to format into seconds by setting it as ‘X’. If you were using a Catch-all trigger it would look something like this:


Now we have today’s date and time converted into seconds we can do a calculation to work out the year value.

There are 86400 seconds in a day and 365 days in a year so the calculation would be:


You’d then repeat these two actions for the date of birth provided by the user.

Once that’s done you’ll have two calculation outputs that you need to subtract from each other to get the age, e.g:


Here’s an example flow showing how this works:

Once you have the age you can have a filter setup to check whether it is greater than or equal to 18 to know if they’re of the right age.

Hope that helps! Please let me know if you have any questions.:slightly_smiling_face:


1 Like

(Govher Abbas Zade) #6

is is working thank u lottt