slackapi / bolt-python

A framework to build Slack apps using Python
https://slack.dev/bolt-python/
MIT License
1.06k stars 245 forks source link

AsyncApp with OAuth searching for Bot User "UXXXXXXXX" installation when using App Home Messages tab #1024

Closed hanslemm closed 6 months ago

hanslemm commented 8 months ago

I just finished figuring out how to make my Slack App use the OAuth workflow.

I set up it using the f"{my_app_url}/slack/install" endpoint. I am using the standard Bolt OAuth Async class with no custom flow.

The installation store is a custom one that I built using GCS - it has all the methods and attributes as the AWS one. I also checked the store, and it correctly has all the installations at user level, bot level, and installation without user/bot associated.

When sending a message to my bot through the App Home in Slack, messages tab, an error raises stating - correctly - that there is no installation found at f"{workspace_path}/installer-{u_id}-latest", where u_id is the user id, which evaluates to the BOT user ID UXXXXXXXXXX (I removed the alphanumeric to X).

If I exchange messages with my bot app outside the App Home, no error raises - so it is related to the home app, messages tab.

I don't understand why the application is looking for an installation for the Bot user ID, shouldn't the application know that the bot user ID is the bot installation?

Reproducible in:

The slack_bolt version

name : slack-bolt
version : 1.18.1
description : The Bolt Framework for Python

dependencies

Python runtime version

Python 3.11.6

OS info

ProductName: macOS ProductVersion: 14.2.1 BuildVersion: 23C71 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000

Steps to reproduce:

(Share the commands to run, source code, and project settings (e.g., setup.py))

  1. App must be running, of course.
  2. I sent a message to my bot through the App Home in Slack, messages tab.
  3. Raises the above-mentioned error that couldn't find the installation

Expected result:

The app shouldn't raise installation errors when using the messages tab of the App Home in Slack.

Actual result:

Mentioned in the introduction.

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

github-actions[bot] commented 7 months ago

👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.

WilliamBergamin commented 6 months ago

Hi @hanslemm thanks for writing it 💯

Not sure I fully understand your issue, but it seems like you may be trying to retrieve a user_token with a BOT id? if this is the case you should instead use the bot_token provided by the OAuth handshake, there should be one for each workspace/team your application is installed in. You should be able to post a message in a users DM using the bot_token