Reivax
Reivax

Reputation: 33

How to grab list of custom slack slash commands using Python?

Currently what is on my mind is 2 methods:

1) Go to the slash command app webpage and scrape the HTML

2) Use one of the slack API commands to query for it

Currently where I am stuck:

1) The HTML codes produced when I am logged on using Chrome vs when I authenticate using tester token via Python is different. Hence, when I use Python (requests and lxml libraries), the resulting HTML codes do not contain the slash command details.

2) I have navigated through the Slack API commands, but it mostly revolves around sending messages, bots, etc. I couldn't find an API command that is able to retrieve the slash commands list and the details (e.g. description, permissions, etc.)

Upvotes: 2

Views: 657

Answers (1)

Erik Kalkoken
Erik Kalkoken

Reputation: 32864

We have now found an undocumented API method that returns the list of all slash commands (build-in and custom) from a workspace.

Syntax: https://slack.com/api/commands.list?token=YOUR-TOKEN

Note that you need a legacy token for this method to work.

You can find a full documentation of this method here.

Upvotes: 0

Related Questions