aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_api.py
Commit message (Collapse)AuthorAgeFilesLines
* Use enterprise id in edgeapi path if it existsTrygve Aaberge2024-03-291-1/+2
| | | | | | | It seems like for enterprise workspaces you have to use the enterprise id (if the token is a workspace level token, `enterprise_id/workspace_id` can also be used, but isn't necessary), while for non-enterprise workspaces the workspace id should be used.
* Add command `/slack mute`Trygve Aaberge2024-02-191-0/+8
|
* Move set user profile functionsTrygve Aaberge2024-02-191-14/+14
|
* Fetch max 500 users in each requestTrygve Aaberge2024-02-181-1/+1
| | | | | Some users have gotten HTTP 500 from the API when trying to request 1000 users in one request.
* Add an option to leave the channel when a buffer is closedTrygve Aaberge2024-02-181-0/+8
|
* Add command `/slack join`Trygve Aaberge2024-02-181-0/+9
| | | | | For now this only supports known channels, which currently typically means they have to be referenced in a channel with history loaded.
* Add command `/slack query` to open DM/MPDM channelsTrygve Aaberge2024-02-181-0/+9
| | | | | | For now this only supports known nicks, i.e. mostly nicks that have posted a message, is mentioned in a message or appears in the nicklist in any of the conversations that's loaded.
* Support files in Slack Connect channelsTrygve Aaberge2024-02-181-0/+9
| | | | | | | | | Files uploaded in Slack Connect channels doesn't contain any information, so we have to make a request to files.info in order to get the information to render it. See https://api.slack.com/apis/channels-between-orgs#check_file_info for more info.
* Post users.profile.set as a JSON bodyTrygve Aaberge2024-02-181-5/+16
| | | | | It's better to post nested objects as JSON rather than url encoding them, and this fixes some type errors.
* Set user statusPierguido Lambri2024-02-181-2/+28
| | | | | | | It's now possible to set and clear the uses status. For now it's not possible to set the status emoji or the status expiration. Signed-off-by: Pierguido Lambri <plambri@redhat.com>
* Set user user presence (#919)Pier2024-02-181-0/+8
| | | | | | | | | | | The user can now set the presence with: /slack presence away Or: /slack presence active Signed-off-by: Pierguido Lambri <plambri@redhat.com>
* Only open channels for the current sub workspaceTrygve Aaberge2024-02-181-0/+8
| | | | | | | | | | | | | | | | | | | | | It's possible to have a token that's only for one workspace in an enterprise grid. For me with such a token, it returns channels in all workspaces in client.userBoot, but only channels in the tokens workspace in client.counts. This meant that we didn't get last_read for all channels we opened, and additionally some methods like conversations.members would fail with "channel_not_found" for those channels. This filters the channels from client.userBoot by checking that the channel is in the current sub workspace, if the token we're using is not an org level (for all workspaces the user is in) token. Additionally it raises an error if any of the channels to open isn't included in the response from client.counts to prevent missing last_read for any channels if there are other channels that isn't included. I could have filtered the list of channels to open by the channels included from client.counts, but I don't want any channels to just silently be ignored.
* URL encode cookies if not encodedTrygve Aaberge2024-02-181-2/+2
| | | | | The cookies need to be encoded for the Slack API to accept them, so this makes it work if the config is set with cookies that are not encoded.
* Add command /slack replyTrygve Aaberge2024-02-181-0/+2
|
* Support API restricted workspacesTrygve Aaberge2024-02-181-4/+17
| | | | | | | | | | | | | | | | | | Some enterprise workspaces are restricted in which API methods they can use, so we have to use some of the APIs the official web client uses (which can't be used by OAuth tokens) instead (mainly to initialize the workspace with client.userBoot and client.counts, and to connect to the websocket). This also has the benefit of being more performant, as the API methods the web client uses are more suited for creating a client than the official API methods. I think which API methods are restricted may be configured by the workspace admins, so it may not be the same for different workspaces, but for me it seems to be at least rtm.connect, users.conversations, conversations.list and conversations.members, so these are the ones I've changed to be conditional on the token type.
* Add completion of emoji namesTrygve Aaberge2024-02-181-0/+8
|
* Close IM/MPIM and remove from open_conversations on buffer closeTrygve Aaberge2024-02-181-0/+8
|
* Support editing and deleting messagesTrygve Aaberge2024-02-181-0/+31
|
* Support adding and removing reactionsTrygve Aaberge2024-02-181-0/+25
|
* Support sending messagesTrygve Aaberge2024-02-181-0/+20
|
* Support muted conversations configTrygve Aaberge2024-02-181-0/+9
|
* Reload conversations on reconnectTrygve Aaberge2024-02-181-0/+16
|
* Mark as read when switching away from bufferTrygve Aaberge2024-02-181-1/+25
|
* Split users.info into multiple requests when necessaryTrygve Aaberge2024-02-181-1/+15
| | | | | | If you try to request several thousand users in one request (not sure exactly what the limit is), it just returns HTTP 500, so split it into multiple requests with a max of 1000 users per request.
* Fetch thread replies when receiving thread messageTrygve Aaberge2024-02-181-4/+6
| | | | | | This is done so we can know if we should include a message hash when completing thread hashes, and it also has the benefit of eliminating the loading time when opening thread buffers.
* Fetch replies in conversation when display_thread_replies is onTrygve Aaberge2024-02-181-0/+15
|
* Only take in limit, not pages in api methodsTrygve Aaberge2024-02-181-13/+12
| | | | | | Instead of having to supply both a limit and the number of pages, change it to only take in a limit, and determine the number of pages automatically.
* Fetch usergroups at startup if edgeapi isn't availableTrygve Aaberge2024-02-181-0/+4
|
* Split edgeapi out to separate classTrygve Aaberge2024-02-181-41/+49
| | | | | Since this isn't available for OAuth tokens it's good to have an easy way to see where it's used.
* Fix some mypy specific type issuesTrygve Aaberge2024-02-181-10/+10
|
* Open all conversation types on startTrygve Aaberge2024-02-181-2/+18
|
* Support unfurling usergroup namesTrygve Aaberge2024-02-181-2/+24
|
* Add support for completing nicksTrygve Aaberge2024-02-181-0/+31
| | | | | | | This uses Slacks edgeapi which only works for session tokens, but has the benefit of being able to complete nicks without all users being loaded. So need to add some completion for the loaded users for when using OAuth tokens as well.
* Print error message on http/api errorTrygve Aaberge2024-02-181-31/+69
|
* Send params as post body instead of query paramsTrygve Aaberge2024-02-181-2/+4
|
* Use Iterable instead of List in parametersTrygve Aaberge2024-02-181-3/+3
|
* Fetch multiple users/bots in the same requestTrygve Aaberge2024-02-181-8/+13
| | | | | | | Turns out you can query for multiple users/bots with users.info/bots.info even though it's not documented. Use that to query for multiple users/bots in one request, instead of making tons of requests.
* Change SlackUsers to singular since it only concerns one userTrygve Aaberge2024-02-181-3/+3
|
* Show nick suffix for botsTrygve Aaberge2024-02-181-1/+5
|
* Rename slack_timeout to network_timeoutTrygve Aaberge2024-02-181-1/+1
|
* Call rtm.connect (doesn't connect to web socket yet)Trygve Aaberge2024-02-181-0/+4
|
* Add some todosTrygve Aaberge2024-02-181-1/+1
|
* Add typing for slack conversations historyTrygve Aaberge2024-02-181-2/+5
|
* Add type for users.infoTrygve Aaberge2024-02-181-1/+2
|
* Add typings for users.conversationsTrygve Aaberge2024-02-181-1/+2
|
* Create directory for slack in typingsTrygve Aaberge2024-02-181-2/+2
|
* Create functions for fetch requestsTrygve Aaberge2024-02-181-8/+41
|
* Move SlackApi to a separate fileTrygve Aaberge2024-02-181-0/+48