Hi guys! Those of you, who work with Slack, sure know about PSSlack – a module to work with our beloved messaging system via the official API. That API (and the module) has a tiiiiiny downside: it requires you to add a new app to your workspace in order to get an API token.
And sometimes this new app must be approved by your workspace administrators. But what if you cannot get their approval? Well, I have something for you: SlackWeb, a new module to communicate with Slack from PowerShell which does NOT need any new apps added to the workspace.
This module uses the web-API: this API is primarily used by the official web-client and you know what’s neat? You already have a token for it!
Look at requests the web-client sends and you should see that it makes calls to different API endpoints. In those calls you’ll see a token starting with “xoxc-” – that’s your web-token.
But the web-token won’t work if you try to use it with regular API calls – it needs a counterpart: specifically, one of your cookies – a “d-cookie”.
If you switch to the “Headers” tab of an API request and look closely into the “cookie” section on this tab, you should find a cookie called just “d”. It has some super-long value and you need to save this value to use later along with your web-token.
When you load the module, first thing it does is to ask you for the values of the token and the cookie. Feed them to it and that’s pretty much what you need to start using the module – your team ID/URL are detected automatically.
Not so many features are available right now – I just start with this module. Currently, I cared mostly about messages export.
If you find that the module lack a feature you need, please let me know here or in issues on GitHub and I’ll try to integrate it.
Grab the module from the PowerShell Gallery right now! Just be aware, that it uses reverse-engineered API calls and might stop working any moment – please use on your own risk.