Trigger on login?

Is it possible to trigger something based on a login to the interface? For instance, I want to send a notification to Slack whenever a login attempt occurs to the HASS interface.

Or trigger on failed login too…

That too… trigger on any login event.

That looks interesting…

How often would that run?