---
title: "discord_community"
canonical_url: "https://tweetstream.io/zh-cn/docs/api/agent-action-discord-community"
last_updated: 2026-11-05
---

# discord_community

操作账号的 Discord：用已关联的 Discord 账号加入社区服务器、检查验证状态，或发送一条测试账单提醒。需要近期通过邮箱验证码登录。recent 级：需要 API key，以及 30 分钟内验证过的邮箱验证码换来的 X-TweetStream-Setup-Proof。同名 MCP 工具需要 tweetstream:settings 权限范围。

Canonical URL: https://tweetstream.io/zh-cn/docs/api/agent-action-discord-community

## `POST /api/agent/actions/discord_community`

`https://tweetstream.io/api/agent/actions/discord_community`

## 授权

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `Authorization` | `string`, 必填 | 使用 TweetStream API 密钥进行 Bearer 认证：`Bearer <key>`。 |

## 请求头

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `X-TweetStream-Setup-Proof` | `string`, 必填 | 邮箱验证返回的 setupProof，有效期 30 分钟。过期后需重新验证邮箱验证码。 |

## 请求体

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `kind` | `enum<string>`, 必填 |  |

### 请求体示例

```json
{
  "kind": "join_linked"
}
```

## 响应字段

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `community` | `object`, 必填 |  |
| `community.botInstalled` | `boolean`, 必填 |  |
| `community.botInstallUrl` | `string`, 必填 |  |
| `community.channelReady` | `boolean`, 必填 |  |
| `community.communityInviteUrl` | `string`, 必填 |  |
| `community.linked` | `boolean`, 必填 |  |
| `community.membership` | `enum<string>`, 必填 |  |
| `community.multipleLinked` | `boolean`, 必填 |  |
| `community.onboardingRequired` | `boolean`, 必填 |  |
| `community.required` | `boolean`, 必填 | Whether this account is asked to join the TweetStream Discord community. Only a checkout whose status is community_required waits for it. |
| `community.verificationPending` | `boolean`, 必填 |  |
| `community.verified` | `boolean`, 必填 |  |
| `kind` | `enum<string>`, 必填 |  |
| `outcome` | `enum<string>`, 必填 |  |

## 响应

| 状态 | 说明 | 请求头 |
| --- | --- | --- |
| `200` | 成功 |  |
| `400` | 输入不符合该操作的 schema（INVALID_REQUEST） |  |
| `401` | API key 缺失或无效，或 setup proof 缺失或已过期（REVERIFY_EMAIL） |  |
| `403` | 请求带有外部 Origin |  |
| `429` | 已达到速率限制（RATE_LIMITED），请在 retryAfterSeconds 秒后重试 |  |
| `503` | 暂时不可用，请稍后重试 |  |

### 200

```json
{
  "community": {
    "botInstalled": true,
    "botInstallUrl": "<string>",
    "channelReady": true,
    "communityInviteUrl": "<string>",
    "linked": true,
    "membership": "member",
    "multipleLinked": true,
    "onboardingRequired": true,
    "required": true,
    "verificationPending": true,
    "verified": true
  },
  "kind": "join_linked",
  "outcome": "applied"
}
```

### 400

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 401

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 403

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 429

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 503

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

## 代码示例

### cURL

```bash
curl --request POST \
  --url https://tweetstream.io/api/agent/actions/discord_community \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY" \
  --header "X-TweetStream-Setup-Proof: $TWEETSTREAM_SETUP_PROOF" \
  --header 'Content-Type: application/json' \
  --data '{
  "kind": "join_linked"
}'
```

### JavaScript

```javascript
const response = await fetch("https://tweetstream.io/api/agent/actions/discord_community", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TWEETSTREAM_API_KEY}`,
    "X-TweetStream-Setup-Proof": process.env.TWEETSTREAM_SETUP_PROOF,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "kind": "join_linked"
  }),
});

console.log(response.status, await response.json());
```

### Python

```python
import os
import requests

response = requests.post(
    "https://tweetstream.io/api/agent/actions/discord_community",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}", "X-TweetStream-Setup-Proof": os.environ["TWEETSTREAM_SETUP_PROOF"]},
    json={
        "kind": "join_linked",
    },
)

print(response.status_code, response.json())
```
