I am successfully running this query to tell me how many mins have elapsed since the last user activity.
SELECT
users.email,
MAX(users."lastActive") AS last_time_active_timestamp_utc,
EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - MAX(users."lastActive"))) / 60 AS minutes_elapsed
FROM users
WHERE users."lastActive" IS NOT NULL
GROUP BY users.email
ORDER BY MAX(users."lastActive") DESC
Now, I want to take all the users who had >15mins of inactivity and (a) log them off if their screen is open (b) log them off if they try to do something else at Retool.