设计用户互动
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页介绍了 Google Chat 应用如何设计和响应与用户的互动。
Chat 应用通过以下某些方式支持互动:
- 向用户介绍您的 Chat 应用
- 响应指令
- 显示或发送基于卡片的交互式界面
- 打开 Interactive Dialog
- 预览链接
- 在消息中@提及用户
向用户介绍您的 Chat 应用
通过欢迎消息详细介绍 Chat 应用的用途以及用户如何最佳地使用该应用,引导用户和聊天室加入您的 Chat 应用。
有效的新手入门消息的结构如下:
- 打个招呼。为用户设置合适的语音和语气。
- 简要说明 Chat 应用的用途。
用一两句话告诉用户 Chat 应用可以帮助他们做些什么,从而介绍您的 Chat 应用。
- 告知用户如何开始使用。告知用户如何使用您的 Chat 应用。如果您的 Chat 应用需要配置或授权,不妨在此处提示用户完成设置流程。例如,建议一两个常用命令。
- 说明如何获取帮助和提供反馈。在结束消息时,告知用户如何获取帮助或提供反馈。
以下聊天应用的新手入门消息可帮助用户顺利上手:
响应指令
借助命令,用户可以以特定或可重复的方式请求或与您的 Chat 应用互动。用户可以在消息中使用命令(例如输入 /help
),也可以从回复区域的菜单中选择命令。
以下是适用于 Cymbal Chat 应用的命令列表:
在消息中@提及用户
Chat 应用可以在聊天室中@提及特定用户或所有用户,以便通知他们有消息。在提及单个用户(尤其是在提及聊天室中的所有用户)之前,您应考虑是否真的有必要这样做,并尽量避免 @提及用户。
提及单个用户会导致对方收到通知,并中断他们正在执行的任何其他操作。在聊天室中提及所有用户会向聊天室中的所有人发送通知。如果过于频繁地提及他人,对方可能会对您的 Chat 应用感到厌烦,并开始将其视为垃圾内容。
出于非常重要或具有时效性的原因,您可以提及用户。例如,以下 Chat 应用会 @提及一个包含软件开发者的聊天室,以通知他们代码冻结时间即将到来,并让他们有机会表示自己需要在截止日期前多一点时间:
另一方面,以下 Chat 应用直接提及客户并向其致谢;这虽然很礼貌,但不值得发送通知:
发送或显示互动式卡片
卡片是界面元素,可包含交互式和静态 widget,例如文本、图片和按钮,Chat 应用可以将这些 widget 发送给用户和聊天室。如果您的 Chat 应用需要从用户那里收集信息、显示详细信息或引导用户执行后续步骤,请发送卡片消息。
作为 Chat 应用,您可以在消息中发送卡片界面,或在私信聊天室中将卡片显示为首页。
使用卡片制作工具设计和预览 Chat 应用的消息和界面:
打开卡片制作工具
以下是 Chat 应用中的卡片消息:
打开 Interactive Dialog
对话框是一种基于窗口的卡片式界面,用户可以打开该界面与 Chat 应用互动。在对话框中,您可以按顺序串联多个卡片消息,以帮助用户完成多步流程,例如填写表单数据。
在以下示例中,Chat 应用会启动一个对话框,以便从发出 /createContact
正斜线命令的用户收集联系详细信息:
预览 Chat 用户发送的链接
Chat 扩展应用可以为聊天室中的用户预览链接。每当有人分享匹配的链接时,Chat 应用都可以在其消息中附加一个卡片,显示该链接的相关信息。
以下 Chat 应用可帮助客户服务人员预览在 Chat 聊天室中分享的支持请求的链接:
后续步骤
如需构建互动功能,您必须将 Chat 应用配置为接收互动事件。如需了解具体步骤,请参阅接收和回应与 Chat 应用的互动
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-06。
[null,null,["最后更新时间 (UTC):2025-03-06。"],[[["\u003cp\u003eGoogle Chat apps can enhance user interaction through features like slash commands, interactive cards, and dialogs.\u003c/p\u003e\n"],["\u003cp\u003eOnboarding messages are crucial for introducing your Chat app's functionality and guiding users on how to get started.\u003c/p\u003e\n"],["\u003cp\u003eCards provide a visually engaging way to gather information, display details, and guide users within Chat.\u003c/p\u003e\n"],["\u003cp\u003eDialogs facilitate multi-step processes by enabling sequential card interactions within a dedicated window.\u003c/p\u003e\n"],["\u003cp\u003eChat apps can preview links shared by users, enhancing the context and information associated with them.\u003c/p\u003e\n"]]],["Google Chat apps interact with users by sending welcome messages, responding to slash commands (e.g., `/help`), and using interactive cards for UI. Apps can also open dialogs for multi-step processes, preview shared links with detailed information, and @mention users for important notifications, though overuse should be avoided. Building these interactive features requires the app to be configured to receive interaction events from Google chat.\n"],null,["# Design user interactions\n\nThis page describes how Google Chat apps can design and respond to\ninteractions with users.\n\nChat apps support interactivity in some of the\nfollowing ways:\n\n- Introduce users to your Chat app\n- Respond to commands\n- Display or send interactive card-based interfaces\n- Open interactive dialogs\n- Preview links\n- @mention users in a message\n\nIntroduce users to your Chat app\n--------------------------------\n\nOnboard people and spaces to your Chat app with a\nwelcome message that details what your Chat app does,\nand how people can best work with it.\n\nAn effective onboarding message has the following structure:\n\n- **Say hello**. Set the right voice and tone with your users.\n- **Describe briefly what your Chat app does**. Introduce your Chat app by telling people what it can help them do in one or two sentences.\n- **Tell people how to get started**. Tell people how to work with your Chat app. If your Chat app requires configuration or authorization, this is a good place to prompt people to complete the set-up process. For example, suggest one or two common commands.\n- **Explain how to get help and how to give feedback**. End the message by telling people how they can get help or offer feedback.\n\nThe following Chat app's onboarding message prepares\nusers for success:\n\nRespond to commands\n-------------------\n\n[Commands](/workspace/chat/commands)\nlet users request or interact with your Chat app in\nspecific or repeatable ways. Users can use commands in messages (such as typing\n`/help`), or select them from a menu in the reply area.\n\nThe following is a list of commands available for the Cymbal\nChat app:\n\n@mention users in messages\n--------------------------\n\nYour Chat app can\n[@mention specific users or all users](/workspace/chat/format-messages#messages-@mention)\nin a space to notify them of the message.\nBefore you mention a single user, and especially before you\nmention all users in a space, you should consider whether or not it's really\nnecessary, and err on the side of **not @mentioning people**.\n\nMentioning single users causes them to receive a notification and interrupts\nwhatever else they're doing. Mentioning all users in a space sends a\nnotification to everyone in the space. Mention people too often, and they might\nbecome annoyed with your Chat app and start to view it\nas spam.\n\nIt is OK to mention users for very important or time-sensitive reasons. For\nexample, the following Chat app @mentions a space full\nof software developers to notify them that code freeze is approaching and to\ngive them the chance to say they need a bit more time before the deadline:\n\nOn the other hand, the following Chat app mentions a\ncustomer directly to thank them; which is polite, but not notification-worthy:\n\nSend or display interactive cards\n---------------------------------\n\nCards are UI elements that can contain both interactive and static\nwidgets such as text, images, and buttons that Chat apps can send\nto users and spaces. If your Chat app needs to gather\ninformation from users, present detailed information, or guide users to take a\nnext step, send a card message.\n\nAs a Chat app, you can send card interfaces in\n[messages](/workspace/chat/create-messages#create) or display cards as a\n[homepage](/workspace/chat/send-app-home-card-message) in direct message spaces.\n\n\n*** ** * ** ***\n\nUse the Card Builder to design and preview messaging and user interfaces for Chat apps:\n[Open the Card Builder](https://addons.gsuite.google.com/uikit/builder)\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nThe following is a card message from a Chat app:\n\n### Open interactive dialogs\n\n[Dialogs](/workspace/chat/dialogs) are windowed, card-based interfaces that a\nuser can open to interact with your Chat app. In\ndialogs, you can string together multiple card messages sequentially, which\nhelps users complete multi-step processes, like filling in\n[form data](/workspace/chat/read-form-data).\n\nIn the following example, a Chat app starts a dialog to\ngather contact details from a user who issues the `/createContact` slash\ncommand:\n\n### Preview links sent by Chat users\n\nChat apps can [preview links](/workspace/chat/preview-links)\nfor users in a space. Whenever someone shares a matching link,\na Chat app can attach a card to their message that\ndisplays information about the link.\n\nThe following Chat app helps customer service agents\npreview links to cases shared in a Chat space:\n\nNext steps\n----------\n\nTo build interactive features, you must configure your\nChat app to receive interaction events. For steps,\n[Receive and respond to interactions with your Chat app](/workspace/chat/receive-respond-interactions)"]]