Filter uncanny-automator

automator_send_webhook_field_separator

Filters the character used to separate webhook fields within automator actions.

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

Description

Filters the separator character used for joining webhook field values. Developers can change this to a different character for custom webhook integrations, allowing for flexible data formatting when sending data via webhooks.


Usage

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

Return Value

The filtered value.


Examples

<?php
/**
 * Example of a custom filter for 'automator_send_webhook_field_separator'.
 *
 * This filter allows you to change the default separator character used
 * when constructing webhook field keys. For instance, if your webhook
 * requires fields to be separated by a hyphen instead of a slash,
 * you can implement this filter.
 *
 * @param string $separator The current field separator character.
 * @return string The modified field separator character.
 */
add_filter( 'automator_send_webhook_field_separator', function( $separator ) {
    // Let's say we want to use a pipe "|" as the separator for our webhook.
    $custom_separator = '|';
    return $custom_separator;
}, 10, 1 ); // 10 is the priority, 1 means the callback accepts 1 argument.
?>

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.php:56

public function __construct() {
		$this->field_separator = apply_filters( 'automator_send_webhook_field_separator', '/' );
		require_once __DIR__ . '/class-automator-send-webhook-fields.php';
		$this->fields = Automator_Send_Webhook_Fields::get_instance();

		// Register hooks.
		add_filter( 'automator_field_values_before_save', array( $this, 'encrypt_authorization_values' ), 10, 2 );
	}

Scroll to Top