Hi there!
I managed to solve it, it was much simpler than I imagined. I will post the solution here in case anyone needs it in the future.
add_action(
'learndash_course_completed',
function ( $data ) {
// ANY user completed Course 421
if ( $data['course']->ID == 421 ) {
$custom_data = array(
'user_id' => $data['user']->ID
);
$webhook_names = array(
'user-complete-course'
);
$http_args = array(
'blocking' => false //Set this to true to receive the response
);
$response = apply_filters( 'wp_webhooks_send_to_webhook_filter', array(), $custom_data, $webhook_names, $http_args );
return '';
}
},
20
);
Thank you!