Forum Academy Marketplace Showcase Pricing Features

Adding messages to conversation thread

I have created a messaging system that allows users to message each other.

Database is structured as:
Type: Conversations
Fields: Messages - list of Messages
Participants - List of users
Recipient - User

Type: Messages
Fields: Conversation - Conversation
Message body - text
Recipient - User
Sender - User

I’d like to be able to keep all messages between 2 distinct users in one conversation, even if they send a message from a different place in the app.

So, User A messages User B, creates a Conversation. Then at a later point, User A messages User B again, and that message gets added to the same list of messages in the same conversation, rather than creating a new Conversation.

Can someone help me with what I need to add to the workflow to accomplish this? Thanks!

With each Message, you’d be looking to create a new Message, and then add the created Message to the List of Messages associated with the appropriate Conversation.

1 Like

I’ve got that part down - but is there a way to make sure that if User A messages User B (or vice versa), that there will never be a second Conversation started for them?

For some more context: we are a marketplace app, so clients will message vendors from the vendor’s storefront, which triggers a workflow to create a conversation that the users can later follow up with in their dashboard. What happens if the client goes back to the vendor storefront and initiates a new conversation; Is there a way to make the workflow recognize that there is already a conversation between User A and User B and add the convo to that same Conversation rather than creating a new one?

Thank you for your help!

Absolutely! Try adding a condition on the workflow that runs a search for existing conversations between the two users and adds messages to the existing convo rather than creating a new one if one already exists, and creates a new one if one does not. :slight_smile:

1 Like

I think that worked! Thank you soooo much!

1 Like