Drupal::messenger()->addMessage() to selected $uid for server-server requests

What is the most elegant way to send a notification to a specified UID from an anonymous session? I have a webhook (function triggered by server-server request) that need to notify the relevant users about incoming payments from the bank.

What exactly do I need?

Drupal::messenger()->addMessage(t('Send message to selected UID=10.'), 'error', TRUE, $uid=10);

What I tried to achieve it?

$uid = Drupal::currentUser()->id();
Drupal::logger('dev_user')->debug('Logged UID='.$uid); // Output msg: Logged UID=0; User: Anonymous (not verified)
    
$user = User::load(235);
$accountSwitcher = Drupal::service('account_switcher');
$accountSwitcher->switchTo($user);
  
try {
  $uid  = Drupal::currentUser()->id();
  Drupal::logger('dev_user')->debug('Logged UID='.$uid); //  Output: 	Logged UID=235; User: Dev Dev
  Drupal::messenger()->addMessage(t('New payment recorded for UID='.$uid), 'error', TRUE);  // Displays nothing (at UID=235)
}
catch (Exception $e){
  watchdog_exception('dev_exception', $e);
}

$accountSwitcher->switchBack();

Only other option I have in mind is to create a DB table, write there the notification message for a selected user and trigger the dispatcher that will be linked to the events that all users listen to. User listener will then check if there’s message for his $uid and use the regular function from very top to display it – not elegant at all. Any ideas?

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed