Perpetual Script to intercept incoming slash commands from a Slack App
1
from slack_bolt import App
2
from slack_bolt.adapter.socket_mode import SocketModeHandler
3
4
5
def main(
6
app_token: str,
7
bot_token: str,
8
handler_path: str,
9
command: str,
10
):
11
app = App(token=bot_token)
12
13
@app.command(command)
14
def launch_flow(ack, body):
15
ack()
16
wmill.run_flow_async(
17
path=handler_path,
18
args={"command_body": body},
19
)
20
21
SocketModeHandler(app, app_token).start()
22