项目作者: ayhanozemre

项目描述 :
slack-exporter - slack html/json exporter
高级语言: Python
项目地址: git://github.com/ayhanozemre/slack-exporter.git
创建时间: 2018-02-23T11:15:23Z
项目社区:https://github.com/ayhanozemre/slack-exporter

开源协议:MIT License

下载


Slack Exporter

Slack conversations exporter html/json

Requirements

  • Python 3.x
  • requests
  • jinja2

Installation

  • pip install -r requirements.txt
  • Set your slack token to env SLACK_USER_TOKEN

How To Make Slack App

  • To create a Slack application, open https://api.slack.com/apps in the browser.
  • If we are not logged in, press the Create New App button on the page that opens after logging in.
  • Select the From scratch option in the popup that appears.
  • Select the App Name and the slack workspace you want to backup and press the Create App button.
  • From the Basic information tab, click on the Permissions tab under Add features and functionality.
  • Download the page and come to the Scopes section.
  • Add the following permissions by clicking the Add an OAuth Scope button under User Token Scopes.
  • channels:history,channels:read,groups:history,groups:read,identify
    im:history,im:read,mpim:history,mpim:read,usergroups:read,users.profile:read
    users:read,users:read.email
  • After adding the necessary permissions, the install to workspace button under OAuth Tokens for Your Workspace becomes active.
  • Confirm the permissions you have given in the window that opens by clicking the button and the necessary user token is created.

Running

ps : If you have a large conversations, use --export-type=multiple_html

Single html expor

  1. python exporter.py --export-type=single_html --directory=/tmp/

Json export

  1. python exporter.py <slack-token> --export-type=json --directory=/tmp/

Json export with channel type

  1. python exporter.py --export-type=json --channel-type=public_channel --directory=/tmp/

Multiple html export with channel type

  1. python exporter.py --export-type=multiple_html --channel-type=public_channel --directory=/tmp/

Parameters

  1. Parameter required/optinal description
  2. --channel-type optional im|mpim|public_channel|private_channel. default "all"
  3. --directory optional default "current" directory
  4. --log-level optional INFO|DEBUG|WARNING, default "INFO"
  5. --export-type optional json|single_html|multiple_html, default "json"