## Send WooCommerce notes in BuddyPress Messages

Question

The following code send a message to new members of my buddypress site upon registration. How is it possible to adapt this so that when a customer leaves a note at the checkout, it gets sent to my ‘messages’ inbox?

function send_woo_note_to_messages( $user_id) { if ( ! bp_is_active( 'messages' ) ) return;$user_info = $user_id ? new WP_User($user_id ) : wp_get_current_user();

$args = array( 'sender_id' => 1, // This will be the customer id. 'thread_id' => false, 'recipients' =>$user_id, // This will be the admin id (1)
'subject' => 'Customer Note',
'content' => sprintf( __( 'Insert customer note here' ),
'date_sent' => bp_core_current_time()
);

$result = messages_new_message($args );
}


bp_core_activated_user is used to send the message upon account activation. I figured that I could use woocommerce_new_order_note_data to aid my request, but apparently not.