# Retrieve Slack's content

{% openapi src="/files/7T1Jx6BU3fZ2U5LsImW1" path="/discussions/{discussion\_id}/contents/" method="get" %}
[rememberizer\_openapi.yml](https://2952947711-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyNqpTh7Mh66N0RnO0k24%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=cbad765b-1613-4222-b591-9ae17a3b7cfa)
{% endopenapi %}

## Example Requests

{% 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" %}
Replace `YOUR_JWT_TOKEN` with your actual JWT token and `12345` with an actual discussion 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);
};

// Get Slack contents for the past week
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" %}
Replace `YOUR_JWT_TOKEN` with your actual JWT token and `12345` with an actual discussion 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)

# Get Slack contents for the past week
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" %}
Replace `YOUR_JWT_TOKEN` with your actual JWT token and `12345` with an actual discussion ID.
{% endhint %}
{% endtab %}
{% endtabs %}

## Path Parameters

| Parameter      | Type    | Description                                                                       |
| -------------- | ------- | --------------------------------------------------------------------------------- |
| discussion\_id | integer | **Required.** The ID of the Slack channel or discussion to retrieve contents for. |

## Query Parameters

| Parameter         | Type   | Description                                                                                         |
| ----------------- | ------ | --------------------------------------------------------------------------------------------------- |
| integration\_type | string | **Required.** Set to "slack" for retrieving Slack content.                                          |
| from              | string | Starting time in ISO 8601 format at GMT+0. If not specified, the default is now.                    |
| to                | string | Ending time in ISO 8601 format at GMT+0. If not specified, it's 7 days before the "from" parameter. |

## Response Format

```json
{
  "discussion_content": "User A [2023-06-01 10:30:00]: Good morning team!\nUser B [2023-06-01 10:32:15]: Morning! How's everyone doing today?\n...",
  "thread_contents": {
    "2023-06-01T10:30:00Z": "User C [2023-06-01 10:35:00]: @User A I'm doing great, thanks for asking!\nUser A [2023-06-01 10:37:30]: Glad to hear that @User C!",
    "2023-06-02T14:15:22Z": "User D [2023-06-02 14:20:45]: Here's the update on the project...\nUser B [2023-06-02 14:25:10]: Thanks for the update!"
  }
}
```

## Error Responses

| Status Code | Description           |
| ----------- | --------------------- |
| 404         | Discussion not found  |
| 500         | Internal server error |

This endpoint retrieves the contents of a Slack channel or direct message conversation. It returns both the main channel messages (`discussion_content`) and threaded replies (`thread_contents`). The data is organized chronologically and includes user information, making it easy to understand the context of conversations.

The time range parameters allow you to focus on specific periods, which is particularly useful for reviewing recent activity or historical discussions.


---

# 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/developer-resources/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.
