ryanrosello-og/playwright-slack-report

restricted_action error

Piero87 opened this issue ยท 2 comments

Hi,
I have choose Option B so I created an App on slack using your guide (thank you for all the detail), but if I try to use it i recevie this:

[DEBUG] web-api:WebClient:0 initialized
[DEBUG] web-api:WebClient:0 apiCall('chat.postMessage') start
[DEBUG] web-api:WebClient:0 http request url: https://slack.com/api/chat.postMessage
[DEBUG] web-api:WebClient:0 http request body: {"channel":"tt_e2e_results","text":"โœ… 1 โŒ 0 ๐ŸŸก 0 โฉ 0","unfurl_link":true,"blocks":"[{"type":"section","text":{"type":"mrkdwn","text":"๐ŸŽญ Playwright Results"}},{"type":"section","text":{"type":"mrkdwn","text":"โœ… 1 | โŒ 0 | ๐ŸŸก 0 | โฉ 0"}},{"type":"divider"}]"}
[DEBUG] web-api:WebClient:0 http request headers: {}
[DEBUG] web-api:WebClient:0 http response received
[DEBUG] web-api:WebClient:0 http request result: {"ok":false,"error":"restricted_action","response_metadata":{"scopes":["chat:write","chat:write.customize","chat:write.public"],"acceptedScopes":["chat:write"]}}
[
{
"channel": "tt_e2e_results",
"outcome": "โŒ Message not sent to tt_e2e_results \r\n An API error occurred: restricted_action"
}
]

Screenshot 2024-01-10 alle 17 30 29

can you help me?

Can you try sending a simple test message via curl:

curl -X POST https://slack.com/api/chat.postMessage \
-H 'Authorization: Bearer <your_bot_user_token>' \
-H 'Content-type: application/json' \
-d '{"channel": "<channel_id> e.g. C07TZ3DJR5Y", "text": "This is a test message from your bot!"}'

If the message above fails, then I suspect it might have something to do with permission for your workspace, are you able to check the following:

Go to https://[your instance].slack.com/admin/settings#channel_management_restrictions

And review these options:

2024-01-11_19-08-15

You can also try re-install to your Workspace:

2024-01-11_19-12-01
e-install to your Workspace:

Also, can you let you me if are an admin for your workspace?

@ryanrosello-og Thank you for the answer, I find the problem, I initially created the channel on which I was trying to write as private and then made it public, it seems that that slack api don't like this, trying to publish on a new channel created directly as public everything works