So I have a message system in my app but I need that the user can receive a notification on the home page if they have a new message , how could I do that ?
Did you setup a Type called messaging in the database?
On your āmessageā data type, you will need a āread?ā yes.no indicator.
Then you can sum up the āunreadā messages for the user, and create a notification or put the count on the badge.
When the user reads their messages you can update the indicator to āyā.
Thanks but can you be more detailed in how to do this ?
Hi,
Create a data type called āNotificationā then set the following fields:
āRecipientā of type āUserā
āReadā of type āYes/noā
āMessageā of type āTextā
Then when you create a message youāll also create a notification to the recipient user by creating a new āNotificationā, setting the āRecipientā to the user receiving this message, and then āReadā to No and Message to the notification message.
Then in a popup or on a notification page youāll want a repeating group that does a search for notifications with a constraint where the recipient = current user
Job done
Correct. But personally I would choose to do it the way Nigel explained because youāre probably never going run useful queries on a Notification Type. So, adding a Boolean True or False on the existing type āMessageā is simpler and wonāt clog your database if your application gets very popular.
*I always think long term when I create an application because databases could easily add hours of work if not weeks to your project if not set up properly.
Thank you guys so much ! But im using Pastel messaging template and nothing I want to do seems to work with its structure so I will have to create my own messaging system, before proceeding!
Yes, Pastel is more optimised for āreal timeā style messages.
What I have done in the past is add a āreadā field to message. And then use this, and the Conversation table, to do notifications.
And then set the āread flagā across the messages in the conversations.
As a note, this will not work very well if you have multiple recipients for a message (so Whatsapp group style). I would really start again with a new structure if you can.
Thank you ! But my motivation is currently very low because all my issues are messenger system later so I will take care of this later
Hello @NigelG,
I am currently working on a couple of apps so have been looking around learning different things within bubble.
I too have an app that would require some form of notification system, which led me to this post. I understand the workflow section of this but what is the first section āButtons searching for messagesā about and how are you using it? Does a user click it, is it hidden and runs in the background etc? Or it just showing the number of messages unread?
I just got the pastel template to look at so I could follow this, but there isnāt any button in the template. I would like to try and get this to work so I can use a form of the template as a ālive messagingā system.
Sorry for the lack of understanding, or if Iām asking too much but as I said Iām learning the ropes.
Edit
Donāt worry about answering that now, Iāve worked it out but as you said pastel isnāt the best for doing it with. But now I know I shall begin designing something of my own .
Thanks,
Mike
I put together something where my database has a datatype of messages. There is a datafield of UnReadMessages which is a list of users; I believe I saw this on one or two other templates of messenger apps.
Either way the UnReadMessages will have users added or removed based on workflows indicating their presence in the current chat. The chat is actually a conversation datatype which has a list of messages as a datafield. On the page it is a RG set to messages as type and datasource is current pageās conversation as the user needs to navigate to the chat page from the page that has their list of conversations. The conversation they click on has itās data sent to the chat page.
To display the number of unread messages a user has when they log in to see their list of conversations and the number of messages from that conversation they are marked as unread on I set a text element to have an appearance of the following:
Current Cellās Conversationsās Message List filtered:count
The filter is set to UnReadMessages contains current user
This way you donāt need to do a search for messages or anything that would possible slow down the app.
Such a simple solution, thanks! I wouldnt have thought of this, i was on my way to create notifications for every new message, thanks for helping me avoid this
If you want a real notification system that allows the user to navigate to the conversation and the new message you should set up your workflows for when the notification is clicked to navigate to your messenger page and send URL parameters to indicate which conversation to open so they can be brought directly to the new message.
How do you do this if you want the notification to appear on a different page than the messaging page? Because in that situation you canāt do a search for messages
Please do you have any video tutorial on how to do this?
I do not.
You may find a free messaging template that maybe has it put together. Or search youtube for a video. Iād search using a term like ābubble.io notificationsā
Exactly my problem now!
Did anyone find out how to set up a notification say from your home page to highlight you have an unread message? Iām
Wanting to change the colour of my āmessagesā tab on all other pages when current user gets a new message that is unread but struggling to configure this as other pages donāt have the message data type
Iām in the same position as you. Iāve managed to get it to change colour, but not to stay that new colour when I change to another page.
Any luck?
No sorry iv had no luck but have put it to one side in the hope someone came back on here or I could work it out after a break