跳到导航

交互式消息

让智能体在 WhatsApp 对话中提供可点击的按钮和列表

概述

智能体无需让用户输入答案,而是可以发送 WhatsApp 交互式消息:最多 3 个可点击的回复按钮,或最多包含 10 个选项的列表。用户的点击会作为下一条消息返回,智能体可准确得知所选选项。

交互式消息仅适用于活跃的 WhatsApp 消息对话。智能体通过以下两个集成工具发送:

  • 向对话发送交互式按钮——最多 3 个回复按钮,适合少量选项。
  • 向对话发送交互式列表——按分区组织的可点击选项列表,适合超过 3 个选项的情况。
用户通过列表菜单和回复按钮购买话费。

来源:Meta 的 WhatsApp 交互式消息指南。

启用工具

1

添加 WhatsApp 集成

导入 WhatsApp Business 账户(说明),然后前往 集成页面,点击 _添加 集成 _ 按钮,选择 WhatsApp 并连接账户。

2

添加工具

前往工具页面,点击 _添加集成 工具 _ 按钮,选择 WhatsApp 集成,然后添加 _ 向对话发送交互式按钮 _ 和 向对话发送交互式列表 工具。

如果导入了多个 WhatsApp 账户,每个账户都有自己的 WhatsApp 集成。 请确保从智能体所用账户连接的集成中添加工具—— 从其他账户集成添加的工具无法用于该智能体的 对话。

3

将工具附加到智能体

在智能体配置中添加工具。这些工具始终向实时 对话中的用户发送消息——智能体决定内容,绝不决定收件人。

发送交互式按钮

向对话发送交互式按钮会在当前 WhatsApp 消息对话中提供 1 至 3 个选项。

参数必填说明
body_text是显示在按钮上方的消息。最多 1024 个字符。
buttons是按显示顺序排列的 1 至 3 个按钮。标题必须唯一。
footer_text否显示在按钮下方的小字。最多 60 个字符。

每个按钮包含:

字段必填说明
id是用户点击此按钮时返回的标识符。最多 256 个字符。
title是按钮标签。最多 20 个字符。

发送交互式列表

向对话发送交互式列表会在当前 WhatsApp 消息对话中显示按分区组织的选项。用户打开列表并选择一行。

参数必填说明
body_text是显示在列表上方的消息。最多 4096 个字符。
button_text是用于打开列表的按钮标签。最多 20 个字符。
sections是1 至 10 个选项分组。所有分区合计的列表最多可包含 10 行。
header_text否显示在消息正文上方的标题。最多 60 个字符。
footer_text否显示在列表下方的小字。最多 60 个字符。

每个分区包含:

字段必填说明
title是分区标题。最多 24 个字符。
rows是此分区中的 1 至 10 个选项。

每一行包含:

字段必填说明
id是用户选择此行时返回的标识符。最多 200 个字符。
title是行标签。最多 24 个字符。
description否显示在行标签下方的辅助文本。最多 72 个字符。

如果智能体生成的内容超出限制,工具调用会失败,并告知智能体原因,使其能以更短内容重试。

提示智能体

在系统提示词中告诉智能体何时提供选项。例如:

When you need the user to pick from a fixed set of options (appointment slots,
product variants, yes/no confirmations), use the Send Interactive Buttons tool
for up to 3 options or the Send Interactive List tool for more. Keep option
titles short. Do not use interactive messages for open-ended questions.

可选:添加流程以引导智能体使用工具

为智能体提供工具只是完成了一半——流程会告诉它如何有效地操作这些工具。

以下流程是模板,不可直接套用。复制后请根据实际情况调整:根据流程调整 触发条件,只保留智能体实际拥有的工具,并重写选项 示例和规则以符合使用场景。

---
name: Offer choices with interactive messages
trigger: The user must pick from a fixed set of known options in a WhatsApp message conversation, such as appointment slots, product variants, or order confirmations.
---
Offer the options as an interactive message instead of asking the user
to type an answer.
1. Check which interactive tools you have. Prefer Send Interactive
Buttons for 2–3 options and Send Interactive List for 4–10. If only
one of the two is available, use it for any option count that fits its
limits; if no interactive tool fits, ask the question in plain text.
Never present more than 10 options; narrow them down with a question
first.
2. Write a body_text that asks one clear question. Do not stack multiple
questions into one interactive message.
3. Give every option a stable, machine-readable id (for example
slot_2026-08-20_10am) and a short human title — 20 characters for
buttons, 24 for list rows.
4. For lists, group related rows into titled sections, and add a
description to a row only when its title alone is ambiguous.
5. Send the message with the tool, then wait for the user's reply. Do not
send a second interactive message before the user responds to the first.
6. Treat the reply as the user's choice. Confirm it back in one short line
and continue the flow.
Rules:
- Never use interactive messages for open-ended questions.
- When the fixed options may not cover everyone, include a final option
such as "Something else" and follow up with a free-text question.
- If the tool call fails because content exceeds a limit, shorten titles
and descriptions and retry once.
- If the user types an answer instead of tapping, accept it — do not
re-send the options.

限制

  • 交互式消息只能在消息对话中发送——不能在 WhatsApp 语音通话期间发送,也不能在其他渠道发送。
  • 不支持 WhatsApp Flows(交互式表单)。如果用户回复 Flow,回复不会传递给智能体。
  • 交互式消息属于会话消息:只能在活跃对话中发送,不能作为首次出站联系。请使用消息模板开启对话。