{"id":26289994,"url":"https://github.com/slack-samples/bolt-python-assistant-template","last_synced_at":"2025-05-07T22:44:27.834Z","repository":{"id":258463514,"uuid":"859761339","full_name":"slack-samples/bolt-python-assistant-template","owner":"slack-samples","description":"A template for building Agents \u0026 Assistants with Bolt for Python","archived":false,"fork":false,"pushed_at":"2024-10-22T02:33:01.000Z","size":34,"stargazers_count":23,"open_issues_count":3,"forks_count":8,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-07T22:44:13.909Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slack-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-19T08:30:16.000Z","updated_at":"2025-04-28T13:46:04.000Z","dependencies_parsed_at":"2024-10-19T05:50:15.827Z","dependency_job_id":"0d0241ec-e694-4fbe-8c47-9e5a252aa448","html_url":"https://github.com/slack-samples/bolt-python-assistant-template","commit_stats":null,"previous_names":["slack-samples/bolt-python-assistant-template"],"tags_count":0,"template":false,"template_full_name":"slack-samples/bolt-python-starter-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-samples%2Fbolt-python-assistant-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-samples%2Fbolt-python-assistant-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-samples%2Fbolt-python-assistant-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-samples%2Fbolt-python-assistant-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slack-samples","download_url":"https://codeload.github.com/slack-samples/bolt-python-assistant-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252967974,"owners_count":21833245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-14T23:17:35.503Z","updated_at":"2025-05-07T22:44:27.810Z","avatar_url":"https://github.com/slack-samples.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# App Agent \u0026 Assistant Template (Bolt for Python)\n\nThis Bolt for Python template demonstrates how to build [Agents \u0026 Assistants](https://api.slack.com/docs/apps/ai) in Slack.\n\n## Setup\nBefore getting started, make sure you have a development workspace where you have permissions to install apps. If you don’t have one setup, go ahead and [create one](https://slack.com/create).\n\n### Developer Program\nJoin the [Slack Developer Program](https://api.slack.com/developer-program) for exclusive access to sandbox environments for building and testing your apps, tooling, and resources created to help you build and grow.\n\n## Installation\n\n#### Create a Slack App\n1. Open [https://api.slack.com/apps/new](https://api.slack.com/apps/new) and choose \"From an app manifest\"\n2. Choose the workspace you want to install the application to\n3. Copy the contents of [manifest.json](./manifest.json) into the text box that says `*Paste your manifest code here*` (within the JSON tab) and click *Next*\n4. Review the configuration and click *Create*\n5. Click *Install to Workspace* and *Allow* on the screen that follows. You'll then be redirected to the App Configuration dashboard.\n\n#### Environment Variables\nBefore you can run the app, you'll need to store some environment variables.\n\n1. Open your app configuration page from this list, click **OAuth \u0026 Permissions** in the left hand menu, then copy the Bot User OAuth Token. You will store this in your environment as `SLACK_BOT_TOKEN`.\n2. Click **Basic Information** from the left hand menu and follow the steps in the App-Level Tokens section to create an app-level token with the `connections:write` scope. Copy this token. You will store this in your environment as `SLACK_APP_TOKEN`.\n\n```zsh\n# Replace with your app token and bot token\n# For Windows OS, env:SLACK_BOT_TOKEN = \u003cyour-bot-token\u003e works\nexport SLACK_BOT_TOKEN=\u003cyour-bot-token\u003e\nexport SLACK_APP_TOKEN=\u003cyour-app-token\u003e\n# This sample uses OpenAI's API by default, but you can switch to any other solution!\nexport OPENAI_API_KEY=\u003cyour-openai-api-key\u003e\n```\n\n### Setup Your Local Project\n```zsh\n# Clone this project onto your machine\ngit clone https://github.com/slack-samples/bolt-python-assistant-template.git\n\n# Change into this project directory\ncd bolt-python-assistant-template\n\n# Setup your python virtual environment\npython3 -m venv .venv\nsource .venv/bin/activate  # for Windows OS, .\\.venv\\Scripts\\Activate instead should work\n\n# Install the dependencies\npip install -r requirements.txt\n\n# Start your local server\npython3 app.py\n```\n\n#### Linting\n```zsh\n# Run flake8 from root directory for linting\nflake8 *.py \u0026\u0026 flake8 listeners/\n\n# Run black from root directory for code formatting\nblack .\n```\n\n## Project Structure\n\n### `manifest.json`\n\n`manifest.json` is a configuration for Slack apps. With a manifest, you can create an app with a pre-defined configuration, or adjust the configuration of an existing app.\n\n### `app.py`\n\n`app.py` is the entry point for the application and is the file you'll run to start the server. This project aims to keep this file as thin as possible, primarily using it as a way to route inbound requests.\n\n### `/listeners`\n\nEvery incoming request is routed to a \"listener\". Inside this directory, we group each listener based on the Slack Platform feature used, so `/listeners/events` handles incoming events, `/listeners/shortcuts` would handle incoming [Shortcuts](https://api.slack.com/interactivity/shortcuts) requests, and so on.\n\n## App Distribution / OAuth\n\nOnly implement OAuth if you plan to distribute your application across multiple workspaces. A separate `app_oauth.py` file can be found with relevant OAuth settings.\n\nWhen using OAuth, Slack requires a public URL where it can send requests. In this template app, we've used [`ngrok`](https://ngrok.com/download). Checkout [this guide](https://ngrok.com/docs#getting-started-expose) for setting it up.\n\nStart `ngrok` to access the app on an external network and create a redirect URL for OAuth. \n\n```\nngrok http 3000\n```\n\nThis output should include a forwarding address for `http` and `https` (we'll use `https`). It should look something like the following:\n\n```\nForwarding   https://3cb89939.ngrok.io -\u003e http://localhost:3000\n```\n\nNavigate to **OAuth \u0026 Permissions** in your app configuration and click **Add a Redirect URL**. The redirect URL should be set to your `ngrok` forwarding address with the `slack/oauth_redirect` path appended. For example:\n\n```\nhttps://3cb89939.ngrok.io/slack/oauth_redirect\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslack-samples%2Fbolt-python-assistant-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslack-samples%2Fbolt-python-assistant-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslack-samples%2Fbolt-python-assistant-template/lists"}