如何使用 REST API @提及机器人?

How to @mention a bot using REST APIs?

使用 REST APIs,我可以在聊天 space/room 中使用机器人的服务帐户 @mention human 用户。

例如,以下 API 调用在 space(ID:xyx)中发布一条消息,标记 ID 为 118194077000688478880 的用户。

API: POST https://chat.googleapis.com/v1/{parent=spaces/xyz}/messages
Body: { 'text' : '<users/118194077000688478880> sample message' }

但是,我不知道如何使用相同的方法在消息中标记机器人 API

我检查了浏览器并获得了机器人 ID。我尝试了以下组合,但没有用。假设机器人 ID 是 1234567890

{ 'text' : '<users/1234567890> sample message' }
{ 'text' : '<bots/1234567890> sample message' }
{ 'text' : '<users/bots/1234567890> sample message' }

如果可能,请告诉我。如果是这样,如何?提前致谢!

这是设计使然,Google 无法做到。如果你问我,我会很沮丧。

Status: Won't Fix (Intended Behavior) Currently it is intended for bots only to be mentioned manually by a user. This is done in order to prevent potential abuse, especially in situations where a bot could @mention and send commands to other bots. This behavior is intended, but you may submit a feature request for this change. Be sure to include use cases for this functionality.

https://issuetracker.google.com/issues/109759261