Forum Academy Marketplace Showcase Pricing Features

How to create a private direct message system between users

Hello, I need a little guidance on how to build private messages for Bubble. Please show screenshots if you can. I’ve already used the forum search function and didn’t find anything. I searched bubble through Google and didn’t find anything either.

I figure that it’s a ubiquitous feature so it should be easy to build.

Sorry I don’t have any screenshots at the moment. But I’ll give it a go explaining with words.

First you’ll need a data type, something like “messages”:

Data Type — Message
Fields —
Message Body = text
Message sender = user
Message recipient = user
Sent Date = date (or just use the created date)

Now within the data type “user,” make sure you have a field Message which is a list of messages (from the DB).

When a user send a message, create a new Message populating the fields listed above. Then make changes to the users (sender and recipient) — add message to user.

In terms of notifying the recipient about the new message, perhaps an email, push notification, and/or text message will do the trick. The last two requiring you to connect the API yourself.

In terms of designing your message box on the users page. I’ve used pop ups and floating groups in the past. Using a repeating group at the top to display the messages, I’d create two groups within the cell—one for sent messages, and one for received messages. You can add a condition to show one of the groups based off “current cells sender” — so if current cells sender is current user, show the group that displays sent messages, and vice versa.

Lastly, a simple multi line input should do the trick for the user to type the message body.

Hope this helps. Sorry for the ramble, and good luck!


Great stuff.

As a suggestion … a list of messages in the user data-type can load up pretty fast and slow down the app’s performance.

An alternative data structure could be to avoid having messages under a list in no data type. A … reverse relationship where each message has a field to … a thread perhaps could work much better. The thread has a list of users in it … and each message with a list of viewed users belongs to a thread. This could be more scalable. :+1:


Good suggestion!
Would you have an idea of how this would look as a data type? Right now I have

Data Type — Thread
list of messages: List of Messages
list of users: List of Users
Created Date: date

Data Type — Message
Fields —
Message Body: text
Message sender: user
Message recipient: user
Sent Date: date (or just use the created date)

I am having trouble defining the workflows. If you would have any screenshots on how you would define the workflow it would be very helpful

@joelondesign did this data structure work for you? Any luck with the workflows? I’m dealing with a similar issue.

Hey guys,

maybe one of my templates could be helpful for you.

Many greetings.


1 Like

Hey @adamlamb,

I have gotten it working yes. This is the data structure I used.

I then used this template Pastel Messaging Template | Bubble
and changed the data type names, and followed the errors in the editor, keeping on with original template’s workflows open in one tab and one with my app’s messenger in the other tab while working through the errors.