I have successfully added an application in slack api with the permission scope set administer the teams:
I have generated the token from Legacy token generator And I am making a api call with the following information from postman.
endpoint: https://slack.com/api/users.list
method:GET
Headers:
key=token
value=token generated
Its returning me the following Response
{
"ok": false,
"error": "not_authed"
}
Trying the same things with curl is working but with POST method and does not works on GET method
curl -X POST https://slack.com/api/users.list --data "token=codehere"
Where exactly am I going wrong.
Authenticate your Web API requests by providing a bearer token, which identifies a single user, bot user, or workspace-application relationship. Register your application with Slack to obtain credentials for use with our OAuth 2.0 implementation, which allows you to negotiate tokens on behalf of users and workspaces.
Visit the App Directory at my.slack.com/apps/manage on your desktop. Click Edit configuration next to the integration. On the configuration page, click Regenerate below the current token. This is the new token you can use anywhere you need it.
There are two ways for your app to integrate with Slack so that users can initiate and deal with Calls within Slack. One way for a user to initiate your app is via a Slash command—for example, by typing /mycallapp into the message composer. The other way for a user to initiate your app is directly via the Call icon.
Bot tokens represent a bot associated with the app installed in a workspace. Unlike user tokens, they're not tied to a user's identity; they're just tied to your app. Since acting independently allows your app to stay installed even when an installing user is deactivated, using bot tokens is usually for the best.
It works with GET too, but you have to pass the properties as URL parameter, not in the header.
Here is an example for the syntax:
https://slack.com/api/users.list?token=YOURTOKEN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With