The following action hook will register if the Gravity Forms webhook is successful i.e. 200 and it will send a corresponding email upon successful completion…
add_action(
‘gform_webhooks_post_request’,
function ( $response, $feed, $entry, $form ) {
gf_webhooks()->log_debug( __METHOD__ . json_encode($response) );
if ( $response[‘response’][‘code’]!=200 ) {
gf_webhooks()->log_debug( __METHOD__ . ‘(): Sending email for error…’ );
$error_message = $response[‘body’];
$to = ’email@emailhere.com’;
$subject = ‘Webhook failed!’;
$body = “Webhook for entry #$entry[id] failed. Error: $error_message”;
wp_mail( $to, $subject, $body );
gf_webhooks()->log_debug( __METHOD__ . ‘(): Email sent…’ );
}
},
10,
4
);
Reference:
https://community.gravityforms.com/t/need-help-sending-notification-if-webhook-fails/19983/5