Filter uncanny-automator

uap_fl_support_ticket_tokens

Filters support ticket tokens for Fluent Support integrations, triggered when tickets are created or updated.

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

Description

This filter allows developers to modify the available tokens for Fluent Support ticket-related triggers in the Uncanny Automator plugin. It fires when Automator is preparing to list tokens for Fluent Support actions. Developers can add or remove tokens, enabling custom data to be used in workflows.


Usage

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

Parameters

$args (mixed)
This parameter contains an array of strings representing different events within the Fluent Support plugin that can trigger the hook.

Return Value

The filtered value.


Examples

/**
 * Example of adding a custom token to the 'uap_fl_support_ticket_tokens' filter.
 * This function would conditionally add a new token if certain criteria are met.
 *
 * @param array $ticket_token_actions The existing array of ticket token actions.
 * @param array $args                 The arguments passed to the apply_filters.
 *
 * @return array The modified array of ticket token actions.
 */
function my_custom_fl_support_ticket_tokens( $ticket_token_actions, $args ) {

	// Example: Only add a new token if the integration is 'FLSUPPORT'
	// and the 'add_action' meta is 'new_feature_request'.
	if ( isset( $args['integration'] ) && 'FLSUPPORT' === $args['integration'] &&
		 isset( $args['triggers_meta']['add_action'] ) && 'new_feature_request' === $args['triggers_meta']['add_action'] ) {

		// Add a new custom token.
		$ticket_token_actions[] = 'fluent_support/new_feature_request_submitted';
	}

	return $ticket_token_actions;
}

// Add the filter with 2 accepted arguments.
// The priority is set to 10, which is the default.
add_filter( 'uap_fl_support_ticket_tokens', 'my_custom_fl_support_ticket_tokens', 10, 2 );

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/integrations/fluent-support/tokens/flsupport-tokens.php:43

$trigger_integration = (string) $args['integration'];

		if ( 'FLSUPPORT' === $trigger_integration && 'FLST_TICKET_OPENED' !== (string) $args['triggers_meta']['code'] && 'FLST_TICKET_CLOSED' !== (string) $args['triggers_meta']['code'] ) {

			$add_action   = (string) $args['triggers_meta']['add_action'];
			$trigger_meta = (string) $args['meta'];

			$ticket_token_actions = apply_filters(
				'uap_fl_support_ticket_tokens',
				array(
					'fluent_support/ticket_created',
					'fluent_support/response_added_by_customer',
					'fluent_support/ticket_closed_by_customer',
					'fluent_support/response_added_by_agent',
				),


Scroll to Top