How to Send the Numerical Values Through Webhooks


Do you need to make send the numerical values through webhooks? By default, all values passed through webhooks are sent through as a strings and not numbers. With a small snippet, you can easily convert these strings into numbers and we’ll show you how.


To ensure the numbers are sent through as numerical values, please copy and paste this code snippet to your site.

If you need assistance in adding snippets to your site, please see this tutorial.

 * Send the numerical values through webhooks.
 * @link

function wpf_dev_webhooks_numeric_value( $filled_params, $params, $process ) {

    // Request Body params which values should be numeric.
    // List each variable that you want as a number and not a string here separated by a comma and listed in single quotes
	$numeric_values = [ 'age', 'custom_value' ];

	foreach ( $filled_params as $key => $param ) {
		if ( is_numeric( $param ) && in_array( $key, $numeric_values, true ) ) {
			$filled_params[ $key ] = (int) $param;

	return $filled_params;


add_filter( 'wpforms_webhooks_process_fill_http_body_params_value', 'wpf_dev_webhooks_numeric_value', 10, 3);

Then just make sure your form is mapping the fields correctly in the form Settings. For the purpose of this documentation, we’re passing through two variables. One is age and another is custom_value. Just make sure to include each variable name in the snippet above wrapped in single quotes and separated by a comma for each variable you want to convert from a string to a number.

now you can send numerical values through webhooks

And that’s all you need! Would you like to also include the Entry ID in your webhook? Take a look at our article on How to Send the Entry ID Through Webhooks.