---
title: Outreach API 參考
description: Platform API v1 的 Outreach：每個操作的路徑、參數、請求與回應欄位、scope、冪等與錯誤，直接取自 API 合約。
url: https://agentlab.cresclab.com/docs/zh-tw/api/outreach
language: zh-Hant
updated: 2026-12-05
---

# Outreach API 參考

Platform API v1 的 Outreach：每個操作的路徑、參數、請求與回應欄位、scope、冪等與錯誤，直接取自 API 合約。

> [!NOTE]
> 由 API 合約（Agent Lab Platform API 1.0.0-alpha.1）產生。說明文字是合約的英文原文。

Messages the assistant sends unprompted, through a connected Slack channel of the workspace,
to one person or one channel the sender names. Each is attributed to the acting member and
says why it was sent. The scope is restricted: these are messages to the workspace's contacts.

## The member's messages sent through a channel

`GET /v1/workspaces/{workspaceId}/channels/{connectionId}/outreach`

The messages the acting member made the assistant send through this channel, newest first,
with what became of each: `pending` while delivery is still being tried, `sent`, or
`abandoned` when it never will be (`lastError` says why). At most the member's 50 newest
sends in the workspace are read and then narrowed to this channel; `truncated` is true when
the member has older sends anywhere in the workspace. Needs an active member. A channel that
is not the workspace's is not found.

| Scope | 身分 | 驗證方式 | Idempotency-Key |
| --- | --- | --- | --- |
| `outreach:write` | `member` | `installationToken` | — |

### 參數

| 名稱 | 位置 | 型別 | 必填 | 說明 |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | 是 | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
| `connectionId` | path | `string` | 是 | The channel, by its id in the channel list. |

### 回應

| 狀態碼 | 內容 | 說明 |
| --- | --- | --- |
| `200` | `application/json`: [OutreachList](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#OutreachList) | The member's sends through the channel. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## Send a message to one person or one channel

`POST /v1/workspaces/{workspaceId}/channels/{connectionId}/outreach`

Sends `body` through this channel, a connected Slack workspace, to exactly one target: a
person by their Slack user id (`targetUserRef`, a direct message nobody else sees) or a
channel by its Slack id (`targetChannelRef`). Naming both or neither is refused. `reason` is
required and kept with the message: it answers "why did the assistant message me". The
message is attributed to the acting member, recorded in the workspace's audit trail with
the application, and delivered at once when it can be; otherwise it stays `pending` and is
retried, and the list shows what became of it.

Needs a member who may manage the workspace's channels, as the console does. A channel
that is not a connected Slack channel is a 400; one that is not the workspace's is not
found.

`Idempotency-Key` is required: a message to a person cannot be taken back, so a retry
must never send it twice. The same key and body within 24 hours answer the first send
again.

| Scope | 身分 | 驗證方式 | Idempotency-Key |
| --- | --- | --- | --- |
| `outreach:write` | `member` | `installationToken` | 支援 |

### 參數

| 名稱 | 位置 | 型別 | 必填 | 說明 |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | 是 | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
| `connectionId` | path | `string` | 是 | The channel, by its id in the channel list. |
| `Idempotency-Key` | header | `string` | 是 | Makes the send safe to retry. The same key and body within 24 hours answer the first answer again; the same key with a different body is 409. |

### 請求內容

`application/json`: [OutreachSend](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#OutreachSend)

| 欄位 | 型別 | 必填 | 說明 |
| --- | --- | --- | --- |
| `targetUserRef` | `string` | 否 | A person, by their Slack user id. Exactly one of this and `targetChannelRef`. |
| `targetChannelRef` | `string` | 否 | A channel, by its Slack id. Exactly one of this and `targetUserRef`. |
| `body` | `string` | 是 | The message, at most 4000 characters. |
| `reason` | `string` | 是 | Why it is sent, at most 300 characters; kept with the message. |

### 回應

| 狀態碼 | 內容 | 說明 |
| --- | --- | --- |
| `201` | `application/json`: [OutreachMessage](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#OutreachMessage) | The message, as its first delivery attempt left it. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | Nothing was sent: `IDEMPOTENCY_KEY_REQUIRED`, the request has no `Idempotency-Key` (`none`); or the request itself is wrong, such as naming both targets or a channel that is not a connected Slack channel (`none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | No such operation or resource. |
| `409` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | Nothing was sent: `CHANNEL_MISSING_PERMISSION`, the Slack install predates direct messages, and an administrator connects it again (`configure`); or the `Idempotency-Key` conflict `IdempotencyConflict` describes. |
| `413` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | The body is larger than the operation accepts (`PAYLOAD_TOO_LARGE`, `recovery: none`). |
| `422` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | `CHANNEL_RECIPIENT_UNREACHABLE`: Slack will not open a conversation with this person; name somebody else (`none`). Nothing was sent. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-tw/api/schemas.md#Error) | Try again later (`recovery: retry`). |
