环聊机器人如何在卡片消息中@提及用户 [英] Hangout bot how to @mention user in a card message
问题描述
我创建了一个机器人,该机器人应该将一组用户分配给他们的任务通知给他们.使用简单的消息时,它可以很好地工作,但是一旦放入卡片消息中,它就无法工作-我收到"---"或"???"而不是提及.我试图将其放在不同的小部件中:keyValue,textParagrap或header,但它没有任何改变.有人知道这是否有可能吗?
I've created a bot that is supposed to inform users from a group about the tasks they were assigned to. It is working well with the simple message using but it's not working once put in a card message - I got "---" or "???" instead of mention. I tried to put it in different widgets: keyValue, textParagrap or header but it doesn't change anything. Does anyone know if it's possible at all?
推荐答案
对API描述的审查应该已经证实了您的怀疑-目前,您不能通过Card消息提及用户,而只能通过简单消息提及用户.
A review of the API description should have confirmed your suspicions - at this moment, you cannot mention a user via a Card message, only a simple message.
每个卡片文本格式:>
在卡片内,大多数文本字段通过一小部分HTML标签支持基本文本格式.
Inside cards, most text fields support basic text formatting via a small subset of HTML tags.
和
请注意,使用不同的标记语法来解析基本消息的文本正文
Note that the text body of a basic message is parsed using a different markup syntax
关于简单消息的消息格式的API参考页明确标识了人们如何在简单消息中提及用户( 2 )
The API Reference page on message formats for simple messages explicitly identifies how one mentions users in simple messages (1, 2)
当查看 cards
:元数据与Message
关联的内容包括 Annotations
包括 UserMentionMetadata
.
如果查看Card
的规格,则不会观察到此类规格. 文本窗口小部件的描述仅包含格式化的文字.
Another hint comes when viewing the API descriptions of spaces.messages
and cards
: the metadata associated with a Message
includes Annotations
which include UserMentionMetadata
.
If viewing the specification for a Card
, no such specification is observed. The description of a text widget contains only the formatted text.
因此,如果您需要将卡的内容通知特定的用户,则应该将该卡DM给用户,或者在发送卡之前或之后的简单消息中提及该用户.
Thus, if you need to notify a particular user about the content of a card, you should either DM the card to the user, or mention the user in a simple message immediately before or after the card is sent.
这篇关于环聊机器人如何在卡片消息中@提及用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!