Notification System?

Does anyone have an example for handling user notifications since last login? Ex. Customer had some type of activity. Show Notification Icon in navigation, click on icon, show all new activity in list view.

Hey @nroeder!

Is this for a Cloud instance or a Self-hosted one? In the latter case, you can try querying the audit_trail_events table of your storage database to get information about specific actions the current user has taken. For instance, the following query gets the last two times they viewed the current page:

select
  *
from
  audit_trail_events
where
  "actionType" = 'PAGE_VIEW'
  and "pageName" = {{retoolContext.appName.match(/[^\/]*$/)[0]}}
  and "userId" = {{current_user.id}}
order by
  "createdAt" desc
limit
  2

From there you can reference query.data.created_at[1] to get the timestamp of the last time they loaded the page and use that in subsequent queries. There are other actions you can reference as well, like QUERY_RUN if you'd like to use that to define 'user activity'.

This isn't as programmatically available on Cloud, however. In that case, you might explore saving activity in a separate external database you can reference (or check out Retool Database if you're interested!)