Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/barrymun/slack-history-exporter

A tool which uses the Slack API and retrieves messages from a given Slack DM channel and saves the contents to a file
https://github.com/barrymun/slack-history-exporter

slack slack-api

Last synced: 10 days ago
JSON representation

A tool which uses the Slack API and retrieves messages from a given Slack DM channel and saves the contents to a file

Awesome Lists containing this project

README

        

# Slack history exporter

## Overview

Retrieve messages from DM (direct message) channels in Slack and append the output to a file. The functionality is basic and only the text content of the messages is appended to a new file with a given delimiter.

## Get Started

> [!NOTE]
> You'll need to create an app in [Slack](https://api.slack.com/apps).
> Navigate to "OAuth & Permissions" and add the following **user token scopes**:
> ```[[scopes]]
> im:history
> ```

> [!TIP]
> Make sure that **user token scopes** are used instead of bot token scopes, otherwise the DM history will not be retrieved.

> [!NOTE]
> You will need to create a `.env` file at the root level of the project with the following keys:
> ```[[env]]
> SLACK_API_TOKEN=''
> SLACK_CHANNEL_ID=''
> ```

## Usage

Install dependencies:

```bash
yarn install
```

Run the script:

```bash
yarn run exe
```

The file `history.txt` will be created. If it already exists the contents will be overwritten.

## Why does this exist?

Useful for people who may want to save messages from a Slack workspace that they are leaving, or a Slack workspace where the license is expiring.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.