Skip to content

Instantly share code, notes, and snippets.

@guoweihua1982
Created July 4, 2019 07:03
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save guoweihua1982/573bb1602fb6b5f9db946882aff45f96 to your computer and use it in GitHub Desktop.
Save guoweihua1982/573bb1602fb6b5f9db946882aff45f96 to your computer and use it in GitHub Desktop.
Slack聊天记录的备份和查看方法

Slack聊天记录备份

课题

免费版Slack的workspace最多只支持最近的10000件聊天记录查看,如果能定期保存的话比较方便阅览。

聊天记录保存

使用下面的基于go语言开发的工具

使用

  • https://api.slack.com/custom-integrations/legacy-tokens取得token
    选择【Legacy information】下的【Create token】按钮取得token。
    ※看不到token发行按钮时,点击右上角的【Go to Slack】登录对象workspace,再打开上面的网址。
    ※显示【Request token】按钮时说明管理员设置了权限,需要管理员许可才能申请

  • 聊天记录取得

D:\>cd D:\slack-dump-v1.1.3-windows-amd64\windows-amd64
D:\slack-dump-v1.1.3-windows-amd64\windows-amd64>slack-dump -t=【取得的token】

聊天记录查看

利用slack-export-viewer可以查看聊天记录文件,但是有两个问题

  • 文件路径不一致,slack-export-viewer默认所有的channel聊天记录文件夹在zip的根目录下,如下:
聊天记录.zip
│   channels.json
│   users.json 
│
└───channel1
│   │   聊天记录1.json
│   └───...
└───channel2
│   │   聊天记录1.json
│   └───...
└───...

而slack-dump输出的channel聊天记录文件夹在相应类别文件夹下,如下:

聊天记录.zip
│   channels.json
│   users.json 
│
└───channel
│   └───channel1
│   │   │   聊天记录1.json
│   │   └───...
│   └───channel2
│   │   │   聊天记录1.json
│   │   └───...
│   └───...
└───direct_message
│   └───channel1
│   │   │   聊天记录1.json
│   │   └───...
│   └───channel2
│   │   │   聊天记录1.json
│   │   └───...
│   └───...
└───private_channel
    └───channel1
    │   │   聊天记录1.json
    │   └───...
    └───channel2
    │   │   聊天记录1.json
    │   └───...
    └───...

所以使用前要把slack-dump输出的zip文件解压后,把所有的channel聊天记录文件夹剪切到根目录下重新打包

  • 所有的channel都被当成public channel显示。TODO:原因调查
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment