> ## 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.

# Telegram

> 从工作流发送纯文本 Telegram 消息

# Telegram

当你希望工作流向你的私人 Telegram 聊天发送纯文本消息时,请使用 **Telegram**。

Telegram 步骤通过 Fetch Hive Bot 发送消息。你无需创建 Telegram 机器人或添加机器人 token。

## 设置

### 1. 连接 Telegram

打开工作区 **Integrations** 页面并在 Telegram 上点击 **Connect**。

你也可以从 Telegram 工作流步骤中,通过点击 **Destination** 字段中的 **Connect Telegram** 进行连接。

### 2. 启动 Fetch Hive Bot

Telegram 会打开 Fetch Hive Bot。

在 Telegram 中按 **Start**。如果 Telegram 改为显示消息框,请发送预填的 `/start` 消息。

如果 Telegram 网页上的 **Start** 按钮没有反应,你的浏览器可能无法在该设备上打开 Telegram。请在已登录 Telegram 的手机或电脑上打开相同的链接,或者自行打开 Telegram,搜索 `@FetchHiveBot`,并发送链接中显示的 `/start` 消息。

`/start` 链接会在短时间后过期。如果它不起作用,请返回 Fetch Hive 并再次点击 **Connect Telegram** 以获取新的链接。

### 3. 返回 Fetch Hive

按下 **Start** 后返回 Fetch Hive。

已连接的 Telegram 目的地会出现在 Telegram 步骤的 **Destination** 选择器中。如果没有立即出现,请点击 **Refresh**。

### 4. 添加 Telegram 步骤

将 **Telegram** 添加到你的工作流。

保持 **Action** 设置为 **Send Message**。

选择已连接的 Telegram 目的地。

如果工作流助手为你添加了 Telegram 步骤,请打开步骤设置并在测试、运行、版本化或部署工作流之前选择目的地。

在 **Message** 中编写消息正文。当消息应包含起始输入或早前的工作流步骤输出时,请使用 **Insert Variable**。

## 配置

| 选项                  | 是否必填 | 说明                                                            |
| ------------------- | ---- | ------------------------------------------------------------- |
| Name                | 否    | 步骤在工作流画布中的标签。                                                 |
| Action              | 是    | Telegram 操作。当前编辑器显示 **Send Message**。                         |
| Destination         | 是    | 你已连接的私人 Telegram 聊天。                                          |
| Message             | 是    | 纯文本消息正文。                                                      |
| When the step fails | 否    | 控制 Telegram 投递失败时工作流应 **Terminate Workflow** 还是 **Continue**。 |

## 示例

一个常见的计划工作流是:

```text theme={null}
RSS or search step -> prompt summary step -> Telegram step
```

在 Telegram 消息中,引用之前的摘要:

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

一旦 Telegram 连接并选定,计划工作流就能正常工作,这使其适用于每日新闻摘要、警报和定期报告。

## 输出

此步骤将 Telegram 响应存储为步骤输出。

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

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

如果你需要返回的 Telegram 载荷中的特定字段,在测试运行后从变量选择器中插入它:

```text theme={null}
{{step_2.output.result.message_id}}
```

Telegram 将每条机器人文本消息限制为 4096 个字符。如果解析后的消息更长,Fetch Hive 会将其作为多条 Telegram 消息发送。在这种情况下,输出包含 `message_count`,且 `result` 是 Telegram 消息载荷的列表。

## 备注

* Telegram 必须由选择目的地的同一用户连接。
* 此设置支持私人 Telegram 聊天。
* 此步骤仅发送纯文本。
* 群组和频道目的地目前不是常规 Telegram 步骤设置的一部分。

另见:[计划部署](../../scheduled-deployments)、[测试与迭代](../../testing-and-iteration) 和 [Integrations](../../../workspace/integrations)
