Reputation: 2472
I have a command line tool that needs to send messages to Slack and would like something similar to GitHub's personal access tokens, where a username and password are sent and a token is returned that the client can use to perform actions as that user. Is something like this possible without secret token used for apps/bots?
Upvotes: 1
Views: 1034
Reputation: 32827
The Slack API only offers authentication via OAuth 2.0 flow, not via username/password.
However, depending on your use case there might be alternative solutions:
You only need to go through the OAuth 2.0 flow once to get your access token, which then states valid forever. So it may be worth implementing a small sign-in script to get it for you.
If you have control over the Slack workspace you can get the OAuth token directly from Slack's "Your apps" management page. No need to implement anything. Its called internal integrations.
If you only need to send messages you don't need to use Slack's API at all. Instead you can use an incoming webhook, which can be invoked with a simple curl command.
Upvotes: 2