Php Google聊天机器人向房间中的特定用户发送消息

Php Google聊天机器人向房间中的特定用户发送消息,php,hangouts-api,hangouts-chat,Php,Hangouts Api,Hangouts Chat,我有一个可以工作的google聊天机器人,它可以向聊天机器人使用以下代码订阅的特定房间发送消息: $client = new Google_Client(); $client->setAuthConfig('../service-account.json'); $client->addScope('https://www.googleapis.com/auth/chat.bot'); $service = new Google_Service_HangoutsChat($clien

我有一个可以工作的google聊天机器人,它可以向聊天机器人使用以下代码订阅的特定
房间
发送消息:

$client = new Google_Client();
$client->setAuthConfig('../service-account.json');
$client->addScope('https://www.googleapis.com/auth/chat.bot');

$service = new Google_Service_HangoutsChat($client);

$message = new Google_Service_HangoutsChat_Message();

$message->setText('@Leon Vismer Testing a message.');
$message->setAnnotations([$annotation]);

$service->spaces_messages->create('spaces/SPACE_REFERENCE', $message);
然而,我要做的是使用一个提词将消息直接发送给
房间内的特定用户。我尝试使用注释,但似乎不起作用。我收到了房间内新消息的通知,但@antify不是对特定用户的正确注释

我尝试使用:

$user = new Google_Service_HangoutsChat_User([
    'name' => 'users/NUMBER_TO_THE_USER',
    'displayName' => 'Leon Vismer',
    'type' => 'HUMAN',
]);

$annotation = new Google_Service_HangoutsChat_Annotation([
    'type' => 'USER_MENTION',
    'startIndex' => 1,
    'length' => strlen('@Leon Vismer'),
    'userMention' => new Google_Service_HangoutsChat_UserMentionMetadata([
        'user' => $user,
        'type' => 'MENTION',
    ])
]);
聊天机器人能否像这样启动与特定用户的对话