将php变量传递到“特定”CF7输入的最有效方法是什么?

Scenario - I'm trying to create a simple ticketing system for use with CF7 and flamingo. I want to be able to archive email's on the server and in my mail client under the same unique identifier in the subject field.

I think I'm pretty close but I'm not strong with php, and I don't want to cause myself problems down the line. I think this qualifies as a GET request but at the same time I may be overthinking it.

(Googling this subject has turned out to be quite confusing, So I figured it best to ask someone more experienced.)

The question

How would I 'best' pass a string to a specific Contact From 7 input?

The field in question - [text* ticket-number id:ticket-field]

The following is located in my functions.php file;

/* Prevent sending step for specific form */
add_action("wpcf7_before_send_mail", "wpcf7_fill_ticket");  

function wpcf7_fill_ticket($cf7) {

    /* find id="ticket-field" */


    /* Generate CF7 Ticket Number */
    $length = 8;
    $characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    for ($p = 0; $p < $length; $p++) {
        $string .= $characters[mt_rand(0, strlen($characters)-1)];
    }
    return $string;

    /* Pass generated string into input */

}

Any help I could get with this issue would be greatly appreciated.