Forums

ClientHttpProxyError: 403 [Forbidden] while connecting to slack web client

I have recently signed up for a free account and I am a beginner. This is what my code is trying to do - just posting a hello message via slack webclient

client = slack.WebClient(token=slack_token, proxy="http://proxy.server:3128")
client.chat_postMessage(channel="random",text = "Hello from Python Anywhere")

however when I try to run it throws error pasted below

aiohttp.client_exceptions.ClientHttpProxyError: 403, message='Forbidden', url=URL('http://proxy.server:3128')

I looked in different topics for help, everywhere it suggested about whitelisting issues but i believe api.slack.com is already whitelisted. Please help.

Yes, we have a number of slack.com subdomains whitelisted, so it certainly should work -- but perhaps the API client you're using is trying to access a new one that's not on the whitelist. Is there any indication in the stacktrace that you're getting of which hostname it's trying to connect to?

This is what it is calling "https://slack.com/api/chat.postMessage" On slack website https://api.slack.com/web says that all the urls for different methods are formatted as https://slack.com/api/METHOD_FAMILY.method Right now I am using method chat_postMessage() for first test but would be using more later on. Could you please help me whitelisting all method urls? Thank you !

Whitelist is the list of domains. We do not care about specific endpoints/methods as long as the connection is over http.

Did you find a solution to the issue?

To help with the issue, we need to know the domain that the code is trying to access. If you have that and documentation that shows it's part of the Slack API, then we can add it to the whitelist and the code should start working.

Another possibility is that the Client has not been correctly authenticated so that the 403 is, in fact, coming from the Slack API site.

Please whitelist my https://stadia.com/ website

Send us a link to the API documentation and we'll consider it for the whitelist.

please whitelist highrise.game

Check out this help page for details on how to request an addition to the allowlist.