Send API call when health check fails

I’m looking for an irule or method to send an API call when a health check fails.

As usual with BIG-IP, there are a number of ways to do this - you can use the alert subsystem to run a script. Start here and here

You can also use an external scripted monitor assigned to a pool or node which runs periodically and if it receives no response then it performs the API call. You can also use iCall to periodically run system-wide scripts and perform actions.