gravityflow_entry_webhook_response_mapping
Allow the entry to be modified during the response mapping of the webhook step. During the outgoing webhook step, this filter fires once for each response mapping (JSON key to form field) you have defined in the step settings.
Example:
Your outgoing webhook step calls an API which provides an array of JSON values that you would like to map into a paragraph field with html.
add_filter( 'gravityflow_entry_webhook_response_mapping', 'sh_filter_gravityflow_entry_webhook_mapping', 10, 4 ); function sh_filter_gravityflow_entry_webhook_mapping( $entry, $mapping, $data, $step ) { //Parse a complex response object for a defined field mapping - example uses https://www.markerapi.com/ if( $mapping[ 'custom_key' ] == 'trademarks' ) { if( is_array( $data[ 'trademarks' ] ) ){ $field = '<ul>'; foreach( $data[ 'trademarks' ] as $trademark ) { $field .= '<li><strong>' . $trademark['wordmark'] . ' - ' . $trademark['code'] . '</strong><br/>' . $trademark['description'] . '</li>'; } $field .= '</ul>'; $entry[ $mapping[ 'value' ] ] = $field; } } return $entry; }
Placement
This code should be placed in the functions.php file of your active theme.