Create a source of type Jenkins in the Hookpager app. Store the channel token in Jenkins as a secret text credential with id hookpager-token.
post {
failure {
withCredentials([string(credentialsId: 'hookpager-token', variable: 'HOOKPAGER_TOKEN')]) {
sh '''
curl -fsS -X POST "https://hookpager.texttools.store/v1/c/jenkins" \
-H "Authorization: Bearer $HOOKPAGER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title":"'"$JOB_NAME"' #'"$BUILD_NUMBER"' failed","priority":"high","status":"firing","dedup_key":"jenkins:'"$JOB_NAME"'","url":"'"$BUILD_URL"'"}'
'''
}
}
}
Use the same dedup_key with "status":"resolved" in a fixed block when the job recovers.