# Slack의 콘텐츠 가져오기

{% openapi src="/files/fAmF2Kwil50sF5cXMoEX" path="/discussions/{discussion\_id}/contents/" method="get" %}
[rememberizer\_openapi.yml](https://2913883985-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fs0e4JCKQXzEGPRlMO7nt%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=ac0eeb18-73cf-42a3-93fe-2ff232a978a3)
{% endopenapi %}

## 예제 요청

```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 %}

```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);
};

// 지난 주의 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 %}

\`\`\`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)
```

```

# 지난 주의 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 | 문자열 | **필수.** Slack 콘텐츠를 검색하기 위해 "slack"으로 설정합니다.                |
| from              | 문자열 | GMT+0에서 ISO 8601 형식의 시작 시간. 지정하지 않으면 기본값은 현재입니다.           |
| to                | 문자열 | 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: 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:

```
GET https://docs.rememberizer.ai/ko/undefined-1/api-docs/retrieve-slacks-content.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
