automator_outgoing_webhook_content_types
Filters the available content types for outgoing webhooks, allowing customization of integration options.
add_filter( 'automator_outgoing_webhook_content_types', $callback, 10, 1 );
Description
Allows developers to modify the available content types for outgoing webhooks. This filter provides an array of content type slugs and their human-readable names. Developers can add, remove, or alter these options to customize the webhook sending process. The hook fires when the available content types are being retrieved.
Usage
add_filter( 'automator_outgoing_webhook_content_types', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
add_filter(
'automator_outgoing_webhook_content_types',
function ( $content_types ) {
// Add a new custom content type for sending data as a CSV.
$content_types['csv'] = 'CSV';
return $content_types;
},
10,
1
);
// Example of how you might use it later in your plugin to retrieve the content types.
function my_custom_automator_webhook_options() {
$available_content_types = apply_filters(
'automator_outgoing_webhook_content_types',
array(
'x-www-form-urlencoded' => 'x-www-form-urlencoded',
'form-data' => 'form-data',
'json' => 'JSON',
'plain' => 'Text',
'html' => 'HTML',
'xml' => 'XML',
'GraphQL' => 'GraphQL',
'raw' => 'Raw',
)
);
// Now $available_content_types would include 'csv' => 'CSV' if the above filter is active.
error_log( print_r( $available_content_types, true ) );
}
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
src/core/lib/webhooks/class-automator-send-webhook-fields.php:56
uncanny-automator-pro/src/core/webhook/webhook-common-options.php:85
public function get_data_format_types() {
return apply_filters(
'automator_outgoing_webhook_content_types',
array(
'x-www-form-urlencoded' => 'x-www-form-urlencoded',
'form-data' => 'form-data',
'json' => 'JSON',
'plain' => 'Text',
'html' => 'HTML',
'xml' => 'XML',
'GraphQL' => 'GraphQL',
'raw' => 'Raw',
)
);
}