I create an app then click "install to workspace". I select the channel. [![enter image description here][1]][1]
I generate app level token
[![enter image description here][2]][2]
Then I use according command
curl https://slack.com/api/conversations.list -H "Authorization: Bearer xapp-1-A0xxx"
It returns
{"ok":false,"error":"not_allowed_token_type"}
How can I fix? How can I send message to channel or user? [1]: https://i.stack.imgur.com/sA5aM.png [2]: https://i.stack.imgur.com/Zy8oz.png
CodePudding user response:
You are using the wrong Bearer Token. You should be using the bot token (xoxb). The token you are currently using is for Socket Mode usage exclusively. Make sure you have the correct scopes for the conversations.list
method and after your app is installed you should see the Bot Token in the OAuth & Permissions page.
CodePudding user response:
You should use the OAuth Tokens
. Check in the left menu "Install app" tab. It should start with "xoxb"
curl -d "text=Hi." -d "channel=general" -H "Authorization: Bearer $token" -X POST https://slack.com/api/chat.postMessage
You could check using this website: