slackapi / slackapi/bolt-python

Add support for "sub apps"

Open
#320 8 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triage-skip discussion
Dominant language
Python
Stars
1.3k
Forks
288
Avg merge
1d 8h
Merged PRs (30d)
10

Description

When creating a large slack application it would be nice to be able to reuse components in a more pythonic way than what is possible right now.
A workaround is described in issue #236, but it requires passing the app object around and manually wiring up things by registering and calling decorators as functions directly.

I suggest adding a feature much like include_router in FastAPI or add_typer in Typer.

This feature will let us create sub-apps in separate files or even separate packages, like plugins that can be published on pypi.org separately.

Here is a small example illustrating what I mean:

main.py

Here is our main app, where we add a plugin from a separate package

import os
from slack_bolt import App

from my_plugin import my_plugin


# Initializes your app with your bot token and signing secret
app = App(
    token=os.environ.get("SLACK_BOT_TOKEN"),
    signing_secret=os.environ.get("SLACK_SIGNING_SECRET")
)
app.add_app(my_plugin)
my_plugin.py

A simple plugin that just creates a slack_bolt app, but without any config

from slack_bolt import App


my_plugin = App()

@my_plugin.message("hello")
def message_hello(message, say):
    say("Hello world")
Category
  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Others

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the slack_bolt.App and slack_bolt.async_app.AsyncApp composition APIs, then read the workaround described in issue #236. Compare the requested add_app behavior with FastAPI's include_router and Typer's add_typer. The work is done when independently defined sub-apps or plugins can be attached to both app variants without manually passing the parent app or invoking decorators directly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.