Using Data Explorer to take action if an admin reads a user private message

I think that what you are looking for would be to have an entry added to the staff action logs (found on your Admin / Logs / Staff Actions page) if the results of a Data Explorer query show a user’s personal message.

If a staff member views a user’s email address through the UI, an entry is added to the staff action logs. If the log personal messages views site setting is enabled and an admin views a PM through the Discourse UI, an entry is added to the staff action logs. If the same data is viewed by running a Data Explorer query, no entry is added to the staff action logs. I’m not sure if there’s a good solution for this, but it’s something I’ve wondered about in the past.