Hello, I need help creating a private chat for the advertising website I’m building. The chat should be sent from the ad.
What do you mean by “the chat should be sent from the ad”? Does clicking an ad start a chat?
yes, like on a car listing website
I can share a bit of how I do this in my application.
I have users who can create proposals to each other. Once the proposal is created, I have a messages tab where they can have a DM conversation specific to the proposal.
You’ll want to watch this video as a precursor.
What I do for this case is host different columns for the IDs of the various entities messages might be associated with, directly in the messages table. When a message is sent from the entity it is associated with (proposal), I store a screen value for the proposal ID in the message table. In the UI, I leverage row owners instead of filters for the sender/receiver, and then filter the conversation view to only include that proposal ID matching the screen proposal ID, thus showing a private conversation on the same screen as my proposal.
I have other entities than proposals where conversations can be associated, for this I store them in additional columns and do the same thing for those other associated entities. For DMs between users, I use the “unique identifier” special value, and then make sure in all messages interface to include that value in the messages save fields on the right-side component configuration. This ensures the conversation value is always passed between subsequent replies.