Setting up a corporate messenger

Hi all.
I would like to get support on how to properly design the logic and operation of the corporate messenger.
At the moment there is a problem in personal correspondence message history is not displayed.
Messages are only displayed in channels and are not sorted. Whether messages belong to a channel or not.
How to make messages to be displayed in personal correspondence.
How to make it so that messages are set to be sorted. Which ones are attributed to a channel and which ones are personal.
The entities Send and Recipient were created in the database, but the output for them doesn’t work.