Having a query table automatically update and reflect new values in the database

Hi, so we’re going to be using AppSmith to act as one side of a chatbot.

Our clients will be using a native app. They’ll be able to access a chat feature where they can speak to an employee. Any messages they get sent will be saved to a certain database table.

On the other side of the chat is our employee that will be using Appsmith to read and write back data from their end. The thing is though, we need a way for the table to be updated in real-time, so that any new messages from our clients will be showing on appsmith automatically too (as opposed to requiring our employees to do a manual refresh of the table).

Is there any way to achieve a similar need to this? If there isn’t, what would be the best workaround?

Hi @blueberrypudding85 ,

There’s no way for the database update from another source to trigger Appsmith to refresh the table, but there’s a webhook feature in development that should help:

Also, the latest release includes setInterval()/clearInterval() functions that could be used as a workaround to periodically refresh the table. It wouldn’t actually be triggered by a database update, but you could refresh every 30 seconds or so to check for new replies.

Just a quick one, where do I use setInterval()? I did a search but this was one of the only posts that mentions it.

I can’t find where I should use it (e.g. query or table?), I though I could use it in the page settings but there is no feature to add code there.

Just wondering if anyone has any specifics as there is no documentation for it - I assume because this is a very new feature.

I can see it’s JS, but I don’t ‘know’ JS (like recognising a foreign language but not being able to translate it).

Thank you

I’m on AppSmith cloud if that makes any difference.

I found an example here: feat: setInterval and clearInterval support by hetunandu · Pull Request #8158 · appsmithorg/appsmith · GitHub

But it doesn’t help, it just says:

setInterval is not a function