Skip to content

Instantly share code, notes, and snippets.

@moxet
Forked from Crocoblock/code.php
Created July 7, 2025 08:22
Show Gist options
  • Save moxet/ce083e61e3c1e4de2c4df0d360b28e99 to your computer and use it in GitHub Desktop.
Save moxet/ce083e61e3c1e4de2c4df0d360b28e99 to your computer and use it in GitHub Desktop.
JetFormBuilder Do something on receiving webhook response
<?php
add_action( 'jet-form-builder/action/webhook/response', function( $response, $settings ) {
//get webhook url
$url = $settings['webhook_url'];
//check if we are using some specific endpoint
if ( false === strpos( $url, 'random-string/v1/generate' ) ) {
return;
}
//get response code
$response_code = wp_remote_retrieve_response_code( $response );
//check if response OK
if ( $response_code !== 200 ) {
return;
}
//get response body
$body = wp_remote_retrieve_body( $response );
if ( ! is_scalar( $body ) ) {
return;
}
//update form field 'arg' with received value
jet_fb_context()->update_request( $body, 'arg' );
}, 0, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment