Skip to content

Commit 9837102

Browse files
committed
Revert "feat: support multiple Slack workspaces via ALLOWED_SLACK_WORKSPACES (#7)"
This reverts commit ca2154a.
1 parent ca2154a commit 9837102

4 files changed

Lines changed: 5 additions & 20 deletions

File tree

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SLACK_BOT_TOKEN="xoxb-your-slack-bot-token"
22
SLACK_SIGNING_SECRET="your-slack-signing-secret"
3-
ALLOWED_SLACK_WORKSPACES="T0123456789,T9876543210"
3+
ALLOWED_SLACK_WORKSPACE="T0123456789"
44
GOOGLE_GENAI_USE_VERTEXAI=TRUE
55
GOOGLE_CLOUD_PROJECT="your-gcp-project"
66
GOOGLE_CLOUD_LOCATION="global"

README.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ llms-full.txt # Extended ADK documentation for LLM context
5050
```bash
5151
cp .env.example .env
5252
# edit .env and set your Slack and Google Cloud credentials
53-
# ALLOWED_SLACK_WORKSPACES is a comma-separated list of Slack team IDs to allow requests from
53+
# ALLOWED_SLACK_WORKSPACE is the Slack team ID to allow requests from
5454
```
5555
3. Run the server
5656
```bash
@@ -88,18 +88,6 @@ The Agent Development Kit includes a built-in web-based Development UI that you
8888
5. Subscribe to bot events: `app_mention`.
8989
6. Invite the bot to channels where you want to use it.
9090

91-
### Getting Slack Workspace (Team) IDs for `ALLOWED_SLACK_WORKSPACES`
92-
To restrict the bot to specific Slack workspaces, set `ALLOWED_SLACK_WORKSPACES` in your `.env` with comma-separated team IDs. You can find your workspace's team ID by:
93-
1. Open your Slack workspace in a browser.
94-
2. The team ID is the `T`-prefixed value in the URL (e.g., `https://app.slack.com/client/T0123456789/...`).
95-
3. Or go to your [Slack App settings](https://api.slack.com/apps), select your app, and find the **Team ID** displayed under **App Credentials** on the **Basic Information** page.
96-
97-
Example:
98-
```
99-
ALLOWED_SLACK_WORKSPACES="T0123456789,T9876543210"
100-
```
101-
If the variable is empty or unset, requests from all workspaces are allowed.
102-
10391
## Deploy to Cloud Run
10492
The repository includes a helper script to build the container and deploy to Cloud Run. Ensure your `.env` contains `SLACK_BOT_TOKEN` and `SLACK_SIGNING_SECRET` before running:
10593

app/main.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
SLACK_BOT_TOKEN = os.environ["SLACK_BOT_TOKEN"]
2525
SLACK_SIGNING_SECRET = os.environ["SLACK_SIGNING_SECRET"]
2626
MODEL_NAME = os.environ.get("MODEL_NAME", "gemini-3.1-pro-preview")
27-
_allowed_ws_raw = os.environ.get("ALLOWED_SLACK_WORKSPACES", "")
28-
ALLOWED_SLACK_WORKSPACES: set[str] = {
29-
w.strip() for w in _allowed_ws_raw.split(",") if w.strip()
30-
}
27+
ALLOWED_SLACK_WORKSPACE = os.environ.get("ALLOWED_SLACK_WORKSPACE")
3128
APP_NAME = os.environ.get("APP_NAME", "slack-bot")
3229

3330
# Initialize Slack Bolt AsyncApp
@@ -275,7 +272,7 @@ async def slack_events(req: Request):
275272
return JSONResponse(content={"challenge": challenge})
276273

277274
team_id = data.get("team_id")
278-
if ALLOWED_SLACK_WORKSPACES and team_id not in ALLOWED_SLACK_WORKSPACES:
275+
if ALLOWED_SLACK_WORKSPACE and team_id != ALLOWED_SLACK_WORKSPACE:
279276
return JSONResponse(status_code=403, content={"error": f"{team_id}:workspace_not_allowed"})
280277
return await handler.handle(req)
281278

scripts/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ SERVICE_URL=$(gcloud run deploy "${SERVICE_NAME}" \
6565
--allow-unauthenticated \
6666
--no-cpu-throttling \
6767
--project "${PROJECT_ID}" \
68-
--set-env-vars "SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN},SLACK_SIGNING_SECRET=${SLACK_SIGNING_SECRET},GOOGLE_GENAI_USE_VERTEXAI=${GOOGLE_GENAI_USE_VERTEXAI},GOOGLE_CLOUD_PROJECT=${PROJECT_ID},GOOGLE_CLOUD_LOCATION=global,ALLOWED_SLACK_WORKSPACES=${ALLOWED_SLACK_WORKSPACES:-},MODEL_NAME=${MODEL_NAME:-gemini-3.1-pro-preview}" \
68+
--set-env-vars "SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN},SLACK_SIGNING_SECRET=${SLACK_SIGNING_SECRET},GOOGLE_GENAI_USE_VERTEXAI=${GOOGLE_GENAI_USE_VERTEXAI},GOOGLE_CLOUD_PROJECT=${PROJECT_ID},GOOGLE_CLOUD_LOCATION=global,ALLOWED_SLACK_WORKSPACE=${ALLOWED_SLACK_WORKSPACE:-},MODEL_NAME=${MODEL_NAME:-gemini-3.1-pro-preview}" \
6969
--format 'value(status.url)')
7070

7171
echo "--------------------------------------------"

0 commit comments

Comments
 (0)