---
title: 添加自定义机器人
description: 用 Pyn 的清单创建一个 Slack 应用，让消息以你自己的机器人名称和图标发出，然后把它的机器人令牌粘贴到 Pyn 中。
sidebar:
  order: 2
area: integrations
feature: slack
appPath: /settings/integrations/installed
lastVerified: 2026-10-22
version: "2026-10-16"
audience: admin
related:
  - integrations/slack
  - settings/senders
  - flows/automations
intercom:
  - id: "16755898"
    title: Set up a Custom Slack Sender/Slack Bot (Pyn 2)
    url: https://intercom.help/pyn/en/articles/16755898-set-up-a-custom-slack-sender-slack-bot-pyn-2
    note: replaces
  - id: "9585758"
    title: Send Slack messages from a service account (Pyn 1)
    url: https://intercom.help/pyn/en/articles/9585758-send-slack-messages-from-a-service-account-pyn-1
    note: "Pyn 1 article, kept for reference"
translation:
  source: integrations/slack/add-a-custom-bot.mdx
  sourceSha: 91576e99cc3c5bc38d53042426498f8e5bdb7941
---

你希望消息来自 `@PeopleTeam`，而不是来自 Pyn Bot 或某个人。自定义机器人是你用 Pyn 提供的清单在自己的工作区中创建的 Slack 应用；你把它的机器人令牌粘贴到 Pyn 中，它就会作为发件人出现。

## 开始之前

- Slack 集成在 **Settings > Integrations** 下处于 **Active** 状态。
- 你，或与你协作的 Slack 工作区管理员，可以在 `api.slack.com/apps` 创建应用。

![Installed 列出每个已连接的集成；选择 Slack 磁贴打开它的面板。](https://support.pyn.ai/media/integrations/overview/integrations-installed-list.png)

## 步骤

1. 在 Pyn 中，打开左侧导航中的 **Settings**，然后打开 **Integrations** 下的 **Installed**，并选择 **Slack** 磁贴。

2. 打开 **...** 菜单并选择 **Add custom bot**。

3. 展开 **Slack set up** 并选择 **Copy manifest**。清单为机器人请求 `channels:read`、`channels:write.invites`、`chat:write`、`groups:read`、`groups:write.invites` 和 `im:write`。

4. 在 Slack 中，前往 `api.slack.com/apps`，选择 **Create New App**，然后选择 **From a manifest**。选择工作区，在 **YAML** 标签页粘贴清单并完成创建应用。把 `CHANGEME_Name` 的两处都替换为机器人的名称。

5. 把应用安装到工作区，并在 **Basic Information** 下设置它的显示名称、描述和图标。

6. 在 **OAuth & Permissions** 下，复制 **Bot User OAuth Token**（以 `xoxb-` 开头）。

7. 回到 Pyn，把它粘贴到 **Bot Token** 中并选择 **Add**。

> **Tip:** 把机器人邀请到它应该发帖的每个频道；机器人只能在它是成员的地方发帖。对机器人私信的回复显示在 Slack 中该应用自己的消息视图里，而不是某个人的收件箱中。

## 你应该看到什么

机器人出现在 **Settings > General > Senders** 下，状态为 **Active**，并出现在[自动化流程](https://support.pyn.ai/zh-cn/flows/automations/)中 Slack 步骤的 **From** 列表里。如果 Pyn 拒绝该令牌，对话框显示 "We could not add the custom bot. Please check the token and try again." 或 Slack 自己给出的原因；检查你复制的是机器人令牌，而不是签名密钥或 `xoxp-` 用户令牌。

## 相关

- [Slack](https://support.pyn.ai/zh-cn/integrations/slack/)，了解集成本身。
- [发件人](https://support.pyn.ai/zh-cn/settings/senders/)，测试或归档机器人。
- [自动化流程](https://support.pyn.ai/zh-cn/flows/automations/)，用它发送消息。
