Skip to content

How to find the SLACK_BOT_TOKEN of Slack Desktop App for Windows  #907

@mydockergit

Description

@mydockergit

I have the Slack Desktop client installed on my computer.
I want to be able to use the SDK to send messages.
I read the instructions in your README file but according to the simple example:

import os
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError

client = WebClient(token=os.environ['SLACK_BOT_TOKEN'])

try:
    response = client.chat_postMessage(channel='#random', text="Hello world!")
    assert response["message"]["text"] == "Hello world!"
except SlackApiError as e:
    # You will get a SlackApiError if "ok" is False
    assert e.response["ok"] is False
    assert e.response["error"]  # str like 'invalid_auth', 'channel_not_found'
    print(f"Got an error: {e.response['error']}")

I need to use SLACK_BOT_TOKEN and I don't have it. You wrote that I can read about Tokens and Authentication from this Auth Guide but the link is broken: https://slack.dev/python-slack-sdk/auth.html

I am running on Windows and I am using the Slack Desktop App for Windows and I didn't find the place I can get the token.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Version: 3xdocsM-T: Documentation work onlyoauthquestionM-T: User needs support to use the project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions