Filter
uncanny-automator-pro
automator_pro_webhook_data_types
Filters the available data types for webhooks, allowing customization of what data can be sent.
add_filter( 'automator_pro_webhook_data_types', $callback, 10, 1 );
Description
Allows developers to modify the available data types for Uncanny Automator Pro webhooks. Filter the $types array before it's returned to add or remove options like JSON, form data, or plain text, customizing how webhook payloads are processed.
Usage
add_filter( 'automator_pro_webhook_data_types', 'your_function_name', 10, 1 );
Parameters
-
$types(mixed) - This parameter contains an array of available data types for webhook triggers and actions, each defined by a 'value' and a human-readable 'text' representation.
Return Value
The filtered value.
Examples
add_filter( 'automator_pro_webhook_data_types', 'my_custom_automator_webhook_data_types', 10, 1 );
/**
* Adds a custom data type to Uncanny Automator webhook options.
*
* This function demonstrates how to hook into the
* 'automator_pro_webhook_data_types' filter to add a new option
* for users to select when configuring webhook data types within
* Uncanny Automator Pro.
*
* @param array $types An array of existing webhook data types.
* @return array The modified array of webhook data types, including the new custom type.
*/
function my_custom_automator_webhook_data_types( $types ) {
// Add a new custom data type to the existing array.
// This could be used for a specific integration or internal processing need.
$types[] = array(
'value' => 'custom_data',
'text' => esc_html__( 'Custom Data Format', 'your-text-domain' ),
);
return $types;
}
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
uncanny-automator-pro/src/core/webhook/webhook-common-options.php:76
public static function get_webhook_data_types() {
$types = array(
array(
'value' => 'text',
'text' => esc_html_x( 'Text', 'Automator', 'uncanny-automator-pro' ),
),
array(
'value' => 'email',
'text' => esc_html_x( 'Email', 'Automator', 'uncanny-automator-pro' ),
),
array(
'value' => 'int',
'text' => esc_html_x( 'Integer', 'Automator', 'uncanny-automator-pro' ),
),
array(
'value' => 'float',
'text' => esc_html_x( 'Float', 'Automator', 'uncanny-automator-pro' ),
),
array(
'value' => 'url',
'text' => esc_html_x( 'URL', 'Automator', 'uncanny-automator-pro' ),
),
);
return apply_filters( 'automator_pro_webhook_data_types', $types );
}