> For the complete documentation index, see [llms.txt](https://docs.rememberizer.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rememberizer.ai/ja/rissu/api-docs/retrieve-slacks-content.md).

# Slackのコンテンツを取得

## Slackのコンテンツを取得する

{% openapi src="/files/NPsg8DFwcSjopKSuZo9m" path="/discussions/{discussion\_id}/contents/" method="get" %}
[rememberizer\_openapi.yml](https://3282965451-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK09NlRK7lXZsjqCNQsEe%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=dd73efa7-56a8-4350-88ab-85d7586fb7b8)
{% endopenapi %}

### 例リクエスト

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET \
  "https://api.rememberizer.ai/api/v1/discussions/12345/contents/?integration_type=slack&from=2023-06-01T00:00:00Z&to=2023-06-07T23:59:59Z" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

{% hint style="info" %}
`YOUR_JWT_TOKEN` を実際のJWTトークンに、`12345` を実際のディスカッションIDに置き換えてください。
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const getSlackContents = async (discussionId, from = null, to = null) => {
  const url = new URL(`https://api.rememberizer.ai/api/v1/discussions/${discussionId}/contents/`);
  url.searchParams.append('integration_type', 'slack');
  
  if (from) {
    url.searchParams.append('from', from);
  }
  
  if (to) {
    url.searchParams.append('to', to);
  }
  
  const response = await fetch(url.toString(), {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN'
    }
  });
  
  const data = await response.json();
  console.log(data);
};

// 過去1週間のSlackコンテンツを取得
const toDate = new Date().toISOString();
const fromDate = new Date();
fromDate.setDate(fromDate.getDate() - 7);
const fromDateStr = fromDate.toISOString();

getSlackContents(12345, fromDateStr, toDate);
```

{% hint style="info" %}
`YOUR_JWT_TOKEN` を実際のJWTトークンに、`12345` を実際のディスカッションIDに置き換えてください。
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
from datetime import datetime, timedelta

def get_slack_contents(discussion_id, from_date=None, to_date=None):
    headers = {
        "Authorization": "Bearer YOUR_JWT_TOKEN"
    }
    
    params = {
        "integration_type": "slack"
    }
    
    if from_date:
        params["from"] = from_date
    
    if to_date:
        params["to"] = to_date
    
    response = requests.get(
        f"https://api.rememberizer.ai/api/v1/discussions/{discussion_id}/contents/",
        headers=headers,
        params=params
    )
    
    data = response.json()
    print(data)
```

{% endtab %}
{% endtabs %}

## 過去1週間のSlackコンテンツを取得

to\_date = datetime.now().isoformat() + "Z" from\_date = (datetime.now() - timedelta(days=7)).isoformat() + "Z"

get\_slack\_contents(12345, from\_date, to\_date)

````

{% hint style="info" %}
`YOUR_JWT_TOKEN`を実際のJWTトークンに、`12345`を実際のディスカッションIDに置き換えてください。
{% endhint %}
{% endtab %}
{% endtabs %}

## パスパラメータ

| パラメータ | タイプ | 説明 |
|-----------|------|-------------|
| discussion_id | 整数 | **必須。** コンテンツを取得するためのSlackチャンネルまたはディスカッションのID。 |

## クエリパラメータ

| パラメータ | タイプ | 説明 |
|-----------|------|-------------|
| integration_type | string | **必須。** Slackコンテンツを取得するために「slack」に設定します。 |
| from | string | GMT+0のISO 8601形式での開始時間。指定しない場合、デフォルトは現在時刻です。 |
| to | string | GMT+0のISO 8601形式での終了時間。指定しない場合、「from」パラメータの7日前になります。 |

## レスポンスフォーマット

```json
{
  "discussion_content": "ユーザー A [2023-06-01 10:30:00]: おはようチーム！\nユーザー B [2023-06-01 10:32:15]: おはよう！みんな今日はどう？\n...",
  "thread_contents": {
    "2023-06-01T10:30:00Z": "ユーザー C [2023-06-01 10:35:00]: @ユーザー A 私は元気です、聞いてくれてありがとう！\nユーザー A [2023-06-01 10:37:30]: それを聞いて嬉しいです @ユーザー C！",
    "2023-06-02T14:15:22Z": "ユーザー D [2023-06-02 14:20:45]: プロジェクトの更新です...\nユーザー B [2023-06-02 14:25:10]: 更新ありがとう！"
  }
}
````

### エラー応答

| ステータスコード | 説明               |
| -------- | ---------------- |
| 404      | ディスカッションが見つかりません |
| 500      | サーバー内部エラー        |

このエンドポイントは、Slackチャンネルまたはダイレクトメッセージの会話の内容を取得します。メインのチャンネルメッセージ（`discussion_content`）とスレッド返信（`thread_contents`）の両方を返します。データは時系列で整理されており、ユーザー情報が含まれているため、会話の文脈を理解しやすくなっています。

時間範囲パラメータを使用すると、特定の期間に焦点を当てることができ、最近の活動や過去のディスカッションをレビューするのに特に便利です。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.rememberizer.ai/ja/rissu/api-docs/retrieve-slacks-content.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
