Search code examples
pythonpython-3.xslackpython-decorators

Using custom decorators with Slack Bolt Python SDK


Is it possible to use my own python decorators with the Bolt SDK?

I tried the code below, and it's not working:

@it_platform
@app.command("/help")
def action_help():
    # * Log to Cloudwatch
    logging.info("The user triggered the command /help")

I'm getting the error Unhandled request ({'type': None, 'command': '/help'})

If i remove the decorator @it_platform it works fine.

I also tried putting the decorator @it_platform below the Bolt decorator, but it gives the same error message.

Can someone please help ?


Solution

  • Which slack-sdk version are you using ?

    With the latest sdk version 1.14.3 they've fixed the kwargs issue with custom decorators.

    Maybe you are using an old version