Reply To: Deliver Custom Message via BuddyPress to new users
messages_new_message() is the function that’s used to send messages in BP core, so you could utilise that? You’ll want to hook your function to the bp_core_activated_user hook. For example:
function send_message_to_new_member( $user_id, $key, $user ) {
$args = array(
'sender_id' => 1,
'thread_id' => false,
'recipients' => array( $user_id ),
'subject' => 'Hello new user',
'content' => 'Welcome to the site',
'date_sent' => bp_core_current_time()
);
$result = messages_new_message( $args );
}
add_action( 'bp_core_activated_user', 'send_message_to_new_member', 3 );
Note: $result will be either the ID of the new message thread if the message was sent successfully, or it’ll be false on failure.