Heya nefer, With your current setup, since your queue's updates relies on an API call, you said that the only way a user can get removed from the array is to restart or complete the flow.
However, if they restart the flow (eg. refresh the page, if that's what you meant), does it really remove them from the queue? That would mean you're making an API call at the start of the flow to check if the user is already in the queue?
I'm trying to understand what happens when currently and what should happen when (expectation/desired result)
You're right. Refreshing the page doesn't remove the user from the array (queue).
However, when the user goes back to their email and clicks on the link with the two keys I provided them, they start the chatbot flow, then I immediately clean out their keys (ids) from all arrays they are included in. This helps me manage the queue and keep it in the order of First In, First Out.
For context, I'm emailing the user a link with two url parameters like this:
domain.com/page?id_a="111"&id_b="222"
id_a and id_b are the keys to start the chatbot flow. If a user refreshes the page, the keys will not be included and the user will get a message to go back to their email and click the link to start the chatbot.