margaritageleta / slack-export-history

Download your Slack DM conversations
26 stars 10 forks source link

broken with external users outside the company #6

Open neotea opened 1 year ago

neotea commented 1 year ago

I was looking for a solution to export my own chat, since I used it as a notebook and bookmark. Unfortunately I got the error: DEBUG:urllib3.connectionpool:https://slack.com:443 "POST /api/conversations.list HTTP/1.1" 200 2276 Data retrieved OK. Status code: 200 Traceback (most recent call last): File "/slack-dm/slack.py", line 214, in <module> convers, options = fetch_conversations() File "/slack-dm/slack.py", line 112, in fetch_conversations 'user_name': users[conver['user']]['name'] KeyError: 'U01EXNX1234'

I have checked and the sepcific user seems to be an external user in my workspace !!!conver={'id': 'D047Y5R1234', 'created': 1666715881, 'is_archived': False, 'is_im': True, 'is_org_shared': False, 'context_team_id': 'TD46B1234', 'updated': 1666715881, 'is_shared': True, 'is_ext_shared': True, 'user': 'U01EXNX1234', 'is_user_deleted': False, 'priority': 0} Different to the other users, it has 'is_shared': True, 'is_ext_shared': True, Keys. So for me I have fixed the problem by changing line 108 from if conver['is_im']: to if conver['is_im'] and conver.get("is_shared") is None:

that workaround worked for me since I only wanted to grab my own conversation.