React to realtime database changes

Hey friends!

I’m in the middle of building a chat app, but I’m seriously starting to pull my hair out over a problem with Supabase realtime database changes. I’m pretty new to all this…

  1. I’ve got a button (“Start chat”) that kicks off a subscription to “room1”.

  1. Then there’s the actual chat button (“Send message”), which runs a workflow that does an INSERT with the message.

  1. I also set up an app workflow that’s supposed to trigger on realtime database changes – it logs the activity and runs a SELECT to fetch the latest chat data.

Now here’s the weird part: Supabase shows that I’m successfully connected to “room1” (I can see my INSERTs being logged):

CHAT ROOM LOG

{
  "schema": "public",
  "table": "messages",
  "commit_timestamp": "2025-06-16T20:05:29.380Z",
  "eventType": "INSERT",
  "new": {
    "chat_id": "8f1c5fb1-920f-4307-b84f-044cfab4c4a1",
    "created_at": "2025-06-16T20:05:29.375825+00:00",
    "id": "ee1ce7d4-cf61-4337-842f-abc38e26993b",
    "is_from_user": true,
    "message": "TEST MESSAGE",
    "user_id": "3mlkl-k3js-9384-8f13-4d164751a8d1"
  },
  "old": {},
  "errors": null,
  "latency": -238136065.19995117
}

BUT for some mysterious reason, my app workflow never triggers.

So I’ve got two questions:

  1. Are there any obvious mistakes that you can spot?
  2. Do I need to call a SELECT statement in the App workflow to load new information into the chat window? It feels like it would be expensive with so many calls to Supabase.

Feels like I’ve read the documentation 1000 times but I still can’t figure out what I’m doing wrong.

(Yes - I have enabled RLS and Realtime)

Any tips or working examples would be super appreciated!

Hi visdomstanten :waving_hand:

I understand your frustation.

I’m not very experienced with realtime so I’ll ask the team on their input.

Hello @visdomstanten,
I’ll show you the way I use it today.
Try changing the name of the channel “room1” to the name of your table “messages”.
Since you are listening to the event “database changes” you need to enter the name of the channel to subscribe and listen to the same one from the table.
If you need to open a custom channel, just select the broadcast type.
Exemples:
subscribe

listening

I made the change to replicate your scenario and it worked that way too.

2 Likes