Lấy nội dung của Slack
Lấy nội dung của Slack
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.
The ID of the discussion to retrieve contents for. Discussions are either Slack or Discord chats.
Indicate the integration of the discussion. Currently, it can only be "slack" or "discord".
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.
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.
Main and threaded messages of the discussion in a time range.
Discussion not found.
Internal server error.
GET /api/v1/discussions/{discussion_id}/contents/?integration_type=text HTTP/1.1
Host: api.rememberizer.ai
Accept: */*
{
"discussion_content": "",
"thread_contents": {}
}Ví dụ Yêu cầu
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"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);
};
// Lấy nội dung Slack cho tuần trước
const toDate = new Date().toISOString();
const fromDate = new Date();
fromDate.setDate(fromDate.getDate() - 7);
const fromDateStr = fromDate.toISOString();
getSlackContents(12345, fromDateStr, toDate);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)Lấy nội dung Slack trong tuần qua
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" %}
Thay thế `YOUR_JWT_TOKEN` bằng mã thông báo JWT thực tế của bạn và `12345` bằng ID cuộc thảo luận thực tế.
{% endhint %}
{% endtab %}
{% endtabs %}
## Tham số Đường dẫn
| Tham số | Loại | Mô tả |
|---------|------|-------|
| discussion_id | số nguyên | **Bắt buộc.** ID của kênh Slack hoặc cuộc thảo luận để lấy nội dung. |
## Tham số truy vấn
| Tham số | Loại | Mô tả |
|---------|------|-------|
| integration_type | chuỗi | **Bắt buộc.** Đặt thành "slack" để lấy nội dung từ Slack. |
| from | chuỗi | Thời gian bắt đầu theo định dạng ISO 8601 tại GMT+0. Nếu không được chỉ định, mặc định là bây giờ. |
| to | chuỗi | Thời gian kết thúc theo định dạng ISO 8601 tại GMT+0. Nếu không được chỉ định, nó là 7 ngày trước tham số "from". |
## Định dạng Phản hồi
```json
{
"discussion_content": "Người dùng A [2023-06-01 10:30:00]: Chào buổi sáng đội ngũ!\nNgười dùng B [2023-06-01 10:32:15]: Buổi sáng! Mọi người hôm nay thế nào?",
"thread_contents": {
"2023-06-01T10:30:00Z": "Người dùng C [2023-06-01 10:35:00]: @Người dùng A Mình khỏe, cảm ơn vì đã hỏi!\nNgười dùng A [2023-06-01 10:37:30]: Rất vui khi nghe điều đó @Người dùng C!",
"2023-06-02T14:15:22Z": "Người dùng D [2023-06-02 14:20:45]: Đây là cập nhật về dự án...\nNgười dùng B [2023-06-02 14:25:10]: Cảm ơn vì đã cập nhật!"
}
}Phản hồi lỗi
404
Không tìm thấy cuộc thảo luận
500
Lỗi máy chủ nội bộ
Điểm cuối này truy xuất nội dung của một kênh Slack hoặc cuộc trò chuyện tin nhắn trực tiếp. Nó trả về cả tin nhắn chính của kênh (discussion_content) và các phản hồi theo chủ đề (thread_contents). Dữ liệu được tổ chức theo thứ tự thời gian và bao gồm thông tin người dùng, giúp dễ dàng hiểu ngữ cảnh của các cuộc trò chuyện.
Các tham số khoảng thời gian cho phép bạn tập trung vào các khoảng thời gian cụ thể, điều này đặc biệt hữu ích cho việc xem xét hoạt động gần đây hoặc các cuộc thảo luận lịch sử.
Last updated