How to restrict user?

(Prakhar Monga) #1

I am letting my users upload product images through chatbot.
I want to restrict users to upload only 3 pics in a day and 50 pics in a month.
when a user uploads 3 pics he will not be able to upload more and this limit resets after 24 hours.
similarly, the limit should reset when a month ends.
how to keep up with time and day parameters?

(Daniel Beckett) #2

If you just want to restrict them from uploading more than 3 images in any 24 hour period then that should be relatively simple by setting an Attribute each time the flow is ran and incrementing it by 1.

You’d set the attribute for the first time:

And then each time the flow is run, increment it by 1:

You want to clear it after 24 hours so you’d add a Wait.

And then set the Counter back to 0

At the start of your flow you can then have a message that tells the user that they’ve reached the file upload limit and to wait 24 hours.

Make sure you set the filter to stop the flow.

Here’s an example flow:

Now, restricting on a per month basis is a bit more tricky. There’s not really logic built into Flow XO to set a wait to be the last day of a month. You could get close by waiting 28 days and resetting another counter value?

(Prakhar Monga) #3

the flow you shared is missing the wait task.
where should i add it?

(Prakhar Monga) #4

I have modified it but its not working properly. could you please check whats wrong?

(Daniel Beckett) #5

I’ve added the wait task into my shared flow. Sorry about that!

For your flow you’re only waiting for 1 minute and then setting the attribute back to empty and then 0 (once the counter reaches 3). The counter is then immediately increased by 1 and the user will get the message at the end of your flow.

You also need to set it so that if the counter value equals 3 then the user gets the message at the start of the flow and that the filter is set to stop the flow. At the end of the flow you then reset the counter attribute.

Here’s your flow shared back:

Hope that helps.

Thanks,
Dan

(Prakhar Monga) #6

Thanks for your kind help.
I will try this and let you know.

(Prakhar Monga) #7

It worked.
thanks a lot again.

(Prakhar Monga) #8

It behaves in a strange manner. See the pics

flx
as you can see in the above pic
“Thanks for uploading the file.you have uploaded 1 products”
and
“Thanks for uploading the file.you have uploaded 2 products”
are coming together one after another without uploading 2nd product.
and
flx2
after uploading the 3rd file it gives the final message
but
started again without sending a file and the “sorry” message appeared.
what’s going on?

(Karen Barker) #9

Hi @Prakhar_Monga,

Have you changed the flow that Dan shared at all? I just tested Dan’s flow and it all worked correctly. If you have changed it can you share your latest version of the flow please?

You don’t have 2 versions of the flow switched on do you as this would cause the effect that you’re seeing above. :slight_smile:

(Prakhar Monga) #10

Hi,
i tried after few hours and it works fine.
may be it was cache problem.
Thanks