https://discord.gg/botpress logo
Monthly message limits
# 🤝help
l
First, I searched the help feed for the solution but so far this seems to be unresolved. Has anyone figured out how to limit a user based on the number of messages sent? In my real example I want to limit specific outputs. For example - each time the bot outputs a new recipe then that adds 1 to the monthly limit. If there’s not way to do that then what’s the next best option? I’ve been stuck for a month. No code both in botpress or vercel app works. No console.log shown in browser. Can someone help?
p
You could achieve this by using an if-else approach. It would require the user's userId to be grabbed at the beginning of a new conversation and compared to a table which holds the userIds of previous users and their number of conversations or messages used. If the limit has been reached then they would be redirected to the end of the conversation node and otherwise are allowed to chat. If the count is per message sent then you would have to use an after incoming hook to count the messages sent. Hope this helps!