Forum Academy Marketplace Showcase Pricing Features

Messaging System Question

Hey can anyone help me out with how a messaging system works?

Airdev released a public version of a messenger, which is quite good.

Airdev Messenger

there are alot of things missing in that editor @csblack

Okay, so what questions do you have?

in the repeating group when you select the user how does the app save that data so that that particular user is messaged? like what might be the work flow after a cell is clicked

also how is it set up so that when you click on the repeating group the whole cell turns grey?

@csblack @potentialthings @NigelG @vlad

The cell will have a condition, so that if its contents are the selected user, then it will turn grey. You probably do this by having a custom state.

Here is another example of a messaging app.

https://buildingonbubble.com/block/message-app-1473140414981x593174850883289100

2 Likes

Hi @Adam2016,

You want to use a custom state for both the user selection and cell color change. The workflow would look something like:

“when user name [text in cell] is clicked > set state”

When you set a state you choose an element to “hold” or “store” the state. It can be any element on the page, really, but make it something logical to stay organized, like the repeating group of users.

Then the state type will be users since we’re wanting to make a selection of users for the next action (starting a message thread with them). And this state is a list type so it will expect more than one user. I’m assuming that’s the functionality you want here; otherwise, a single user type would be used to do this for 1 user at a time.

Then set the value of the custom state as “element’s custom state :plus item additional user”, which means you’re adding a new user to the existing list of selected users every time you click on a new one. If you’re clicking on the first user for the list, this expression will still apply since 0 + 1 = 1.

Now, users will be added to this custom state list, which you could then use in a workflow. So if the “start new thread” button is supposed to create a new thread Thing in your database, I’d assume that that Thing has a field to store the users (type user, list) involved. When you create, that user field = repeating group’s custom state.

The cell color is a condition off of this state. Add a shape to your cell that by default is transparent or just not visible. Then add a condition to the shape: when repeating group’s custom state contains current cell’s user > shape is visible or shape’s color changes.

I actually wrote a newsletter all about custom states and provided a very, very similar example (select multiple users from a repeating group to delete) which can be applied here and in many other cases (like messaging inboxes). I also did a style condition as well, where the color of the name changed when selected. My newsletters are free, and you have access to the archive once you sign up (link below). I hope this helped!


Gaby | Coaching Bubble

1 Like

thanks! and I’ll be sure to subscribe to the newsletters. Also, how does the other user even receive the message after the sender sends the message in the repeating group?

@romanmg
hey so this is my repeating group to actually click the user


this screenshot shows the custom state you told me about, is this correct?

also, in this screenshot I’m working on the workflow to start the thread. but I cant do the “user field = repeating groups custom state” its telling all these other options, do you know whats the issue?

@romanmg

Hey @Adam2016,

Thanks for sharing the screenshots. Your custom state value should be “repeatinggroup user 1’s cellsclicked :plus current cell’s user”

And then when you’re saving to the database: “user field add list repeating group user 1’s clicked”

Apologies, I know you were expecting an = there. With lists, you get different options to manage values, so “add list” will add every user in that custom state list.

does this workflow still work even if the user chooses just one person to message? @romanmg

It does! Just means that there’s 1 person in the list.

ok thank you! everything is working out so far. I’ve also been trying to figure out the workflow for sending a message to a user when the button send is pressed. I have two screenshots to show my work so far. any advice on this task? Thank you so much @romanmg


Hey @Adam2016,

So, it depends on your data structure, but it looks like each user has a “Messages” field that is a list, which is good. I’m also seeing from the screenshot that you have a Thread data type, which I hope contains a field for messages as well. You’d add a message to each thread and then for each user, display appropriate threads.

If you share a link to your editor, I can take a look at your structure and help a little better.

@romanmg

Hey @Adam2016,

First, when you’re adding a message to a user, make sure to add it to the recipient. In your screenshot, you have it adding to the current user’s list of messages (that is, the user that is logged in). You’ll want to “make a change to a list of things” > thing = user > user source = your custom state for selected users > messages add new message.

Second, you’ll need to create a display so that each user can view these messages. Your index page has a lot going on in a single place, so it’s difficult for me to specifically where you’d do this without knowing your app too well. But, essentially you’ll have a repeating group for the current user that is a type message and the source = current user’s messages. This will display all messages you’ve added to the user.

Now, if this is a thread situation where you have multiple users communicating with each other, then your repeating group might be a type thread and the source a specific thread’s messages. Where there are constraints on the thread > list of users contain current user, for example.

I hope this helps you get in the right direction. There are so many ways to achieve a messaging system. Essentially, you have to assign the users to the right thread/message and then display accordingly. Assignments and creation of messages/threads would happen off the send button click in your case.

hey is this the correct workflow for the list of things? thanks again. it still isnt working but we making progress so thank you lol


the second screenshot is another component of the send workflow. is this needed?
here’s my repeatinggroup messageis this correct too? thanks so much