Slack-Python-Onboarding-Tutorial icon indicating copy to clipboard operation
Slack-Python-Onboarding-Tutorial copied to clipboard

problems getting started

Open transfluxus opened this issue 8 years ago • 3 comments

hi,

after my first trial 'converting' my already existing slack app using this tutorial I tried to test it by adding another condition to the _event_handler function: ... so when I message the bot, I want it to respond.

    elif event_type == 'message':
        user_id = slack_event['event']['user']
        print user_id, team_id
        pyBot.onboarding_message(team_id, user_id)
        return make_response("Welcome Message Sent", 200, )

However everything always ends at the bot.open_dm function. the call new_dm = self.client.api_call("im.open", user=user_id) returns {"ok": false, "error": "not_authed"}

I'm not sure what I am missing...

transfluxus avatar Mar 11 '17 15:03 transfluxus

other then that. thanks for the great Tutorial! :)

transfluxus avatar Mar 11 '17 20:03 transfluxus

Hey, any solution to this?

neerjad avatar Apr 19 '18 01:04 neerjad

Had the same issue, this is what helped me: Change bot.py line 37 from: self.client = SlackClient("") to: self.client = SlackClient(os.environ["SLACK_API_TOKEN"]) And export SLACK_API_TOKEN with the app's Bot User OAuth Access Token found at OAuth & Permissions of your app. I got the idea from here: https://github.com/slackapi/python-slackclient#sending-a-message.

Update: This issue is addressed in PR#18

felixsilberstein avatar Jan 09 '19 21:01 felixsilberstein