gravityflow_post_webhook

The gravityflow_post_webhook action fires after the webhook request.

Example #1: Convert a webhook get request of a file into a local file and store the path in an upload field.

add_action( 'gravityflow_post_webhook', 'jo_action_gravityflow_post_webhook', 10, 4 );
function jo_action_gravityflow_post_webhook( $response, $args, $entry, $current_step ) {
    //Ensure it only executes on our desired step.
    if( $current_step->get_id() !== '83' ) {
	return;
    }
    //Ensure the response is a valid scenario for processing
    if ( ! is_wp_error( $response ) && isset( $response['response']['code'] ) && $response['response']['code'] == 200 && isset( $response['body'] ) ) {
        //Define where we will be retrieving the file to.
        $folder = '/tmp-pdf/';
        $filename = 'product-entry-' . $entry['id'] . '.pdf';
$field_id = '2';         $upload_dir   = wp_upload_dir(); //Store the PDF to uploads directory         file_put_contents( $upload_dir['basedir'] . $folder . $filename, $response['body'] ); //Update the entry upload field with URL to file.         GFAPI::update_entry_field( $entry['id'], $field_id, $upload_dir['baseurl'] . $folder . $filename );     } }

Placement

This code should be placed in the functions.php file of your active theme.7