How to create automatic group chats


We’re making an event based meetup type of application where users can chat amongst themselves before attending the event. When a user selects an event, we are looking to have the user automatically added to a group chat. For example, any user that wants to attend “Event A” will automatically be added to a group chat for “Event A” once they press the “Attend” button.

Right now the problem we are facing is that when the user selects the attend button it creates a separate group chat each time, rather than adding the user to an already existing group chat for the event. We’ve seen tutorials on how to create group chats, but those mainly consist of the users manually selecting who they want to chat with. Any help would be greatly appreciated!

Here’s a link to what we have so far.


An easy solution is don’t have these group chats as a separate collection. Just have the messages have a relationship with the event.

So when you have the chat page you have a list of current event > messages.

1 Like

Thanks for the response.

I have a few questions though. What should the relationship be between events and messages: many to many, or one to many (Event to Messages)? And how do we go about this without creating a new message room each time someone clicks the “Attend” button? Would it be possible for you to provide an example?

I’d also like to know if it’s possible to limit the size of the group chat and split it up possibly if there are more than 10 people attending the event?

There is just one message room which = the event itself. No rooms. Just the event has messages. Same relationship like any group chat. I think an event can have many messages, a message has one event.

That’s going to be available to anyone who is in the group. If you want to split it up you might have to think about having a separate group chat collection like you were thinking already.

1 Like

Following up with the split, would these relationships be plausible for it:

  • a group can have one event, but an event can have many groups
  • a user can have many groups, and a group can have many users
  • a group can have many messages, but a message has one group

Splitting it would be ideal for us.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.