Question

Is it possible to recieve an email when a user has not logged in for 3 months?


Badge

I want to be able to manage user acounts, particularly those that have not been used in a significant period of time. Is there a way to do this automatically with FME Server?


3 replies

Badge +2

Hi @clairestoddart​ ,

I don't believe there are any built-in features that would help with this; however, you could definitely accomplish this with a basic Automation that's triggered by a schedule, has 2 workspaces, and an Email External Action. Create a workspace to GET system events (SYSTEMEVENT_LOGIN_SUCCESS) using the REST API and write those to a table (getting started with JSON is a great resource if you are new to working with JSON data in FME as well). 

GET /systemevents/events/completed?name=SYSTEMEVENT_LOGIN_SUCCESS

Then Fragment the response with a JSONFragmenter: json["items"][*] and expose the relevant attributes (likely dateFinished, header.time, header.user, and id).

Then in a second workspace, use a DateTimeCalculator to compare how long since the last activity from the current date with a Tester. Then send the features that are older than 3 months to an FME Server Automations writer so you can connect the automation writer feature type to the Email External Action when you build the automation. 

 

One thing to be mindful of is the System Events History Cleanup Task so you don't miss any activity but if you schedule this to run daily that shouldn't be an issue. 

Userlevel 4
Badge +25

+1 for what @chrisatsafe​ said

Badge +2

Hi @clairestoddart​ ,

I don't believe there are any built-in features that would help with this; however, you could definitely accomplish this with a basic Automation that's triggered by a schedule, has 2 workspaces, and an Email External Action. Create a workspace to GET system events (SYSTEMEVENT_LOGIN_SUCCESS) using the REST API and write those to a table (getting started with JSON is a great resource if you are new to working with JSON data in FME as well). 

GET /systemevents/events/completed?name=SYSTEMEVENT_LOGIN_SUCCESS

Then Fragment the response with a JSONFragmenter: json["items"][*] and expose the relevant attributes (likely dateFinished, header.time, header.user, and id).

Then in a second workspace, use a DateTimeCalculator to compare how long since the last activity from the current date with a Tester. Then send the features that are older than 3 months to an FME Server Automations writer so you can connect the automation writer feature type to the Email External Action when you build the automation. 

 

One thing to be mindful of is the System Events History Cleanup Task so you don't miss any activity but if you schedule this to run daily that shouldn't be an issue. 

Hi @clairestoddart​ , 

I wanted to extend on Chris' suggestion. There is a System Event Trigger in Automations, so you could start by running a workspace with the REST API call to fetch all previous events, but then going forward in your Automation you could use this trigger to maintain the database - updating the dateFinished record for the user every time they log in. 

 

I'd suggest there are two benefits to this workflow: 

a) you won't miss recording a log-in event in the case of a system clean-up task

b) the workspace should be faster because you're updating one recording, rather than fetching and recreating the whole tabele.

Reply