Channel_not_found Error While Sending A Message To Myself
I'm using python3.6 and trying to send message to myself to start interacting in slack.
pip install slackclient and am using slackclient v2.2.1
channel ID is extracted from slack link of my account
I would like to see Hi message in my slack account. any suggestions.
client = slack.WebClient("BOT_USER_TOKEN", timeout=30) client.chat_postMessage( channel='CHANNEL_ID', text='Hi!')```
The bot user token is linked to a bot user that is created with your app. If you use the bot token you will only have access to channels that this bot user is a member of.
So to make your script work you need to do one of the following:
- Use the access token instead of the bot token (that one is linked to the user that installed the Slack app)
- Invite the bot user to the channel you are trying to send a message to
As you want to start with basics, I would recommend to use public channels first, which will always work.
Direct messages are a little bit more complicated. To send a direct message to a user (e.g. from your bot user to yourself) you need to first open a direct message channel with
conversations.open, which will give you a new channel ID. And then use that channel ID for sending a message.
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Django, code inside <script> tag doesn't work in a template
- → React - Django webpack config with dynamic 'output'
- → GAE Python app - Does URL matter for SEO?
- → Put a Rendered Django Template in Json along with some other items
- → session disappears when request is sent from fetch
- → Python Shopify API output formatted datetime string in django template
- → Shopify app: adding a new shipping address via webhook
- → Shopify + Python library: how to create new shipping address
- → shopify python api: how do add new assets to published theme?
- → Access 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT' with Python Shopify Module