> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fetchhive.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WhatsApp

> 通过已连接的账户连接 WhatsApp Business 消息、模板、媒体和自动化。

# WhatsApp

当你的工作流需要向 WhatsApp 客户发送消息，或管理 WhatsApp Business 账户时，请使用此应用。你可以发送消息、使用模板、处理媒体，并管理流程。

## 配置

| 选项 | 必需 | 描述 |
| - | - | - |
| 名称 | 否 | 工作流画布中此步骤的标签。 |
| Authentication | 是 | 此步骤要使用的已连接 WhatsApp 账户。 |
| Action | 是 | 要执行的 WhatsApp 操作（例如 列出电话号码、获取电话号码、获取商务资料、列出消息模板）。 |
| Arguments | 是 | 根据操作架构生成的各个操作表单字段。每个文本字段都有一个 **Insert Variable** 按钮，用于插入 `{{placeholder}}` 值。高级用法可使用 **Raw JSON** 选项卡。 |
| When the step fails | 否 | 控制此步骤失败时工作流应 **Terminate Workflow** 还是 **Continue**。 |

在配置此步骤之前，请使用登录流程在你的工作区的 **Integrations** 中连接 WhatsApp。如果没有可用的有效连接，此步骤会显示警告，并提供指向 **Integrations** 的链接，而不是账户选择器。

## Arguments form

当你选择某个操作时，**Arguments** 部分会根据该操作的输入架构渲染一个表单。引用现有记录的字段包含下拉选择器。

如果你更喜欢手动编写完整的参数对象，请切换到 **Raw JSON** 选项卡。任一选项卡中的更改都会保持同步。

## 常用操作

| 操作 | 描述 |
| - | - |
| **List phone numbers** | 检索已注册到你的 WhatsApp Business 账户的所有电话号码。 |
| **Get phone number** | 检索某个 WhatsApp Business 电话号码的详细信息。 |
| **Get business profile** | 检索某个 WhatsApp Business 电话号码的商务资料信息。 |
| **List message templates** | 检索 WhatsApp Business 账户的所有消息模板。 |
| **Check template status** | 检索某个消息模板的状态和详细信息。 |
| **Send message** | 向 WhatsApp 用户发送文本消息。 |
| **Send template message** | 向 WhatsApp 用户发送模板消息。 |
| **Get message history** | 检索某个 WhatsApp Business 电话号码的消息历史。 |
| **Upload media** | 将媒体文件上传到 WhatsApp 服务器。 |
| **Get media info** | 检索已上传媒体的元数据和下载链接。 |
| **Send media by ID** | 将先前上传的媒体发送给 WhatsApp 用户。 |
| **List flows** | 列出与 WhatsApp Business 账户关联的所有 WhatsApp Flows。 |

诸如删除记录之类的破坏性操作在工作流操作选择器中不可用。

## 输出

此步骤会将 WhatsApp 响应存储为步骤输出。响应的结构取决于操作。

在后续步骤中使用完整的输出引用：

```text theme={null}
{{STEP_IDENTIFIER.output}}
```

## 示例

1. 打开 **Integrations**，如果你还没有这样做，就先连接 WhatsApp。
2. 在你的工作流中添加一个 **WhatsApp** 步骤。
3. 在 **Authentication** 中选择一个已连接的账户。
4. 在 **Action** 中选择 **List phone numbers**。
5. 填写所需字段。对于任何字段值，使用 **Insert Variable** 引用前一个步骤的输出。
6. 点击步骤标题中的 **Run** 来测试该操作，然后在 **Output** 中查看返回的载荷。

## 使用场景

### 回复客户

1. 获取电话号码
2. 发送消息
3. 获取消息历史

### 创建并使用模板

1. 列出消息模板
2. Upsert message template
3. 发送模板消息

### 处理共享媒体

1. 上传媒体
2. 获取媒体信息
3. 按 ID 发送媒体

## 注意事项

* 此步骤依赖于你工作区中已连接的 WhatsApp 集成。
* 工作流操作选择器会显示一组精选操作。拥有 WhatsApp 工具的代理可以使用更多操作。
* 登录界面可能会显示第三方授权品牌标识。

## 将 WhatsApp 用作代理工具

你也可以在 **Agent Editor** 中将 WhatsApp 添加为工具。打开代理，点击 **Add tool**，然后选择 **WhatsApp**。在工具设置面板中，选择代理应使用的已连接账户。当相关于对话时，代理会调用 WhatsApp 操作。

另请参见：[集成](https://docs.fetchhive.com/zh/workspace/integrations.md)、[创建和编辑](https://docs.fetchhive.com/zh/workflows/creating-and-editing.md) 和 [测试与迭代](https://docs.fetchhive.com/zh/workflows/testing-and-iteration.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.