Need advice for a Chat App to be built upon firebase

Hi all, I am trying to make an app which allows users to start a chat with each other. I’m planning to use the chatroom method of doing this, but no option to end/close the chatroom. So if I am userA, and let’s say I chose to start a chat with userB, a room entry would be created in the firebase realtime database, and for both the users in their apps, the room id would be visible. Clicking upon the room id should fetch all the messages in it, and show them in a DVL with custom layout. I took inspiration from @muneer 's chatroom firebase structure here - Making better chat apps with the "Any Component" blocks - #80 by muneer

Chat-DB
    chat-Room
         Room-Code
         Message-List
             Date-Stamp (as message ID)
                 Sender
                 Message-Text

The issue I am facing is I’ve never worked with Firebase in Thunkable X, so I don’t know how it works. How do I get started on this? Here’s the workflow I am imagining the users are going to have -

  1. They choose who they want to chat with.
  2. A room is created with a unique ID (in my primary google sheets DB, i’ll keep track of all the rooms a user has) and it is added to both user’s chatroom ids.
  3. the app has a menu of “My Chats”, which displays all the chatroom IDs the user has linked to their record.
  4. if I click on an ID, i get all the messages in that room displayed on the DVL, and i can append messages to it at the end.

A pretty basic chatroom experience, except i’m totally confused on how I should do it, as I’ve never used Firebase… Can someone maybe guide me through few steps, like creating a room entry, fetching details and adding listener to room id when user picks to open it? Thanks!!

Welcome to the world of noSQL!

What do you have so far, I’d start with storing reference to user profiles when a user logs in,

Store rooms on the user object on FB

Private Convos on the user object FB

1 Like

Hi @jared! I’m excited to try out Firebase :smiley:

I’ve managed to generate a unique room ID, and store it in both involved user’s google sheet row (my primary db is google sheets, planning to use firebase for only chat stuff). I’ve also managed to add a bucket for when the user clicks “Start Chat”, with the first message in the messages list being a start message…

Blocks used to create above bucket -


I’m just now confused on how i would append new messages to the message list, as I would only have the room id with me. Also, is there any better way than the bucket structure i’ve built to store chatroom data? My idea was to store the room id as the bucket name, then “from”, “to”, and the “messages” being a list, which i’ll retreive from the room id I have, format it and display it in a DVL.

Also, it would be possible to retrieve the “messages” list right, and then i can just parse it using List blocks? Let me know if I need to clarify… Thanks! :slight_smile:

@tatiang IIRC i think I read one of your posts somewhere earlier on lists/objects in firebase? But can’t seem to find/remember it…

Can you shed some light on retrieving a list like the one I have ‘Messages’? Or is there a better way to store Message’s body, sender name & time under a room bucket, which is easier to retrieve and display in DVLs? Thanks.

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