استرجاع محتوى Slack

Retrieve the contents of a discussion by ID. A discussion can be a Slack or Discord chat.

get

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.

Path parameters
discussion_idintegerRequired

The ID of the discussion to retrieve contents for. Discussions are either Slack or Discord chats.

Query parameters
integration_typestringRequired

Indicate the integration of the discussion. Currently, it can only be "slack" or "discord".

fromstringOptional

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.

tostringOptional

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
get
/discussions/{discussion_id}/contents/
GET /api/v1/discussions/{discussion_id}/contents/?integration_type=text HTTP/1.1
Host: api.rememberizer.ai
Accept: */*
{
  "discussion_content": "",
  "thread_contents": {}
}

طلبات مثال

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"

استبدل YOUR_JWT_TOKEN برمز JWT الفعلي الخاص بك و 12345 بمعرف المناقشة الفعلي.

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

استبدل YOUR_JWT_TOKEN برمز JWT الفعلي الخاص بك و 12345 بمعرف المناقشة الفعلي.

```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 بمعرف المناقشة الفعلي. {% endhint %} {% endtab %} {% endtabs %}

معلمات المسار

المعلمة
النوع
الوصف

discussion_id

عدد صحيح

مطلوب. معرف قناة Slack أو المناقشة لاسترجاع المحتويات.

معلمات الاستعلام

المعلمة
النوع
الوصف

integration_type

سلسلة

مطلوب. تعيين إلى "slack" لاسترجاع محتوى Slack.

from

سلسلة

وقت البدء بتنسيق ISO 8601 في GMT+0. إذا لم يتم تحديده، فإن القيمة الافتراضية هي الآن.

to

سلسلة

وقت الانتهاء بتنسيق ISO 8601 في GMT+0. إذا لم يتم تحديده، فهو 7 أيام قبل معلمة "from".

تنسيق الاستجابة

{
  "discussion_content": "المستخدم أ [2023-06-01 10:30:00]: صباح الخير فريق!\nالمستخدم ب [2023-06-01 10:32:15]: صباح الخير! كيف حال الجميع اليوم؟\n...",
  "thread_contents": {
    "2023-06-01T10:30:00Z": "المستخدم ج [2023-06-01 10:35:00]: @المستخدم أ أنا بخير، شكرًا على السؤال!\nالمستخدم أ [2023-06-01 10:37:30]: سعيد لسماع ذلك @المستخدم ج!",
    "2023-06-02T14:15:22Z": "المستخدم د [2023-06-02 14:20:45]: إليكم التحديث حول المشروع...\nالمستخدم ب [2023-06-02 14:25:10]: شكرًا على التحديث!"
  }
}

ردود الأخطاء

رمز الحالة
الوصف

404

لم يتم العثور على المناقشة

500

خطأ في الخادم الداخلي

تسترجع هذه النقطة نهاية محتويات قناة Slack أو محادثة الرسائل المباشرة. تعيد كل من رسائل القناة الرئيسية (discussion_content) والردود المتسلسلة (thread_contents). يتم تنظيم البيانات زمنياً وتتضمن معلومات المستخدم، مما يسهل فهم سياق المحادثات.

تسمح لك معلمات نطاق الوقت بالتركيز على فترات محددة، وهو أمر مفيد بشكل خاص لمراجعة الأنشطة الأخيرة أو المناقشات التاريخية.

Last updated