交互式消息

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

概述

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

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

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

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

启用工具

1

添加 WhatsApp 集成

导入 WhatsApp 商务账号(说明),然后前往 集成页面,点击 _添加 集成 _ 按钮,选择 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,相关内容不会传递给智能体。
  • 交互式消息属于会话消息:只能在活跃对话中发送,不能作为首次出站联系。请使用消息模板开启对话。