Filter uncanny-automator-pro

automator_pro_webhook_array_key_in_token_separator

Filters the separator used to join array keys within webhook tokens, allowing customization of how nested data is accessed.

add_filter( 'automator_pro_webhook_array_key_in_token_separator', $callback, 10, 1 );

Description

Filters the separator used for array keys within webhook tokens. Developers can modify this character to customize how nested array data is represented in webhook payloads, allowing for more flexible data parsing and integration. The default separator is '/'.


Usage

add_filter( 'automator_pro_webhook_array_key_in_token_separator', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

add_filter( 'automator_pro_webhook_array_key_in_token_separator', 'my_custom_webhook_array_key_separator', 10, 1 );

/**
 * Changes the separator used for accessing array keys within webhook tokens.
 *
 * This function modifies the default '/' separator to a custom character,
 * for instance, a dot '.', to be used when accessing nested array data
 * within Uncanny Automator Pro webhook tokens.
 *
 * @param string $separator The current separator character.
 * @return string The modified separator character.
 */
function my_custom_webhook_array_key_separator( $separator ) {
    // For example, if we want to use a dot '.' as the separator for array keys
    // instead of the default '/'.
    $custom_separator = '.';

    // Return the custom separator.
    return $custom_separator;
}

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-rest-handler.php:30

public function __construct() {
		self::$array_key_separator = apply_filters( 'automator_pro_webhook_array_key_in_token_separator', '/' );

		// Load and wire the webhook index file.
		require_once __DIR__ . '/class-webhook-index.php';
		Webhook_Index::get_instance()->register_hooks();

		add_action( 'rest_api_init', array( __CLASS__, 'automator_webhook_init_rest_api' ) );
	}

Scroll to Top