슬랙의 콘텐츠 가져오기¶
GET /discussions/{discussion_id}/contents/¶
Retrieve the contents of a discussion by ID. A discussion can be a Slack or Discord chat.
Returns the content of the discussion with the specified ID. A discussion can be a Slack or Discord chat. The response contains two fields: discussion_content, which includes the main messages of the chat, and thread_contents, which contains the threads of the discussion.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
discussion_id |
path | integer | yes | The ID of the discussion to retrieve contents for. Discussions are either Slack or Discord chats. |
integration_type |
query | string | yes | Indicate the integration of the discussion. Currently, it can only be "slack" or "discord". |
from |
query | string | Indicate the starting time when we want to retrieve the content of the discussion in ISO 8601 format at GMT+0. If not specified, the default time is now. | |
to |
query | string | Indicate the ending time when we want to retrieve the content of the discussion in ISO 8601 format at GMT+0. If not specified, it is 7 days before the "from" parameter. |
Responses
200— Main and threaded messages of the discussion in a time range.404— Discussion not found.500— Internal server error.
예제 요청¶
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"
Info
YOUR_JWT_TOKEN을 실제 JWT 토큰으로, 12345를 실제 토론 ID로 교체하세요.
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);
Info
YOUR_JWT_TOKEN을 실제 JWT 토큰으로, 12345를 실제 토론 ID로 교체하세요.
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) ```
Info
YOUR_JWT_TOKEN을 실제 JWT 토큰으로, 12345를 실제 토론 ID로 교체하세요.
경로 매개변수¶
| 매개변수 | 유형 | 설명 |
|---|---|---|
| discussion_id | 정수 | 필수. 콘텐츠를 검색할 Slack 채널 또는 토론의 ID입니다. |
쿼리 매개변수¶
| 매개변수 | 유형 | 설명 |
|---|---|---|
| integration_type | 문자열 | 필수. Slack 콘텐츠를 검색하기 위해 "slack"으로 설정합니다. |
| from | 문자열 | GMT+0에서 ISO 8601 형식의 시작 시간. 지정하지 않으면 기본값은 현재입니다. |
| to | 문자열 | GMT+0에서 ISO 8601 형식의 종료 시간. 지정하지 않으면 "from" 매개변수의 7일 전입니다. |
응답 형식¶
{
"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)을 모두 반환합니다. 데이터는 시간 순서대로 정리되어 있으며, 사용자 정보를 포함하여 대화의 맥락을 이해하기 쉽게 만듭니다.
시간 범위 매개변수를 사용하면 특정 기간에 집중할 수 있으며, 이는 최근 활동이나 역사적 논의를 검토하는 데 특히 유용합니다.