Can I limit the user's questions or time on my cha...
# 🤝help
To manage the Ai spend and our data base, I would like to have the option to limit the questions asked by the users to a certain number, or have a timeout to their session. This could be eliminated for subscribed users. Any ideas on how to do that and limitations if deployed on the web or on whatsapp?
Both an inactivity timeout and repetition limit (i,e. limiting the number of questions) are easily done via the bot settings (see screenshot). To make the repetition limit dynamic based on whether the user is a subscriber is a little more involved. I would think adding some code to check the user type (subscribed or not) and the number of repetitions, and then diverting the workflow/response accordingly, would be the way forward.
You can also add a table, with user id and number of messages sent and last time a message was sent by them.
Everytime they send a message you increase the "number of messages"
Somewhere at the beginning of the flow, check for the number of messages sent by the user, then show an error in case they passed the limits
Awesome! Thank you soo much everyone. This is a great guide @quick-musician-29561 !
Hi! Is there a way to disable or change repetition limit to unlimited?
The example AA posted is really good and works well. I believe it uses '2 messages per hour'. We have also built something similar, using '10 messages in 24 hours' for some parts of the chatbot (VIP or Expert area), while all other parts are always available for use.
By building it this way, it resets at different times for every user. This is different from resetting the daily messages always at 00:00, for example. If someone uses 10 messages between 11:50 PM - 11:59 PM, they would have 10 new messages starting at 00:00 again. If they use the next 10 messages between 0:00 AM - 0:10 AM, they would have used a total of 20 messages in 20 minutes. However, with our setup, users can only use 10 messages in a 24-hour period because it records the time of each user's last 'message reset' and counts how many messages they have used in the last 24 hours.
So, there are at least two different ways to build this (the other method uses CRON). But this was the solution we needed for our projects.
How would building this be different if we implement a "key" feature and depending on it you would have a different amount of credits? I am implementing this solution so it would be great if you have any guidance on iterations based on it.
@quick-musician-29561 It says that there is an ai task running, is that the same as ai transition or is there an ai task in the bot you sent?