os / slacker

Full-featured Python interface for the Slack API
Apache License 2.0
1.6k stars 245 forks source link

Slack Token? Webhook URL? #138

Closed caliph007 closed 5 years ago

caliph007 commented 6 years ago

I am trying to setup and cannot see any token generation for channels on slack.

It seems slack has a Webhook URL.

And I see legacy tokens, that are to be depreciated. And slack discourages from using it.

What token is necessary for slacker?

talaniz commented 6 years ago

This section details webhook urls-- https://api.slack.com/incoming-webhooks. This section covers the different token types-- https://api.slack.com/docs/token-types. It looks like the token you use depends on how you want to interact with Slack.

From the Slack docs--

According to issue #91 I can see a proposed usage was the following--

slack = Slacker('<token>', incoming_webhook_url='<response_url>')
slack.incomingwebhook.post({"text": "It's 80 degrees right now."})

Based on this, I would say that you will most likely want either a user, bot or workspace token as legacy is discouraged (as noted) and verification validates requests from Slack. Based on what I see in the code, it looks like you wouldn't be required to use one as both examples provided don't use them (though an example may be worthwhile). Here's line 14/15 from list.py--

token = os.environ['SLACK_TOKEN']
slack = Slacker(token)
os commented 5 years ago

Thanks, @talaniz!