We have a setup where in pgpool using watchdog configured for the master-slave replication. The standby is a warm standby and I would like to below:

1. Identify when a failover happens. one way is to query using pg_is_in_recovery function.
2. Send a notification when the failover happens or the switch happens.

Please advise on the same.