@@ -101,6 +101,12 @@ <h1 class="title">Module <code>slack_bolt.request.internals</code></h1>
101101
102102
103103def extract_team_id(payload: Dict[str, Any]) -> Optional[str]:
104+ if payload.get("view", {}).get("app_installed_team_id") is not None:
105+ # view_submission payloads can have `view.app_installed_team_id` when a modal view that was opened
106+ # in a different workspace via some operations inside a Slack Connect channel.
107+ # Note that the same for enterprise_id does not exist. When you need to know the enterprise_id as well,
108+ # you have to run some query toward your InstallationStore to know the org where the team_id belongs to.
109+ return payload.get("view")["app_installed_team_id"]
104110 if payload.get("team") is not None:
105111 # With org-wide installations, payload.team in interactivity payloads can be None
106112 # You need to extract either payload.user.team_id or payload.view.team_id as below
@@ -413,6 +419,12 @@ <h2 class="section-title" id="header-functions">Functions</h2>
413419< span > Expand source code</ span >
414420</ summary >
415421< pre > < code class ="python "> def extract_team_id(payload: Dict[str, Any]) -> Optional[str]:
422+ if payload.get("view", {}).get("app_installed_team_id") is not None:
423+ # view_submission payloads can have `view.app_installed_team_id` when a modal view that was opened
424+ # in a different workspace via some operations inside a Slack Connect channel.
425+ # Note that the same for enterprise_id does not exist. When you need to know the enterprise_id as well,
426+ # you have to run some query toward your InstallationStore to know the org where the team_id belongs to.
427+ return payload.get("view")["app_installed_team_id"]
416428 if payload.get("team") is not None:
417429 # With org-wide installations, payload.team in interactivity payloads can be None
418430 # You need to extract either payload.user.team_id or payload.view.team_id as below
0 commit comments