Skip to content

Using a regex pattern to match an action id handler #1347

@stokedout

Description

@stokedout

I have some code that generates a list of questions, I want the user to click a button that corresponds to the numbered question. To do that I needed a dynamic action pattern @app.action(r"^ask_previous_query_\d+$"). It appears like the SDK supports it but it's not working, i.e. I get:

[2025-08-08 12:20:03] slack_bolt.App WARNING Unhandled request ({'type': 'block_actions', 'block_id': 'pVhre', 'action_id': 'ask_previous_query_145'})
---
[Suggestion] You can handle this type of event with the following listener function:

@app.action("ask_previous_query_145")
def handle_some_action(ack, body, logger):
    ack()
    logger.info(body)

Any suggestions? I've also tried with no joy

@app.action(r"^ask_previous_query_")
@app.action(r"^ask_previous_query")
@app.action("ask_previous_query_")
@app.action("ask_previous_query_*")

Reproducible in:

pip freeze | grep slack
python --version
sw_vers && uname -v # or `ver`

The slack_bolt version

From poetry.lock

[[package]]
name = "slack-bolt"
version = "1.21.2"
description = "The Bolt Framework for Python"
optional = false
python-versions = ">=3.6"
groups = ["main"]
markers = "python_version == \"3.12\" or python_version >= \"3.13\""
files = [
    {file = "slack_bolt-1.21.2-py2.py3-none-any.whl", hash = "sha256:6860fc8693ca543b653c5d49a09b8b542f5fb7a02638342a7ddd18d8bc6f3ba0"},
    {file = "slack_bolt-1.21.2.tar.gz", hash = "sha256:05ac2d454adfddfc629fb63c7a3723bd1432a24373119368bc81f2f52b029cbf"},
]

Python runtime version

3.11.6

OS info

ProductName: macOS
ProductVersion: 15.5
BuildVersion: 24F74
Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:26 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8112

Steps to reproduce:

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

Expected result:

(Tell what you expected to happen)

Actual result:

(Tell what actually happened with logs, screenshots)

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.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions