The problem is in my workflow show above, I equated my conversations to a Do a search for :first item. So it ends up searching for only one conversation because my data field is not a list. Should I just change the conversation field to a list of conversations or is there a better fix to this? Or maybe the problem is elsewhere. Please let me know.
The user would then click the âSend Inquiryâ button under the multiline input and that triggers the workflow to create a message. I have another workflow for the Send Inquiry button having the opposite of this Only when function that replaces contains with âdoesnât containâ, to create a conversation for users who donât have one with each other yet.
I believe the problem lies in searching for the participantsâ conversation with the current user. I was able to create a message and add all the needed participants, but it does not show up in their conversation.
Under my create a message workflow, Conversation = search for conversations: first item. I need it to search for each conversation the current user has with the selected items
Hide this rg in a hidden popup and you can use the list of users it generates in further logic or actions like sending them a common message. Rename it to something like listOfPartcipantsToMessage.
yes, make it so that the two participants will only ever have One single conversation. You achieve this when creating a conversation to do so conditionally based on a search of existing conversations where the two participants are already the two participants, if yes, then do not create a new conversation, just add the message to the existing conversation, if no, then create a new conversation.
Also, it is not necessary to have the participants on the message as well as the conversation. Better to just be on the conversation.
I would not recommend having a hidden RG because that will just be loading data unnecessarily. Instead just put the do a search for conversations onto a conditional portion of a workflow trigger.
is it possible to make the condition so that it would look for all conversations that the current user shares with the selected users and then send a message to all of those users?
then do not create a new conversation, just add the message to the existing conversation, if no, then create a new conversation.
Also, it is not necessary to have the participants on the message as well as the conversation. Better to just be on the conversation.
This would make a lot of sense but unfortunately Bubble isnât that performant when it comes to long lists. Also a list can only have a maximum of 10K items. In theory, a conversation could have thousands of messages. Plus, having the participants on the message data type as well adds an extra layer of security.
So you actually want to keep the DB structure that you currently have @kindlevega12
Nobody said anything about searching messages, it is to search conversations. Nobody said anything about making a data type of conversation have a list of messages as a field. No need to have the extra data on the message as it really doesnât make any difference to security if you set everything else up properly.
Correct structure
Data type of conversation has field for participants which is a list of users
Data type of message has a field which is related to conversation, a field for body, and if you want include the IsReadâŚso yes, his data structure is correct, except for the part where the Particpants field is unnecessary on the message data type.
Many ways to change how things work. The suggestion on running a dynamic search is about getting those users through the current dB structure. Another way to avoid running this on page load is to display it via an action.
Still though âŚ. Kudos on changing how things are done âŚ. It may be the correct way to go in this case
Nobody said anything about searching messages, it is to search conversations. Nobody said anything about making a data type of conversation have a list of messages as a field.
Iâm genuinely curious now. You mentioned to âadd the message to the existing conversationâ. How would you set this logic up if not done with a list data field? Also, if you wonât be searching messages and you wonât be structuring these messages as a list on the conversation data type. How will you retrieve them from the db?
Regarding security, how would you structure the privacy rules of a message if you wonât be protecting them with this message participants contains current user?
You would be adding to the message data entry the conversation as a related field. This is for the purposes of being able to select a conversation and then display all messages that are part of that conversation.
When the search is done for conversations to see if both users are on a participant list together, that is just for the purposes of fixing the main issue as I saw it, which was that the two participants as the poster has set it up, are having multiple conversations and so the display of messages is a mess.
Because of that statement, it is clear the setup as is is generating more than one conversation, which is the main issue as far as I see it.
Additionally, the issue lies at the creation of a new message which is happening via a button click, so to search for existing conversations at the click of the button, you can either allow the user to be navigated to the messaging system where they would be immediately shown the conversation and can send a new message. Alternatively, if no previous conversation existed between the two users, a popup can be shown to send the first message, which when sent will also create a conversation.
Iâd put privacy rules onto the Conversations so their conversations do not show up unless the user is part of the conversation which in turn handles the issue of messages privacy. Additionally on the Inbox page where the full list of conversations is displayed, Iâd do a search for conversations and participant list field contains current user.
Iâm not sure if Bubble made a change to this or not. I feel like I recall they made it so that hidden elements data are not fetched until made visible, but I get confused on what was old and what is new behaviors.
But one other way to do it is to have a conditional on an element that when page is loaded entire is yes to add the data source there instead of having the datasource on the main section.
I have only when functions on 2 âbutton is clickedâ workflows. One that creates a conversation if the current user does not have one with the participant, and the other that goes straight to a message if the current user already has a conversation with the participant.
My problem still lies on how to message multiple participants by clicking one button
How many participants are in a conversation? Are you only ever having two participants, or is it dynamic because a team of people from a supplier may be involved in the conversation?
Basically, when you create a message in the database and have it assigned to a conversation properly via a data field of Conversation, any user that is part of that conversation as a participant would be, if everything else for displaying data is done properly, be able to see the message. You DO NOT need to create a separate message for each user that is a participant of a conversation, which means, you simply just need to create the single message and have the correct conversation added to the data field of conversation.
Click button and create message and assign the data field of conversation to the appropriate conversation.