How to create admin to user chat using "Messages"


currently I’m building a CRM portal, where a user will login, send inquries, see their orders from the shop and have communication (chat) with the admin.

The problem I’m facing with is that I don’t know how or even if it’s possible, to achive user to admin and admin to user chat with the help of “Messages” in bubble. So each user will have their own private chatting with the admin.
At the moment, the functionallity of messages is that, users can chat to each other. But this is not the solution that I’m looking for in this case.

The current structure of messages →

On click “Send”, the data in the input is send to a Group chat.

Is there any way that I can achieve this functionallity in bubble? I haven’t found anything that would help my needs besides live chats, but again I’m not looking for live chat either, because usually the chat history is deleted, when the user will close their browser.

Looking forward for a solution.

Best regards!

This is actually easy to achieve in Bubble using an approach of having a message table with the sender and recipients recorded, and using the sender and recipient as constraints to the messages that a User can view. Discussed here Chat between two end-users - #2 by lindsay_knowcode and other places in the forum - it’s a common use case for Bubble. Made easy with Bubble’s auto-updating of the UI when there are changes in the data in the database.

If the messages are private you’d also need to implement privacy rules. Plenty of good reference material about privacy rules mentioned in the forum also.

Good luck!

Yes, I have a similar thing where team members can send messages to each other, this isn’t a real time chat, but I think would work the same. I added a 'Notification Data type with fields for message body and recipient. You can allow/disallow admin using conditionals. If a user has a new message you would Show the message Body.

Screenshot 2022-08-09 140456

Hi there, so the chat functionallity is the same as you’ve send me the link for whatsapp.

So I’ve set the sender and reciver mail. →

The problem I’m facing right now is that I don’t know how to, set, that the current user will only see the messages that he created. I’ve tried with the following conditon (but it’s not working) →

Do you have any suggestions?

Hmm, I don’t think I quite understand your way.
Idea is that, If a user has a message it will display only to him right?

Could you explain a little bit more?

Yes, the message only displays to the chosen user.

You see the ‘Choices sources’ below, well if you click on the ‘Search for’ you will be able to add constraints, I am searching for Users who’s Team-Member = “Yes” so the drop down shows all User in the same Team. You will have a different set up but basically you need to have access to all the Users who a message can be sent to.

Then, after choosing the user from the drop down, I enter a message Body and click send. The send button workflow creates a new ‘Notification’. Now, if I am a logged in user and there is a message for me it will show like this;

Screenshot 2022-08-09 154228

Make sense?

So If I understand you, this works only ADMIN to USER, so a admin would send a message to a user, but before he sends it he has to choose which user is the reciever from dropdown, right?
So user cannot message back?

But the way I want to have it, is that the user will be the first one to message the admin. And then they have a private messaging. We want to make it as simple as possible for our client to answer their customers/partners.

Current messaing - admin view :

Current user view:

No, anyone can message anyone. Admin and User can be treated the same. If you have a list of ALL Users (including admin) then you can call upon that list from a dropdown, your dropdown may look like this;

Peter (admin)

Now if I am logged in as Shelly, I can choose to message anyone on the list. If I select Peter then Peter will get that message.

Here’s a video explaining how mine works Loom | Free Screen & Video Recording Software

Also, I haven’t watched this but just found a video which may help How to add Messaging function in bubble app - YouTube

Hi, first of all thanks a lot, that you’ve taken the time and record it. But unfortunately, I canno’t help with your way, because, there is no way, that a user will chose admin from dropdown and send it, it has to be automatically.

The youtube video you’ve sent, he is just showing ui, he is not showing the technical aspect of it.
I’ve spent now 10hours + on this chat, but still can’t seem to find any solution to it.
I’m really confused at this. Can’t seem to find any solution. If you could dive a little bit more into my case, I would be really grateful.

Maybe I should create admin and user view? So when a admin would send a message the reciever would be, creator of the message. And when the user would send the reciever would be admin?

How are you defining an Admin? For example, I have a database field called ‘admin’ and when a user first creates an account I mark them as ‘Yes’ in the DB field. When they invite a team member I mark them as ‘No’ in the DB field.

How do you decide who is an admin?

I have user role (Admin/ user), and I have to choose it manually from the dropdown like this->

So a user comes to a messaging subpage, in the input field for text, he writes the wanted message, and click send, the message is sent to the admin of the website. When admin replies, the creator of that message, gets the reply. And admin should have, list of all users that have written any message.

When a user clicks send, can you add a condition to the workflow which says to send the message Only When the recipients User_role is Admin. That way the message will only go to the admin.

Thanks a lot Darren, actually I’ve managed to make it work.

I really do appreciate your time and help!

Best regards!

Ah great!

This topic was automatically closed after 70 days. New replies are no longer allowed.