Forum Documentation Showcase Pricing Learn more

Messaging Between Users

Does Bubble have any near future plans to roll out messaging and/or chat? It seems that user to user messaging is essential for a large number of apps, so most would find the feature useful. Creating this from scratch, similar to the NotRealTwitter app is extremely painful at best. It’s also challenging since messages must be read in descending order and most of the functionality of a modern messaging platform simply isn’t possible to create with Bubble.

Is there not a plugin, or some other relatively simple way to integrate messaging?

There was a discussion on this here. For now, we’ll have to create our own implementation. I’m actually working on this portion of my app and it doesn’t seem too complicated. At the very least, you have full control of how data is stored and displayed without the use of a plugin.

2 Likes

Thanks for the reply @Scott. Not ideal, but okay.

I’ve recreated a simple messaging page on the forum app: https://bubble.io/site/forum_app/version-test/imessage?debug_mode=true

I am trying to recreate something like Polymail: https://polymail.io

I have created two new things:

Message
Recipient: User
Sender: Current User
Text: text

Conversation
Messages: List of Messages
Participants: List of Users

Repeating group of conversations on the left. List of messages on the right.

I have placed a box over the repeating group of conversations. Once clicked I would like the current list of messages to be displayed on the right.

This also creates a weird problem… I’m not sure what dynamic entry should be in the recipient field when the send button is pressed.

As of current there are other various issues. Anybody mind taking a look?

Thanks in advance.

2 Likes

Since you have access to the conversation object, you can just store the conversation on the message and ignore the recipient entirely.

1 Like

Great. I’ve made a little progress.

In the Popup’s send button workflow I am “making a change to a conversation” and creating a new one if it doesn’t exist. However, it seems to always create a new conversation. How can I make the new message post to an existing conversation?

(FYI “demo” can be typed in the “To:” field)

3 Likes

From glancing at the data model, User contains a single Conversation object. Do you intend that a user object can only reference a single conversation vs. a one-to-many relationship?

No, good point. So I changed it to list of conversations. What should be the workflow when the user hits the popup’s send button?

Right now its make change to Group Conversation’s Conversation. But that can’t be right. It simply modifies the most recent conversation. How do I get it to modify or create a new conversation based on the list of participants?

Thanks for your help on this.

The first step is to decide how you want to identify a conversation. Facebook messenger does it based on the list of participants - regardless of who creates it, participants can add/remove themselves or others. You can give a conversation a title which makes it unique and allows you to start a new one with the same participants, but a new name (topic). That’s up to you to decide based on what you are trying to achieve - I find it a nice model for chat. Email has a very different model (less intelligent and interactive) so if you want that, a slightly different approach is needed.

You first want to find the right conversation. Two ways: either the user clicks on it (perhaps after searching for a word or recipient or simply scrolling through a list of Conversations) or they create a new one. When they create a conversation, you can search for any conversations with the same recipient list - if it exists, add the new message to it. Otherwise create a new one.

To directly answer your last question: either search for the conversation by recipients or, when the user clicks on it, make sure to add to it. Let us know how it goes!

3 Likes

@georgeciobanu Thanks for the reply. I am trying to a chat similar to the iPhone’s iMessage (one chat between two given users).

If a chat between two users doesn’t exist, then create it. If it does, then populate the message to that chat.

I am having an issue searching for a conversation with the same recipient list. I attempt to create a “make change to thing (create if doesn’t exist)” workflow and search for a conversation where the participants equal the current user and “To:” field’s recipient. The search is always red/ invalid. Why?

Mind taking a look? https://bubble.io/page?type=page&name=imessage&id=forum_app&tab=tabs-2

I know you guys have probably used Bubble to make various chats before. I think a few templates for commonly used features, such as this one, would be extremely useful.

Thanks in advance.

1 Like

When searching for conversations based on a criteria, the result could be zero, one or many Conversations.
For example, if you were to search for a Conversation with John as the recipient.
So you need to tell the system which Conversation to pick, when the search is done - in your case you expect either zero or one, so you’d pick :first item. Note that if you pick :random item or :last item, the result is the same, since you only ever expect one (or none to return). If the search returns one, that’s it. If it returns nothing, the checkbox ensures it is created.

To be super-correct, you can add a condition on the workflow, saying that this should only happen when the result of the search is less or equal than 1 like so