Call Web API to Update Custom Field on Post Save in WordPress

I need to grab some data from a web API and stick it in a custom field when the user hits update in WordPress. I have a js file that correctly gets the API data and am enqueueing the script with the code below. The problem is timing. The fetch call obviously comes in too late and the post is saved before I can add it to the custom field. Not sure how to set this up?

if ( $hook == ‘post-new.php’ || $hook == ‘post.php’ ) {
if ( $post->post_type == ‘speakers’ ) {
wp_enqueue_script( ‘test’, get_stylesheet_directory_uri() . ‘/js/test.js?v=111’, ‘jquery’, ”, true );
}
}

Plus – I have to make the API call in the browser, not server side.

Any help would be amazing! Thanks!