template-announcement-approvals icon indicating copy to clipboard operation
template-announcement-approvals copied to clipboard

Message can't be posted as bot

Open TheSquad opened this issue 5 years ago • 14 comments

Hi,

I'm having trouble to send a message on a Channel. Heres my request:

curl -X POST \
  https://slack.com/api/chat.postMessage \
  -H 'Authorization: Bearer xoxp-********' \
  -H 'Content-Type: application/json' \
  -d '{
	"channel": "mychannel",
	"text": "this is my message",
	"as_user": false
}'

And this is the response I get :

{
    "ok": false,
    "error": "missing_scope",
    "needed": "chat:write:bot",
    "provided": "identify,bot,incoming-webhook,channels:read,channels:write,chat:write",
    "warning": "missing_charset",
    "response_metadata": {
        "warnings": [
            "missing_charset"
        ]
    }
}

As you can see, it asks for chat:write:bot scope, while I have the chat:write In the documentation it is stated :

For new Slack apps, chat:write replaces both chat:write:user and chat:write:bot. Here's a bit more detail on why perspectival scopes are disappearing.

And there is no way to add the scope chat:write:bot (scope not found in the list)

Does anyone can help ?

TheSquad avatar Dec 11 '19 16:12 TheSquad

same response when I try my xoxb-* token

{
    "ok": false,
    "error": "missing_scope",
    "needed": "chat:write:bot",
    "provided": "calls:read,calls:write,channels:manage,channels:read,chat:write,dnd:read,emails:write,files:read,groups:read,im:history,im:read,im:write,incoming-webhook,mpim:history,mpim:read,mpim:write,pins:write,reactions:read,reactions:write,remote_files:read,remote_files:share,remote_files:write,team:read,users:read,users:read.email,users:write",
    "warning": "missing_charset",
    "response_metadata": {
        "warnings": [
            "missing_charset"
        ]
    }
}

TheSquad avatar Dec 11 '19 16:12 TheSquad

I'm not 100% sure this is the right place, but I am also experiencing this issue.

pkmnfrk avatar Dec 18 '19 18:12 pkmnfrk

Has anyone found a solution? The oAuth scopes don't let me add "chat:write:bot". I suspect they've broken something.

RickMeasham avatar Dec 26 '19 00:12 RickMeasham

Slack Support team have responded quickly!

You can no longer set as_user to false. They've raised a bug report to fix the error that's returned.

RickMeasham avatar Dec 26 '19 03:12 RickMeasham

Facing the same issue, couldn't find chat:write:bot in scopes

nrvmodi avatar Aug 17 '20 07:08 nrvmodi

encountering the same issue for a slack-based bot.

johntotten avatar Aug 22 '20 19:08 johntotten

@johntotten please check this answer https://stackoverflow.com/a/63446845/1294870 and please give up vote if it resolved

nrvmodi avatar Aug 24 '20 04:08 nrvmodi

I tried this template today and it's working. You can probably close the issue now @TheSquad

leslie-alldridge avatar Oct 05 '20 18:10 leslie-alldridge

you need to make sure that your slackbot has proper permissions set. Check and see if your bot has the ability to "chat:write:bot".

azetaa avatar Mar 02 '21 21:03 azetaa

you need to make sure that your slackbot has proper permissions set. Check and see if your bot has the ability to "chat:write:bot".

I think that's the problem. that there is no way to set that particular scope.

mudsahni avatar May 23 '21 09:05 mudsahni

For anyone who might encounter this problem in the future - make sure that you're using the bot token, not the user one.

nazywamsiepawel avatar Jul 18 '21 15:07 nazywamsiepawel

I was facing the same issue: Response: {'ok': False, 'error': 'missing_scope', 'needed': 'chat:write:bot', 'provided': 'incoming-webhook,calls:write'}

After some digging on community forums, It seems like "chat:write:bot" is not accessible from the Bot User scopes in the Slack console. Adding the scope "chat:write.customize" solved the problem for me.

bschaatsbergen avatar Oct 10 '21 11:10 bschaatsbergen

I am having similar issue where I can post a message, but can't update the message I just sent. Even with chat:write and chat:write.customize permissions.

I have open a support ticket.


Answer: I am using a library that use conversation.list if channel provided is a channel name. I was missing channel:read scope.

benoittgt avatar Mar 30 '23 09:03 benoittgt

Has anyone fixed this issue? I've tried several things that I've read here but nothing works. In my case:

[DEBUG]  web-api:WebClient:1 http request result: {"ok":false,"error":"missing_scope","needed":"connections:write","provided":"app_configurations:write","response_metadata":{"scopes":["app_configurations:write"]}}

lemonpeu avatar May 19 '24 18:05 lemonpeu