I want someone to be able to click a button and be taken to a random chat room with <= 1 other people in it. So, the logic is: press button → check to see if there’ s a chat room with 1 person in it → if not then create new chat room → join chat room.
As soon as they press the button, I add a chat user (the person) to a chat. I only add them though when the chat user count of that chat is <= 1. I don’t think this is right. Could somebody be very specific in what I should do? Should I make changes to a chat only if there’s <= 1 people? If so, how do I essentially make this into an if else statement so that IF there’s no chat with 1 person in it, ELSE (basically THEN) create a new chat.
Also let me know if you could do a 1 on 1. I’ve got a few other questions as well. Thank you!
Hi there, @natkoenig8… I’ve seen your other threads on this topic, and @J805 pointed you in the exact right direction in one of them, so I’m not sure why you abandoned that thread.
That being said, here is what I would do if I were you. I would add a field with a type of number to your Chat data type, and I would use that field to store the number of users in the chat. Why, you ask? Because if you don’t have that field, I believe you are going to have to use an advanced filter to find a random chat with one user in it, and you don’t want to do that because the filtering will happen on the client side and it will likely be pretty slow.
So, I would add that field, and then I would set up a workflow with the following steps…
Hey mike, thank you so much. This was very helpful. I know that I was helped before, but I was still confused and in my experience I don’t get replies back when following up on a thread.
About your solution, where should I be navigating the user to the chat room? In the + change/set another field section?
Not knowing what “navigating the user to the chat room” actually means in your app, the Go to page… workflow action comes to mind. So, there is probably a third step in the workflow that sends the user wherever they need to go in order to participate in the chat.
Hey Mike, yeah the Go to page option sounds right. My problem is do I just send the user data? Also, I only send them to the page if step 1 or step 2 (that you talked about before) are not empty (that way one of them is true).
Well, once they enter that workflow, one of those conditions is always going to be true, so you shouldn’t need the Only when condition you are showing. I think you might need two Go to page… actions. The first one would have the Data to send as the result of step 1 only when the result of step 1 is not empty, and the second one would use the result of step 2 in both of those places.
You only need to put result of step 1 (or result of step 2 in the second Go to page… action) because the result is the chat itself, and the chat “knows” which users are in it.