Action uncanny-automator-pro

fluent_support/ticket_created

Fires after a new ticket is successfully created in Fluent Support, passing the created ticket and customer details.

add_action( 'fluent_support/ticket_created', $callback, 10, 2 );

Description

Fires after a new ticket is successfully created in Fluent Support. This hook provides access to the newly created ticket object and the associated customer object. Developers can leverage this action to trigger custom workflows, update other systems, or perform additional actions immediately following ticket creation.


Usage

add_action( 'fluent_support/ticket_created', 'your_function_name', 10, 2 );

Parameters

$created_ticket (mixed)
This parameter contains the ticket object that has just been created.
$customer (mixed)
The `$created_ticket` parameter contains the details of the newly created ticket in Fluent Support.

Examples

add_action(
	'fluent_support/ticket_created',
	function ( $created_ticket, $customer ) {
		// Log basic ticket information to the WordPress debug log when a new ticket is created.
		if ( ! is_object( $created_ticket ) || ! isset( $created_ticket->id ) ) {
			error_log( 'Fluent Support ticket created hook received invalid ticket data.' );
			return;
		}

		if ( ! is_object( $customer ) || ! isset( $customer->email ) ) {
			error_log( 'Fluent Support ticket created hook received invalid customer data.' );
			return;
		}

		$ticket_id   = $created_ticket->id;
		$customer_email = $customer->email;
		$ticket_subject = isset( $created_ticket->subject ) ? $created_ticket->subject : 'No Subject';

		error_log(
			sprintf(
				'New Fluent Support ticket created: ID=%s, Subject="%s", Customer Email=%s',
				$ticket_id,
				$ticket_subject,
				$customer_email
			)
		);

		// Example: Add a custom meta field to the ticket if it doesn't exist.
		// This is just a placeholder for more complex logic.
		// In a real scenario, you would likely interact with Fluent Support's API or database.
		$custom_meta_key = 'auto_assigned_plugin';
		$custom_meta_value = 'my-custom-plugin';

		// This part would require Fluent Support's internal functions or a direct DB query.
		// For demonstration purposes, we'll just log the intention.
		error_log(
			sprintf(
				'Attempting to add custom meta "%s" with value "%s" to ticket ID %s.',
				$custom_meta_key,
				$custom_meta_value,
				$ticket_id
			)
		);

	},
	10, // Priority
	2  // Accepted arguments: $created_ticket, $customer
);

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/integrations/fluent-support/actions/flsupport-createticket-a.php:267

/*
			 * Action on ticket create
			 *
			 * @param object $createdTicket
			 * @param object $customer
			 */
			do_action( 'fluent_support/ticket_created', $created_ticket, $customer ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

			$this->hydrate_tokens(
				array(
					'FS_TICKET_URL' => admin_url( "admin.php?page=fluent-support#/tickets/{$created_ticket->id}/view" ),
					'FS_TICKET_ID'  => $created_ticket->id,
				)
			);


Scroll to Top