A Python framework to build Slack apps in a flash with the latest platform features.

Overview

Bolt Bolt logo for Python

Python Version pypi package Build Status Codecov

A Python framework to build Slack apps in a flash with the latest platform features. Read the getting started guide and look at our code examples to learn how to build apps using Bolt. The Python module documents are available here.

Setup

# Python 3.6+ required
python -m venv .venv
source .venv/bin/activate

pip install -U pip
pip install slack_bolt

Creating an app

Create a Bolt for Python app by calling a constructor, which is a top-level export. If you'd prefer, you can create an async app.

import logging
logging.basicConfig(level=logging.DEBUG)

from slack_bolt import App

# export SLACK_SIGNING_SECRET=***
# export SLACK_BOT_TOKEN=xoxb-***
app = App()

# Add functionality here

if __name__ == "__main__":
    app.start(3000)  # POST http://localhost:3000/slack/events

Running an app

export SLACK_SIGNING_SECRET=***
export SLACK_BOT_TOKEN=xoxb-***
python app.py

# in another terminal
ngrok http 3000

Running a Socket Mode app

If you use Socket Mode for running your app, SocketModeHandler is available for it.

import os
from slack_bolt import App
from slack_bolt.adapter.socket_mode import SocketModeHandler

# Install the Slack app and get xoxb- token in advance
app = App(token=os.environ["SLACK_BOT_TOKEN"])

# Add functionality here

if __name__ == "__main__":
    # Create an app-level token with connections:write scope
    handler = SocketModeHandler(app, os.environ["SLACK_APP_TOKEN"])
    handler.start()

Run the app this way:

export SLACK_APP_TOKEN=xapp-***
export SLACK_BOT_TOKEN=xoxb-***
python app.py

# SLACK_SIGNING_SECRET is not required
# Running ngrok is not required

Listening for events

Apps typically react to a collection of incoming events, which can correspond to Events API events, actions, shortcuts, slash commands or options requests. For each type of request, there's a method to build a listener function.

# Listen for an event from the Events API
app.event(event_type)(fn)

# Convenience method to listen to only `message` events using a string or re.Pattern
app.message([pattern ,])(fn)

# Listen for an action from a Block Kit element (buttons, select menus, date pickers, etc)
app.action(action_id)(fn)

# Listen for dialog submissions
app.action({"callback_id": callbackId})(fn)

# Listen for a global or message shortcuts
app.shortcut(callback_id)(fn)

# Listen for slash commands
app.command(command_name)(fn)

# Listen for view_submission modal events
app.view(callback_id)(fn)

# Listen for options requests (from select menus with an external data source)
app.options(action_id)(fn)

The recommended way to use these methods are decorators:

@app.event(event_type)
def handle_event(event):
    pass

Making things happen

Most of the app's functionality will be inside listener functions (the fn parameters above). These functions are called with a set of arguments, each of which can be used in any order. If you'd like to access arguments off of a single object, you can use args, an slack_bolt.kwargs_injection.Args instance that contains all available arguments for that event.

Argument Description
body Dictionary that contains the entire body of the request (superset of payload). Some accessory data is only available outside of the payload (such as trigger_id and authorizations).
payload Contents of the incoming event. The payload structure depends on the listener. For example, for an Events API event, payload will be the event type structure. For a block action, it will be the action from within the actions list. The payload dictionary is also accessible via the alias corresponding to the listener (message, event, action, shortcut, view, command, or options). For example, if you were building a message() listener, you could use the payload and message arguments interchangably. An easy way to understand what's in a payload is to log it.
context Event context. This dictionary contains data about the event and app, such as the botId. Middleware can add additional context before the event is passed to listeners.
ack Function that must be called to acknowledge that your app received the incoming event. ack exists for all actions, shortcuts, view submissions, slash command and options requests. ack returns a promise that resolves when complete. Read more in Acknowledging events.
respond Utility function that responds to incoming events if it contains a response_url (shortcuts, actions, and slash commands).
say Utility function to send a message to the channel associated with the incoming event. This argument is only available when the listener is triggered for events that contain a channel_id (the most common being message events). say accepts simple strings (for plain-text messages) and dictionaries (for messages containing blocks).
client Web API client that uses the token associated with the event. For single-workspace installations, the token is provided to the constructor. For multi-workspace installations, the token is returned by using the OAuth library, or manually using the authorize function.
logger The built-in logging.Logger instance you can use in middleware/listeners.

Creating an async app

If you'd prefer to build your app with asyncio, you can import the AIOHTTP library and call the AsyncApp constructor. Within async apps, you can use the async/await pattern.

# Python 3.6+ required
python -m venv .venv
source .venv/bin/activate

pip install -U pip
# aiohttp is required
pip install slack_bolt aiohttp

In async apps, all middleware/listeners must be async functions. When calling utility methods (like ack and say) within these functions, it's required to use the await keyword.

!") if __name__ == "__main__": app.start(3000) ">
# Import the async app instead of the regular one
from slack_bolt.async_app import AsyncApp

app = AsyncApp()

@app.event("app_mention")
async def event_test(body, say, logger):
    logger.info(body)
    await say("What's up?")

@app.command("/hello-bolt-python")
async def command(ack, body, respond):
    await ack()
    await respond(f"Hi <@{body['user_id']}>!")

if __name__ == "__main__":
    app.start(3000)

If you want to use another async Web framework (e.g., Sanic, FastAPI, Starlette), take a look at the built-in adapters and their examples.

Getting Help

The documentation has more information on basic and advanced concepts for Bolt for Python. Also, all the Python module documents of this library are available here.

If you otherwise get stuck, we're here to help. The following are the best ways to get assistance working through your issue:

  • Issue Tracker for questions, bug reports, feature requests, and general discussion related to Bolt for Python. Try searching for an existing issue before creating a new one.
  • Email our developer support team: [email protected]
Issues
  • Make cookies extraction on AWS Lambda compatible with its format v1.0

    Make cookies extraction on AWS Lambda compatible with its format v1.0

    I tried to deploy a slack bolt application on AWS Lambda with SQLAlchemy. In the process of the verification of oauth redirect, the app could not be installed properly. I found that the slack request handler could not extract cookie from the lambda event. So, I modified the to_bolt_request to meet the format of the lambda event.

    enhancement area:adapter 
    opened by tattee 14
  • Re: External Data Selection in Select Menu

    Re: External Data Selection in Select Menu

    I posted an issue: https://github.com/slackapi/bolt-python/issues/336 where I'm unable to access external data from different blocks within the same form.

    Is there a workaround to this? I think there must be some way to use the action block (we're able to access the input data from the first block here) to somehow update the view with a list of options for the next block? A solution similar to this is mentioned here but some input here would be helpful.

    Thank you!

    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.

    question 
    opened by mariebarrramsey 14
  • Shortcut modal does not close after submit

    Shortcut modal does not close after submit

    Hi,

    I developed a shortcut but after submitting by submit button, the modal is not closed.

    After the submit, several validations are carried out and a message is sent to the user, but I want the modal to be closed and these processes to be in the background, as it consumes a lot of time and there is no need for the user to wait.

    In the documentation it asks to be done this way:

    # Handle a view_submission request
    @app.view("view_1")
    def handle_submission(ack, body, client, view, logger):
        # Assume there's an input block with `input_c` as the block_id and `dreamy_input`
        hopes_and_dreams = view["state"]["values"]["input_c"]["dreamy_input"]
        user = body["user"]["id"]
        # Validate the inputs
        errors = {}
        if hopes_and_dreams is not None and len(hopes_and_dreams) <= 5:
            errors["input_c"] = "The value must be longer than 5 characters"
        if len(errors) > 0:
            ack(response_action="errors", errors=errors)
            return
        # Acknowledge the view_submission request and close the modal
        ack()
        # Do whatever you want with the input data - here we're saving it to a DB
        # then sending the user a verification of their submission
    
        # Message to send user
        msg = ""
        try:
            # Save to DB
            msg = f"Your submission of {hopes_and_dreams} was successful"
        except Exception as e:
            # Handle error
            msg = "There was an error with your submission"
    
        # Message the user
        try:
            client.chat_postMessage(channel=user, text=msg)
        except e:
            logger.exception(f"Failed to post a message {e}")
    

    I did it this way:

    @app.view("aws_access_request")
        def handle_view_events(ack, body, client, view):
            # Assume there's an input block with `input_c` as the block_id and `dreamy_input`
            awsname = view["state"]["values"]["input_aws_select"]["aws_access_select"]["selected_option"]["value"]
            awsrole = view["state"]["values"]["input_aws_role_select"]["aws_access_role_select"]["selected_option"]["value"]
            managermail = view["state"]["values"]["input_aws_access_manager"]["aws_access_manager"]["value"]
            squad = view["state"]["values"]["input_aws_access_squad"]["aws_access_squad"]["value"]
            reason = view["state"]["values"]["input_aws_access_reason"]["aws_access_reason"]["value"]
    
            senderid = body["user"]["id"]
            senderobj = client.users_profile_get(user=senderid)
            sendermail = senderobj["profile"]["email"]
            sendermention = f"<@{senderid}>"
            sendername = senderobj["profile"]["display_name"]
    
            # Validate inputs
            errors = {}
            mincaracter = 25
    
            inputs = {...}
    
            if reason is not None and len(reason) <= mincaracter:
                errors["input_aws_access_reason"] = f"The value must be longer than {mincaracter} characters"
            elif awsname == "nothing":
                errors["input_aws_select"] = "Please select valid option"
    
            if len(errors) > 0:
                ack(response_action="errors", errors=errors)
                return
    
            # Acknowledge the view_submission request and close the modal
            ack()
    
            checkinputname = Ot.check_inputs(inputs, INPUT_AWS_NAME)
            checkinputmanager = Ot.check_inputs(inputs, INPUT_MANAGER_MAIL)
    
            # Caso o usuário não tenha informado corretamente o Acesso/Gestor, não envia a solicitação
            if not checkinputname or not checkinputmanager:...
            else...
    

    After ack() "Acknowledge the view_submission request and close the modal" It is not closing the modal and continues running the code below.

    The problem is that the code below ack() takes about 10 seconds to run, so this error appears: image

    As I said, I wanted the form to close immediately after ack() and not wait for all the code to run to close.

    question need info 
    opened by BSouzaDock 13
  • Questions on how to run a bolt-python app on AWS Lambda

    Questions on how to run a bolt-python app on AWS Lambda

    (Describe your issue and goal here)

    Using FastAPI with bolt-python

    Question 1.

    1. Within app.message("xxx") listener, I am sending 3 API requests to receive some status
    2. Using the responses, I am sending combined summary into slack channel with Say().

    image

    1. For ReadTimeOut Error Exception, it sends error message fine
    2. But When other exceptions (e.g) TypeError) is catched, say() function spits below exception message Traceback (most recent call last): File "/opt/anaconda3/envs/slack-lambda-api/lib/python3.9/site-packages/slack_bolt/listener/asyncio_runner.py", line 67, in run returned_value = await listener.run_ack_function( File "/opt/anaconda3/envs/slack-lambda-api/lib/python3.9/site-packages/slack_bolt/listener/async_listener.py", line 120, in run_ack_function return await self.ack_function( File "/Users/xxx/Workspace/slack-lambda-api/app/slack/handler/messages.py", line 40, in message_status await say( TypeError: __call__() got multiple values for argument 'text'
    • Above Exception was catched on my local environment where I deliberately turned off API Server

    Question2 (perhaps related to above error).

    1. In production, I am deploying bolt-python in AWS Lambda
    2. I am trying to use lazy listener to bypass 3 seconds limit on slack api, I moved above listener logic to lazy parameter then used respond_to_slack_within_3_seconds() to ack() as written in documentation. (as below)

    image image image

    1. When I test in local above seems to work fine, but when deployed to AWS Lambda (using Mangum handler), it gives following errors ( same error as Question 1) image

    Thank you in advance!!

    The slack_bolt version

    slack-bolt==1.11.1 slack-sdk==3.13.0

    Python runtime version

    Python 3.9.7

    OS info

    ProductName: macOS ProductVersion: 12.0.1 BuildVersion: 21A559 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101

    Expected result:

    • Regarding Question 1, it should send message instead of exception
    • Regarding Question 2, lazy function should be executed followed by ack function but only ack is run in AWS Lambda

    Actual result:

    (Included in descriptions)

    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.

    question area:async 
    opened by imageschool 12
  • Scope and Permissions to install Application under oAuth in Django Example

    Scope and Permissions to install Application under oAuth in Django Example

    (Describe your issue and goal here)

    Reproducible in:

    The slack_bolt version

    django-slack-app==1.0.40 django-slack-oauth==1.5.0 slack-bolt==1.5.0 slack-sdk==3.5.1 slackclient==2.9.3

    Python runtime version

    Python 3.8.2

    OS info

    ProductName: macOS ProductVersion: 11.1 BuildVersion: 20C69 Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101

    Steps to reproduce:

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

    python manage.py runserver

    Expected result:

    I expect the app to install with the requested scope & permissions and are set in the Slack App settings in: https://api.slack.com/apps/

    Actual result:

    It tells me that there are no redirect URL and scopes set... Screenshot 2021-05-05 at 20 54 34

    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.

    docs area:adapter area:examples 
    opened by ManuelBuri 12
  • "Operation Timeout Error" on first load for AWS Lambda with SSM

    I am experiencing an issue when running slack bolt on AWS Lambda, specifically the module does not load fast enough for the ack() to be sent before 3 seconds on first load. Whenever the loaded modules are no longer cached, this issue happens again. We moved to slack bolt from a previous method where we had an SQS queue -> Lambda -> Lambda where the first lambda would return a 200 and the second would do the actual processing because slack bolt promises to be more simple and feature rich. We have some special wrapping to support creating a Class wrapper around the app to prevent issues with caching global variables in Lambda as well as support for a single entrypoint /command from which a subcommand can be supplied with arguments in order to support more dynamic additions of commands to the bot without needing to create extra /commands on api.slack.com.

    My main question is: Are we using this module incorrectly or is there some sort of tuning we can preform to eliminate this error?

    Reproducible in:

    MCVE

    def supply_self(func, this):
        """
        Adapts from a three argument function to a two argument function
        :param func: the function to supply self to
        :param this: renamed self to prevent conflicts with how bolt wires its functions
        :return: a function which can be called by bolt
        """
        return lambda respond, body: func(this, respond, body)
    
    class BasicBot:
        """
        Instead of making app global (which could cause caching issues), we want to make it a field of an object we can create
        """
    
        def __init__(self, entrypoint_name: str, *args):
            self.app = slack_bolt.App(process_before_response=True,
                                      signing_secret=SSMParameter(os.environ["SIGNING_SECRET_LOCATION"], max_age=3600).value,
                                      token=SSMParameter(os.environ["SLACK_API_LOCATION"], 3600).value)
            self.app.command(entrypoint_name)(ack=lambda body, ack: ack(),
                                                      # unable to call self.func here because slack bolt assumes
                                                      # procedural code, by supplying self as a different argument we can
                                                      # circumvent this
                                                      lazy=[supply_self(func, self)])
            # the above `func` comes from a decorated method within the class
            # ...
    
    def lambda_handler(event, context):
        aws_lambda_logging.setup(aws_request_id=context.aws_request_id, level="INFO")
        logging.info(event)
        bot = BasicBot(os.environ["COMMAND_ENTRYPOINT"])
        return SlackRequestHandler(app=bot.app).handle(event, context)
    

    The slack_bolt version

    Latest version

    Python runtime version

    3.8

    OS info

    AWS Lambda's python environment

    Steps to reproduce:

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

    1. Deploy Labmda
    2. call /entrypoint with some say()
    3. observe operation timeout
    4. observe say() message being sent
    5. call /entrypoint again
    6. observe no timeout

    Expected result:

    No "Operation Timeout Error" on first call

    Actual result:

    Timeout when module is not cached then no timeout when Lambda caches it. Message is sent in both cases but the first degrades user experience.

    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.

    question area:adapter 
    opened by RyanSchaefer 12
  • Messages are received four times

    Messages are received four times

    Hello,

    I have a similar error I had with the regular slack client : cf issue.

    I switched to bolt in order to solve this issue and it was working for a couple of days but now I received the same message three to four times each time.

    When I look at the logs, I have this for the same message:

    {'client_msg_id': '59c755aa-80cf-4a77-8852-6073f776ca07', 'type': 'message', 'text': 'HPSM,.', 'user': 'U7PDK2W1J', 'ts': '1599757663.004700', 'team': 'T7P9RQX35', 'blocks': [{'type': 'rich_text', 'block_id': 'YhMu', 'elements': [{'type': 'rich_text_section', 'elements': [{'type': 'text', 'text': 'MESSAGE'}]}]}], 'channel': 'D8X4RT3PW', 'event_ts': '1599757663.004700', 'channel_type': 'im'}
    
    {'client_msg_id': 'eece3ee7-2dab-4585-8bef-6be776645e80', 'type': 'message', 'text': 'HPSM,.', 'user': 'U7PDK2W1J', 'ts': '1599757626.004100', 'team': 'T7P9RQX35', 'blocks': [{'type': 'rich_text', 'block_id': 'oH4=p', 'elements': [{'type': 'rich_text_section', 'elements': [{'type': 'text', 'text': 'HPSM,.'}]}]}], 'channel': 'D8X4RT3PW', 'event_ts': '1599757626.004100', 'channel_type': 'im'}
    
    (etc.)
    

    And when I look at the IP sent, there are different.

    Thank you in advance.

    question 
    opened by alexattia 12
  • Add Falcon (ASGI) adapter

    Add Falcon (ASGI) adapter

    This PR adds an ASGI Falcon App adapter to complement the existing Falcon adapter for WSGI apps.

    I wrote this code originally based on the existing adapter for https://git.sr.ht/~sara/openverse-slack-reaction.

    The code I wrote there is copied almost directly here with some modifications to raise errors when an incompatible Falcon version is being used. You can see the original code here: https://git.sr.ht/~sara/openverse-slack-reaction/tree/main/item/falcon_adapter.py

    It's deployed to production with https://openverse-slack.sarayourfriend.pictures.

    Hope it's okay I didn't open an issue for this first, but I needed it for my own app one way or another and copying the file and adding tests was trivial so I didn't spend too much extra time on this compared to just writing a helpful issue describing the feature :slightly_smiling_face:

    Category (place an x in each of the [ ])

    • [ ] slack_bolt.App and/or its core components
    • [ ] slack_bolt.async_app.AsyncApp and/or its core components
    • [x] Adapters in slack_bolt.adapter
    • [ ] Document pages under /docs
    • [ ] Others

    Requirements (place an x in each [ ])

    Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

    • [x] I've read and understood the Contributing Guidelines and have done my best effort to follow them.
    • [x] I've read and agree to the Code of Conduct.
    • [x] I've run ./scripts/install_all_and_run_tests.sh after making the changes.
    enhancement area:async area:adapter 
    opened by sarayourfriend 11
  • Need help to run lazy listeners in response to view_submission requests on AWS Lambda

    Need help to run lazy listeners in response to view_submission requests on AWS Lambda

    I can't receive a response from a lazy function (in AWS lambda). Although, the same AWS lambda was working a few days ago.

    Reproducible in:

    from slack_bolt import App
    from slack_bolt.adapter.aws_lambda import SlackRequestHandler
    
    app = App(process_before_response=True)
    
    
    def respond_to_slack_within_3_seconds(ack):
        ack()
    
    
    def handle_freeform_submission(body, client, view):
        slack_user_id = body['user']['id']
        time.sleep(5)
        client.chat_postMessage(channel=slack_user_id, text='some msg')
    
    
    app.view('create_doc')(ack=respond_to_slack_within_3_seconds, lazy=[handle_freeform_submission])
    
    
    def lambda_handler(event, context):
        logger.info(f'Received event: {event}')
        slack_handler = SlackRequestHandler(app=app)
        return slack_handler.handle(event, context)
    
    

    The slack_bolt version

    slack-bolt 1.9.2 # and any above slack-sdk 3.11.2

    Python runtime version

    python3.7

    Steps to reproduce:

    are the same as in Issue #490

    Expected result:

    The function handle_freeform_submission should be called and send its result to a user.

    Actual result:

    Modal (code base not presented) opens and could be submitted with data But the lazy function doesn't seem to be even called.

    Here is a piece of lambda logs: Screenshot 2021-11-11 at 21 03 27

    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.

    question 
    opened by ashalobodin 11
  • Add ability to add patterns for app_mentions

    Add ability to add patterns for app_mentions

    Currently, I can only subscribe to a generic app mention event using @app.event("app_mention"), but if I'm building an app that has multiple actions, the function can become unmaintainable. Instead, using a similar interface as app.message would make this much more usable in my opinion.

    Examples:

    
    @app.mention("hello")
    def say_hello(say):
        say("Hey there")!
    
    @app.mention("status of [0-9]+")
    def handle_status(...)
        ...
    

    Category (place an x in each of the [ ])

    • [x] slack_bolt.App and/or its core components
    • [ ] slack_bolt.async_app.AsyncApp and/or its core components
    • [ ] Adapters in slack_bolt.adapter
    • [ ] Others

    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.

    question 
    opened by azizmb 11
  • Block Kit (Emoji) not properly displaying on iphone, but correct on Mac, Android etc.

    Block Kit (Emoji) not properly displaying on iphone, but correct on Mac, Android etc.

    Hi, I am having the block kit below as an app home view and it does not properly show the emojis on iphones (see printscreens). What can I do to fix this?

    {
       "type":"home",
       "callback_id":"app_home_view",
       "blocks":[
          {
             "type":"header",
             "block_id":"actions1",
             "text":{
                "type":"plain_text",
                "text":"Manuel's Overview 🗓",
                "emoji":true
             }
          },
          {
             "type":"section",
             "text":{
                "type":"mrkdwn",
                "text":"_Select the week and book or find your bookings here._"
             },
             "accessory":{
                "type":"static_select",
                "placeholder":{
                   "type":"plain_text",
                   "text":"Current Week",
                   "emoji":true
                },
                "options":[
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"Next Week",
                         "emoji":true
                      },
                      "value":"next-week"
                   }
                ],
                "action_id":"select_week_app_home_view"
             }
          },
          {
             "type":"divider"
          },
          {
             "type":"section",
             "text":{
                "type":"mrkdwn",
                "text":"Monday, 17/05/2021"
             },
             "accessory":{
                "type":"static_select",
                "placeholder":{
                   "type":"plain_text",
                   "text":"🤔 Not indicated",
                   "emoji":true
                },
                "options":[
                   {
                      "text":{
                         "type":"plain_text",
                         "text":":palm_tree: Out of office",
                         "emoji":true
                      },
                      "value":"1"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏠 Working from home",
                         "emoji":true
                      },
                      "value":"2"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏢 Unt. Haldenweg (5)",
                         "emoji":true
                      },
                      "value":"3"
                   }
                ],
                "action_id":"select_day1_app_home_view"
             }
          },
          {
             "type":"section",
             "text":{
                "type":"mrkdwn",
                "text":"Tuesday, 18/05/2021"
             },
             "accessory":{
                "type":"static_select",
                "placeholder":{
                   "type":"plain_text",
                   "text":"🤔 Not indicated",
                   "emoji":true
                },
                "options":[
                   {
                      "text":{
                         "type":"plain_text",
                         "text":":palm_tree: Out of office",
                         "emoji":true
                      },
                      "value":"1"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏠 Working from home",
                         "emoji":true
                      },
                      "value":"2"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏢 Unt. Haldenweg (5)",
                         "emoji":true
                      },
                      "value":"3"
                   }
                ],
                "action_id":"select_day2_app_home_view"
             }
          },
          {
             "type":"section",
             "text":{
                "type":"mrkdwn",
                "text":"Wednesday, 19/05/2021"
             },
             "accessory":{
                "type":"static_select",
                "placeholder":{
                   "type":"plain_text",
                   "text":"🤔 Not indicated",
                   "emoji":true
                },
                "options":[
                   {
                      "text":{
                         "type":"plain_text",
                         "text":":palm_tree: Out of office",
                         "emoji":true
                      },
                      "value":"1"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏠 Working from home",
                         "emoji":true
                      },
                      "value":"2"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏢 Unt. Haldenweg (5)",
                         "emoji":true
                      },
                      "value":"3"
                   }
                ],
                "action_id":"select_day3_app_home_view"
             }
          },
          {
             "type":"section",
             "text":{
                "type":"mrkdwn",
                "text":"Thursday, 20/05/2021"
             },
             "accessory":{
                "type":"static_select",
                "placeholder":{
                   "type":"plain_text",
                   "text":"🤔 Not indicated",
                   "emoji":true
                },
                "options":[
                   {
                      "text":{
                         "type":"plain_text",
                         "text":":palm_tree: Out of office",
                         "emoji":true
                      },
                      "value":"1"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏠 Working from home",
                         "emoji":true
                      },
                      "value":"2"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏢 Unt. Haldenweg (5)",
                         "emoji":true
                      },
                      "value":"3"
                   }
                ],
                "action_id":"select_day4_app_home_view"
             }
          },
          {
             "type":"section",
             "text":{
                "type":"mrkdwn",
                "text":"Friday, 21/05/2021"
             },
             "accessory":{
                "type":"static_select",
                "placeholder":{
                   "type":"plain_text",
                   "text":"🏠 Working from home",
                   "emoji":true
                },
                "options":[
                   {
                      "text":{
                         "type":"plain_text",
                         "text":":palm_tree: Out of office",
                         "emoji":true
                      },
                      "value":"1"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏢 Unt. Haldenweg (5)",
                         "emoji":true
                      },
                      "value":"3"
                   }
                ],
                "action_id":"select_day5_app_home_view"
             }
          },
          {
             "type":"section",
             "text":{
                "type":"mrkdwn",
                "text":"Saturday, 22/05/2021"
             },
             "accessory":{
                "type":"static_select",
                "placeholder":{
                   "type":"plain_text",
                   "text":"🤔 Not indicated",
                   "emoji":true
                },
                "options":[
                   {
                      "text":{
                         "type":"plain_text",
                         "text":":palm_tree: Out of office",
                         "emoji":true
                      },
                      "value":"1"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏠 Working from home",
                         "emoji":true
                      },
                      "value":"2"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏢 Unt. Haldenweg (5)",
                         "emoji":true
                      },
                      "value":"3"
                   }
                ],
                "action_id":"select_day6_app_home_view"
             }
          },
          {
             "type":"section",
             "text":{
                "type":"mrkdwn",
                "text":"Sunday, 23/05/2021"
             },
             "accessory":{
                "type":"static_select",
                "placeholder":{
                   "type":"plain_text",
                   "text":"🤔 Not indicated",
                   "emoji":true
                },
                "options":[
                   {
                      "text":{
                         "type":"plain_text",
                         "text":":palm_tree: Out of office",
                         "emoji":true
                      },
                      "value":"1"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏠 Working from home",
                         "emoji":true
                      },
                      "value":"2"
                   },
                   {
                      "text":{
                         "type":"plain_text",
                         "text":"🏢 Unt. Haldenweg (5)",
                         "emoji":true
                      },
                      "value":"3"
                   }
                ],
                "action_id":"select_day7_app_home_view"
             }
          },
          {
             "type":"divider"
          },
          {
             "type":"actions",
             "elements":[
                {
                   "type":"button",
                   "text":{
                      "type":"plain_text",
                      "text":"Office overview 🏢",
                      "emoji":true
                   },
                   "url":"https://example.com",
                   "action_id":"user_overview"
                },
                {
                   "type":"button",
                   "text":{
                      "type":"plain_text",
                      "text":"Manage your account 🦸",
                      "emoji":true
                   },
                   "url":"https://example.com/",
                   "action_id":"user_profile"
                },
                {
                   "type":"button",
                   "text":{
                      "type":"plain_text",
                      "text":"Manage your workspace 🗃️",
                      "emoji":true
                   },
                   "url":"https://app.example.com/office_profile/",
                   "action_id":"workspace_settings"
                }
             ]
          }
       ]
    }
    

    server-side 
    opened by ManuelBuri 11
  • slack is posting two/three messages with chat_postMessage

    slack is posting two/three messages with chat_postMessage

    Description

    Describe your issue here. I am using slack-bolt python framework for my slack bolt which is going through some logic. I am using chat_postMessage method to send a message from bot. But currently it is sending three messages even though it's having single API call. I read about it and notices that it can be avoided with making X-Slack-Retry-Num =1 in header.(https://api.slack.com/apis/connections/events-api#graceful_retries) But i am wondering how can i change the header of the api call in res_out = app.client.chat_postMessage(channel=message['channel'],thread_ts = original_thread_id,blocks=block_final)

    What type of issue is this? (place an x in one of the [ ])

    • [ ] bug
    • [ ] enhancement (feature request)
    • [ ] question
    • [ ] documentation related
    • [x] example code related
    • [ ] testing related
    • [ ] discussion

    Requirements (place an x in each of the [ ])

    • [x ] I've read and understood the Contributing guidelines and have done my best effort to follow them.
    • [x] I've read and agree to the Code of Conduct.
    • [x] I've searched for any related issues and avoided creating a duplicate issue.

    Bug Report

    Filling out the following details about bugs will help us solve your issue sooner.

    Reproducible in:

    package version:

    node version:

    OS version(s):

    Steps to reproduce:

    1. use res_out = app.client.chat_postMessage(channel=message['channel'],thread_ts = original_thread_id,blocks=block_final) in the bot's code and due to retry mechanism it tries and sends the same message thrice on single call.

    Expected result:

    Bot should only post single message.

    Actual result:

    Bot is posting two/three same messages

    Attachments:

    question 
    opened by kunalrc2022 9
  • The last word of the message gets lost when posted with iPhone 8, XR.

    The last word of the message gets lost when posted with iPhone 8, XR.

    The slack_bolt version

    slack-bolt==1.13.0 slack-sdk==3.15.2 slacker==0.14.0 slackeventsapi==3.0.1

    Python runtime version

    Python 3.8.8

    OS info

    Ubuntu-20.04.1

    Steps to reproduce:

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

    1. Post a message in a channel where the app is integrated in with iPhone 8 or iPhone XR.

    Expected result:

    The whole message is received by the slack app.

    Actual result:

    The last word of the message vanishes.

    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.

    question auto-triage-stale 
    opened by cnr0724 5
  • Work in progress view in App home page

    Work in progress view in App home page

    Hey guys 👋, I am experiencing an issue with the app home page, even if I handle the app_home_opened event by just acknowledging the request slack will show a work in progress view sometimes, why does this happen? here is an screenshot: image

    question auto-triage-stale 
    opened by juliocanares 5
  • Socket mode say() sends some of the data to another user

    Socket mode say() sends some of the data to another user

    When someone else then me writing to the slack bot, some of the response is sent to me the bot creator instead of them.

    Why is that happening? I have no ability to control the user to send the data in say(). Could it be some memory leak across threads?

    question need info auto-triage-stale 
    opened by nitz-iron 14
  • Make Exeption traceable in lazy listener

    Make Exeption traceable in lazy listener

    (Describe your issue and goal here) Currently, using lazy listener for FAAS (such as AWS Lambda), it's really difficult to debug. If we have a exception, we just have something like

    Failed to run an internal function (Exception ABC)

    We don't know exactly, what is the error, traceback, error line etc...

     try:
                await internal_func(
                    **build_async_required_kwargs(
                        logger=logger,
                        required_arg_names=arg_names,
                        request=request,
                        response=None,
                        this_func=internal_func,
                    )
                )
            except Exception as e:
                logger.error(f"Failed to run an internal function ({e})")
    
    

    So should we have an option to enable the exception traceback or provide some meaningful error information to debug instead of just simply message like that

    On the other hand, the document about error handling does not work with lazy listener so we also need to update. https://slack.dev/bolt-python/concepts#errors

    Category (place an x in each of the [ ])

    • [ ] slack_bolt.App and/or its core components
    • [ ] slack_bolt.async_app.AsyncApp and/or its core components
    • [ ] Adapters in slack_bolt.adapter
    • [x ] Others

    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.

    enhancement area:async area:sync 
    opened by jimmymaise 1
  • Add Quart adapter (resolving #619)

    Add Quart adapter (resolving #619)

    Add an adapter for Quart ( https://github.com/slackapi/bolt-python/issues/619 )

    Category (place an x in each of the [ ])

    • [ ] slack_bolt.App and/or its core components
    • [ ] slack_bolt.async_app.AsyncApp and/or its core components
    • [X] Adapters in slack_bolt.adapter
    • [ ] Document pages under /docs
    • [ ] Others

    Requirements (place an x in each [ ])

    Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

    • [X] I've read and understood the Contributing Guidelines and have done my best effort to follow them.
    • [X] I've read and agree to the Code of Conduct.
    • [X] I've run ./scripts/install_all_and_run_tests.sh after making the changes.
    enhancement area:async area:adapter 
    opened by sonnens 2
Releases(v1.14.3)
  • v1.14.3(Jul 26, 2022)

    Changes

    • #689 Fix #688 kwarg injection does not work with decorated functions - Thanks @seratch @deppe

    Document Changes

    • #686 Add anchors and add contribute link to sidebar - Thanks @wongjas

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/63?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.14.2...v1.14.3
    Source code(tar.gz)
    Source code(zip)
  • v1.14.2(Jul 21, 2022)

    Changes

    • #684 Fix #683 IgnoringSelfEvents middleware does not filter out Message sent via response_url - Thanks @seratch @deppe

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/62?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.14.1...v1.14.2
    Source code(tar.gz)
    Source code(zip)
  • v1.14.1(Jul 12, 2022)

    Changes

    • #679 Allow lazy function invocation to target version/alias - Thanks @angrychimp
    • #662 Make the flake8 and black settings consistent - Thanks @seratch

    Document / Example Updates

    • #665 Fix #664 Django example installation store improvement - Thanks @seratch @DataGreed
    • #659 #661 Change AWS API Gateway to Lambda Function URL in documents - Thanks @Globart1337

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/61?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.14.0...v1.14.1
    Source code(tar.gz)
    Source code(zip)
  • v1.14.0(May 18, 2022)

    Changes

    • #649 Add Google Cloud Functions adapter (ref #646) - Thanks @seratch
    • #647 Remove noqa comments and add __all__ to __init__.py files - Thanks @seratch

    Document Updates

    • #648 Clarify "Setting up events" section - Thanks @hestonhoffman

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/56?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.13.2...v1.14.0
    Source code(tar.gz)
    Source code(zip)
  • v1.13.2(May 11, 2022)

    Changes

    • #645 Fix #644 app.message listener does not handle events when a file is attached - Thanks @seratch

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/58?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.13.1...v1.13.2
    Source code(tar.gz)
    Source code(zip)
  • v1.13.1(Apr 29, 2022)

    Changes

    • #640 Fix #639 is_enterprise_install does not exist in context object - Thanks @seratch @Sadisms
    • #636 Upgrade pytype version to the latest - Thanks @seratch
    • #638 Enable Flake8 in the CI builds - Thanks @seratch

    Document Updates

    • #621 Improve the OAuth Lambda deployment instructs - Thanks @srajiang
    • #623 Add Socket Mode healthcheck endpoint examples (#622) - Thanks @ImRohan01 @seratch
    • #633 Update AWS example documentation with correct AWS Lambda roles required - Thanks @cp2423 @filmaj

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/57?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.13.0...v1.13.1
    Source code(tar.gz)
    Source code(zip)
  • v1.13.0(Mar 18, 2022)

    Changes

    • #618 Fix #617 Respect the configuration of logger parameter across App/AsyncApp loggers - Thanks @seratch @brian-nguyen-bolt
    • #616 Fix type hint for event constraint to allow None subtypes - Thanks @alexrashed

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/55?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.12.0...v1.13.0
    Source code(tar.gz)
    Source code(zip)
  • v1.12.0(Mar 17, 2022)

    Changes

    • #614 Add Falcon (ASGI) adapter - Thanks @sarayourfriend

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/51?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.11.6...v1.12.0
    Source code(tar.gz)
    Source code(zip)
  • v1.11.6(Mar 2, 2022)

    Changes

    • #608 Fix #604 Respect the proxy_url in respond- Thanks @seratch @gpiks

    Document Updates

    • #609 Docs on handling options listeners with a filtering example - Thanks @filmaj

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/54?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.11.5...v1.11.6
    Source code(tar.gz)
    Source code(zip)
  • v1.11.5(Feb 25, 2022)

    Changes

    • #602 Fix #601 Allow for host option for AsyncSlackAppServer start method - Thanks @seratch @ucgw
    • #588 Upgrade test dependencies & fix Falcon warning - Thanks @seratch

    Document Updates

    • #587 Update ngrok link to point to official guide - Thanks @misscoded

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/53?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.11.4...v1.11.5
    Source code(tar.gz)
    Source code(zip)
  • v1.11.4(Feb 1, 2022)

    Changes

    • #586 Fix #584 Wrong user_token assigned to new user (affected versions: v1.11.2, v1.11.3) - Thanks @stantonius @seratch

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/52?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.11.3...v1.11.4
    Source code(tar.gz)
    Source code(zip)
  • v1.11.3(Jan 28, 2022)

    Changes

    • #580 Fix #468 Replying with 0 results for a multi-select external option display previous successful results - Thanks @seratch @prziborowski
    • #581 Upgrade pytype version to the latest (2022.1.13) - Thanks @seratch
    • #578 Add more org-wide installation patterns to the SDK tests - Thanks @seratch

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/50?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.11.2...v1.11.3
    Source code(tar.gz)
    Source code(zip)
  • v1.11.2(Jan 17, 2022)

    Changes

    • #576 Improve the built-in authorize for better support of user-scope only installations - Thanks @seratch
    • #577 Fix #561 matchers can be called even when app.message keyword does not match - Thanks @seratch @caddac

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/48?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.11.1...v1.11.2
    Source code(tar.gz)
    Source code(zip)
  • v1.11.1(Dec 24, 2021)

    Changes

    • #555 Fix #552 Unable to use request body with lazy listener when socket mode is enabled - Thanks @seratch @JordanGibson

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/49?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.11.0...v1.11.1
    Source code(tar.gz)
    Source code(zip)
  • v1.11.0(Dec 14, 2021)

    Changes

    • #546 Fix #545 Enable to use lazy listeners even when having any custom context data - Thanks @seratch
    • #543 Fix url_verification error with the Flask adapter - Thanks @seratch
    • #544 Fix #542 Add additional context values for FastAPI apps - Thanks @kafejo @seratch
    • #528 Add GitHub stale action for better triaging process - Thanks @srajiang
    • #547 Upgrade pytype, black versions - Thanks @seratch

    Document Updates

    • #519 #518 An error in the HTTP mode Getting Started document (JP) - Thanks @TORIFUKUKaiou
    • #523 Improve the Django app example to be more robust - Thanks @seratch
    • #538 Update the respond utility guide - Thanks @seratch
    • #541 Fix #525 Japanese translation for #524 (lazy listeners doc updates) - Thanks @wongjas
    • #534 Update link to view submissions doc - Thanks @wongjas
    • #535 Fixes #534, updates link to view submissions - Thanks @wongjas
    • #524 Update lazy lambda docs - Thanks @srajiang

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/42?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.10.0...v1.11.0
    Source code(tar.gz)
    Source code(zip)
  • v1.10.0(Nov 4, 2021)

    New Features

    Improvement of Django ORM database connection management

    Since this release, the Django adapter has been improved to properly manage the thread-local database connections bound to the threads managed by Bolt framework. If you use the Django adapter, we highly recommend upgrading to this version or newer.

    Please refer to #514 #512 #509 for more details.

    Changes

    • #514 #512 #509 Introduce ListenerStartHandler in the listener runner for better managing Django DB connections - Thanks @ross @seratch
    • #516 Improve the GitHub Actions job settings - Thanks @seratch

    Document Updates

    • #507 #505 #508 #506 Bunch of Japanese document updates - Thanks @TORIFUKUKaiou
    • #500 Update OAuth link to point to JP docs instead of EN - Thanks @wongjas

    References

    • Release Milestone: https://github.com/slackapi/bolt-python/milestone/47?closed=1
    • All Diff: https://github.com/slackapi/bolt-python/compare/v1.9.4...v1.10.0
    Source code(tar.gz)
    Source code(zip)
  • v1.9.4(Oct 29, 2021)

    Changes

    • #497 Add Python 3.10 to the supported versions - Thanks @seratch
    • #503 Fix a bug in the asyncio based token rotation support - Thanks @dkzk22
    • #504 Bump optional dependencies for v1.9.4 release - Thanks @seratch
    • #496 Upgrade pytype to the latest - Thanks @seratch

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/46?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.9.3...v1.9.4
    Source code(tar.gz)
    Source code(zip)
  • v1.9.3(Oct 13, 2021)

    Changes

    • #488 app.message listeners do not catch messages with subtype: thread_broadcast - Thanks @seratch @kanny

    Document updates:

    • Fix #480 #479 Adds updating views on submission for Japanese docs - Thanks @wongjas

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/45?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.9.2...v1.9.3
    Source code(tar.gz)
    Source code(zip)
  • v1.9.2(Sep 28, 2021)

    Changes

    • #477 Add more guide message in the HTML generated by the default failure handler - Thanks @seratch @misscoded @filmaj
    • #476 Improve the error message in the case where AuthorizeResult is not found - Thanks @seratch

    Document updates:

    • #479 Adds update view on submission docs - Thanks @srajiang
    • #472 update block id from listening modals - Thanks @bodepd

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/44?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.9.1...v1.9.2
    Source code(tar.gz)
    Source code(zip)
  • v1.9.1(Sep 7, 2021)

    Changes

    • #460 Fix #459 Invalid type hints in App / AsyncApp - Thanks @seratch @chrisbouchard

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/43?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.9.0...v1.9.1
    Source code(tar.gz)
    Source code(zip)
  • v1.9.0(Aug 31, 2021)

    New Features

    More Customization for Apps

    Since this release, developers can customize listener_executor in apps. Also, to support the use case where Enterprise Grid Org admins install apps from their app management page, we've added a new option to disable state parameter validation in the OAuth flow. Please note that we still don't recommend disabling the state validation for usual OAuth apps.

    Changes

    • #452 #453 Enable to customize the listener_executor in App - Thanks @chrisbouchard
    • #455 #454 Add oauth_settings.state_validation_enabled to customize the OAuth flow - Thanks @seratch

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/41?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.8.1...v1.9.0
    Source code(tar.gz)
    Source code(zip)
  • v1.8.1(Aug 28, 2021)

    Changes

    • #451 Fix cookie extraction during OAuth for REST based AWS API GW + Lambda app - Thanks @naveensan1
    • #449 Fix typo in App / AsyncApp comments and API documents - Thanks @objectfox
    • #446 Update the entity name - Thanks @seratch

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/38?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.8.0...v1.8.1
    Source code(tar.gz)
    Source code(zip)
  • v1.8.0(Aug 13, 2021)

    Changes

    • #436 Fix #409 Custom token rotation expiration time does not work if installation_store is passed at top level - Thanks @seratch
    • #437 Fix a token rotation bug where a bot token is not refreshed if a user token does not exist - Thanks @seratch
    • #431 Fix #430 by adding a new option to customize dev server (http.server) logging - Thanks @seratch @cole-wilson
    • #432 Update Sanic adapter and its tests to be compatible with sanic v21 - Thanks @seratch
    • #416 Fix type hint errors detected by pytype 2021.7.19 - Thanks @seratch

    Document Updates

    • #442 #444 Added basic lazy lambda example setup and deploy instructions - Thanks @filmaj
    • #418 #414 Add Japanese translation of "token rotation" document - Thanks @hirosassa
    • #426 #406 Add Japanese translation of "Getting started over HTTP" and "Getting started" documents - Thanks @hirosassa
    • #415 #412 #429 Update "incoming events" to "incoming requests" in documents - Thanks @RhnSharma @Shoryu-N

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/37?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.7.0...v1.8.0
    Source code(tar.gz)
    Source code(zip)
  • v1.7.0(Jul 15, 2021)

    New Features

    Token Rotation Support

    This version includes the support for the apps enabling the newly released token rotation for better security. Refer to the API document for the general information about the feature.

    How to handle token rotation with this SDK

    If you use any of the built-in InstallationStore, there is nothing else to change on your application code side. If you use the relational database tables along with a built-in InstallationStore, refer to the latest table schema here.

    If you use your own custom authorize, not the built-in InstallationStoreAuthorize, the authorize function needs to be updated to run the token rotation. Refer to the InstallationStoreAuthorize's code to learn what to do for it.

    Migration guide for Django users

    If you operate Django apps based on the example app in this repository and would like to enable token rotation for the apps, check this commit to learn the required changes for it.

    Migration guide for SQLAlchemyInstallationStore users

    If your app uses the built-in SQLAlchemyInstallationStore for managing Slack app installations, adding the following database columns is required for this version upgrade. Refer to the code to check the complete ones.

    Also, since this version, all the table columns for string data have their max length for better compatibility with MySQL. We recommend setting the same ones for your models.

    slack_installations
    • Column("bot_refresh_token", String(200)),
    • Column("bot_token_expires_at", DateTime),
    • Column("user_refresh_token", String(200)),
    • Column("user_token_expires_at", DateTime),
    slack_bots
    • Column("bot_refresh_token", String(200)),
    • Column("bot_token_expires_at", DateTime),

    Changes

    • #404 Fix #400 token rotation feature support - Thanks @seratch
    • #387 #386 Replace re.search() with re.findall() in MessgeListenerMatches middleware to provide better matching results - Thanks @albeec13
    • #379 Make cookies extraction on AWS Lambda compatible with its format v1.0 - Thanks @tattee
    • #375 Update install page to avoid favicon downloads - Thanks @Bhavya6187
    • #401 Fix #378 by adding middleware error handlers - Thanks @seratch @jeremyschulman
    • #403 Fix #377 Better log messages for AsyncApp when a listener is missing - Thanks @seratch
    • #394 Fix #370 by adding an alias of next arg (next_) in middleware arguments - Thanks @seratch
    • #402 Fix #372 by adding listener matcher docs - Thanks @seratch
    • #389 Add reference to WorkflowStepBuilder in docs - Thanks @misscoded

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/35?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.6.1...v1.7.0
    Source code(tar.gz)
    Source code(zip)
  • v1.6.1(Jun 3, 2021)

    Changes

    • #331 #330 Potentially request.body can be None when using a custom adapter - Thanks @matteobaldelli @seratch
    • #363 Fix #346 Allow unfurl_media / unfurl_links in ack / respond - Thanks @gburek-fastly @seratch

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/36?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.6.0...v1.6.1
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(May 7, 2021)

    New Features

    Code Suggestion for Missing Listeners

    Since this version, the warning message for unhandled requests is even more helpful!

    Let's say you've configured the "message" event subscription in the Slack App configuration page, and the Slack server-side started sending message events to your app. However, your app does not have the corresponding event listener yet. In this case, Bolt suggests the missing listener with a working code snippet.

    WARNING:slack_bolt.App:Unhandled request ({'type': 'event_callback', 'event': {'type': 'message'}})
    ---
    [Suggestion] You can handle this type of event with the following listener function:
    
    @app.event("message")
    def handle_message_events(body, logger):
        logger.info(body)
    

    The new suggestion logging should be helpful for the developers who are new to Bolt and the Slack platform.

    Options For Turning the Built-in Middleware Off

    Developers can turn any of the built-in middleware off if they would like to do so for some reason.

    app = App(
        token=os.environ["SLACK_BOT_TOKEN"],
        signing_secret=os.environ["SLACK_SIGNING_SECRET"],
        # Verify request signature
        request_verification_enabled = False,  # default: True
        # Skip processing the events generated by this app's bot user itself
        ignoring_self_events_enabled = False,  # default: True
        # Respond to ssl_check requests
        ssl_check_enabled = False,  # default: True
        # Respond to url_verification requests in the Events API configuration steps
        url_verification_enabled = False,  # default: True
    )
    

    Please make sure if it's safe enough when you turn a built-in middleware off. We strongly recommend using RequestVerification for better security. If you have a proxy that verifies request signature in front of the Bolt app, it's totally fine to disable RequestVerification to avoid duplication of work. Don't turn it off just for easiness of development.

    Changes

    • #323 Add missing listener suggestion to the default unhandled error message - Thanks @seratch
    • #310 Fix #307 Add options to disable the built-in middleware - Thanks @seratch @hubhanker99
    • #311 Fix #309 Fallback to no-emoji boot message on any platforms - Thanks @seratch @christheodosius
    • #315 #316 Fix Chalice deployment failures caused by #270 - Thanks @jlujan-invitae
    • #313 Fix #312 Type hint errors with pytype 2021.4.26 - Thanks @seratch

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/34?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.5.0...v1.6.0
    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Apr 20, 2021)

    New Features

    Underlying SDK Upgrade

    This release upgrades the underlying slack-sdk package from 3.4 to 3.5 (or higher). Refer to the package's release note for more details: https://github.com/slackapi/python-slack-sdk/releases/tag/v3.5.0

    Built-in Token Revocation Handlers

    Since this version, the out-of-the-box support for the following events is available:

    • https://api.slack.com/events/tokens_revoked
    • https://api.slack.com/events/app_uninstalled

    To use this feature, all you need to do are:

    • Enable installation_store of the OAuth settings (see the document)
    • Call enable_token_revocation_listeners() method of the App / AsyncApp instance
    app = App(
      # Enabling installation_store required
    )
    app.enable_token_revocation_listeners()
    

    This is equivalent to the following code:

    app = App()  # installation_store required
    app.event("tokens_revoked")(app.default_tokens_revoked_event_listener)
    app.event("app_uninstalled")(app.default_app_uninstalled_event_listener)
    

    These event listeners properly utilize the data deletion methods in the InstallationStore you use. If you have your own InstallationStore implementation, please implement deletion methods in the classes. Refer to https://github.com/slackapi/python-slack-sdk/pull/995 for more details.

    Customize Unhandled Error Handling

    Handling unmatched request patterns had not been customizable in the past versions. The pull request #290 introduced a new option to enable using @app.error handlers for unmatched requests. The default is set to False, which is fully backward compatible. If the option is True, Bolt raises a BoltUnhandledRequestError with sufficient information. @app.error handler can customize the behavior for the patterns (e.g., having custom logging, changing HTTP status from 404 to something else).

    app = App(
        token=os.environ["SLACK_BOT_TOKEN"],
        signing_secret=os.environ["SLACK_SIGNING_SECRET"],
        # enable @app.error handler to catch the patterns
        raise_error_for_unhandled_request=True,
    )
    
    @app.error
    def handle_errors(error):
        if isinstance(error, BoltUnhandledRequestError):
            # You may want to have debug/info logging here
            return BoltResponse(status=200, body="")
        else:
            # other error patterns
            return BoltResponse(status=500, body="Something wrong")
    

    Add respond to app.view Listeners

    When an input block in your modal has response_url_enabled: true, view_submission payloads can have response_urls. Since this version, you can use respond utility to use the primary element in the array.

    @app.view("view-id")
    def check(ack, respond):
        # if there is an input block with response_url_enabled: true
        respond("This message will be posted in the selected channel")
        ack()
    

    see also:

    • https://api.slack.com/reference/block-kit/block-elements#conversation_select
    • https://github.com/slackapi/bolt-python/pull/288

    Better Compatibility with Thread-local feature based Libraries

    ListenerCompletionHandler is a new addition, which enables developers to customize callbacks for listener runner completion. The callbacks can be useful, especially when you use a library/framework that utilizes thread-local variables (e.g., Django ORM, thread-local sessions in SQLAlchemy) along with Bolt for Python.

    If you're interested in how it works, check the updated Django adapter implementation for details: https://github.com/slackapi/bolt-python/blob/v1.5.0/slack_bolt/adapter/django/handler.py

    from django.db import connections
    
    class DjangoListenerCompletionHandler(ListenerCompletionHandler):
        def handle(self, request: BoltRequest, response: Optional[BoltResponse]) -> None:
            # closes all the thread-local connections in the current thread
            connections.close_all()
    

    Changes

    • #270 Add support for lazy listeners when running with chalice local - Thanks @jlujan-invitae
    • #281 Fix #280 Django thread-local connection cleanup in multi threads - Thanks @seratch
    • #287 Enable installation_store authorize to fallback to bots (prep for #254) - Thanks @seratch
    • #289 Fix #254 Add built-in tokens_revoked/app_uninstalled event handlers - Thanks @seratch
    • #288 Fix #260 Enable to use respond utility in app.view listeners (only when response_urls exists) - Thanks @seratch
    • #290 Fix #273 Enable developers to customize the way to handle unmatched requests - Thanks @seratch

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/33?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.4.4...v1.5.0
    Source code(tar.gz)
    Source code(zip)
  • v1.4.4(Mar 22, 2021)

    Changes

    • #261 #262 SocketModeHandler#start() does not terminate on Windows - Thanks @vv-grinko @seratch
    • #256 #257 Improve the warning message in App/AsyncApp constructor - Thanks @seratch

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/32?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.4.3...v1.4.4
    Source code(tar.gz)
    Source code(zip)
  • v1.4.3(Mar 6, 2021)

    Changes

    • #251 #253 Unable to run OAuth flow URLs in Google Cloud Run - Thanks @gifflarn @seratch

    References

    • milestone: https://github.com/slackapi/bolt-python/milestone/31?closed=1
    • diff: https://github.com/slackapi/bolt-python/compare/v1.4.2...v1.4.3
    Source code(tar.gz)
    Source code(zip)
Owner
SlackAPI
https://api.slack.com
SlackAPI
A Flask extension that enables or disables features based on configuration.

Flask FeatureFlags This is a Flask extension that adds feature flagging to your applications. This lets you turn parts of your site on or off based on

Rachel Greenfield 128 Mar 27, 2022
A RESTful API for creating and monitoring resource components of a hypothetical build system. Built with FastAPI and pydantic. Complete with testing and CI.

diskspace-monitor-CRUD Background The build system is part of a large environment with a multitude of different components. Many of the components hav

Nick Hopewell 67 May 5, 2022
Qwerkey is a social media platform for connecting and learning more about mechanical keyboards built on React and Redux in the frontend and Flask in the backend on top of a PostgreSQL database.

Flask React Project This is the backend for the Flask React project. Getting started Clone this repository (only this branch) git clone https://github

Peter Mai 22 Jan 10, 2022
Learn to deploy a FastAPI application into production DigitalOcean App Platform

Learn to deploy a FastAPI application into production DigitalOcean App Platform. This is a microservice for our Try Django 3.2 project. The goal is to extract any and all text from images using a technique called OCR.

Coding For Entrepreneurs 52 Aug 7, 2022
Sample-fastapi - A sample app using Fastapi that you can deploy on App Platform

Getting Started We provide a sample app using Fastapi that you can deploy on App

Erhan BÜTE 2 Jan 17, 2022
This is an API developed in python with the FastApi framework and putting into practice the recommendations of the book Clean Architecture in Python by Leonardo Giordani,

This is an API developed in python with the FastApi framework and putting into practice the recommendations of the book Clean Architecture in Python by Leonardo Giordani,

null 1 Jan 26, 2022
API using python and Fastapi framework

Welcome ?? CFCApi is a API DEVELOPMENT PROJECT UNDER CODE FOR COMMUNITY ! Project Walkthrough ?? CFCApi run on Python using FASTapi Framework Docs The

Abhishek kushwaha 6 Jul 22, 2022
FastAPI framework plugins

Plugins for FastAPI framework, high performance, easy to learn, fast to code, ready for production fastapi-plugins FastAPI framework plugins Cache Mem

RES 222 Aug 14, 2022
FastAPI framework plugins

Plugins for FastAPI framework, high performance, easy to learn, fast to code, ready for production fastapi-plugins FastAPI framework plugins Cache Mem

RES 93 Feb 16, 2021
A FastAPI Framework for things like Database, Redis, Logging, JWT Authentication and Rate Limits

A FastAPI Framework for things like Database, Redis, Logging, JWT Authentication and Rate Limits Install You can install this Library with: pip instal

Tert0 25 Jul 23, 2022
An extension library for FastAPI framework

FastLab An extension library for FastAPI framework Features Logging Models Utils Routers Installation use pip to install the package: pip install fast

Tezign Lab 10 Jul 11, 2022
Flask-vs-FastAPI - Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks.

Flask-vs-FastAPI Understanding Flask vs FastAPI Web Framework. A comparison of two different RestAPI frameworks. IntroductionIn Flask is a popular mic

Mithlesh Navlakhe 1 Jan 1, 2022
Light, Flexible and Extensible ASGI API framework

Starlite Starlite is a light and flexible ASGI API framework. Using Starlette and pydantic as foundations. Check out the Starlite documentation ?? Cor

null 828 Aug 8, 2022
FastAPI-Amis-Admin is a high-performance, efficient and easily extensible FastAPI admin framework. Inspired by django-admin, and has as many powerful functions as django-admin.

简体中文 | English 项目介绍 FastAPI-Amis-Admin fastapi-amis-admin是一个拥有高性能,高效率,易拓展的fastapi管理后台框架. 启发自Django-Admin,并且拥有不逊色于Django-Admin的强大功能. 源码 · 在线演示 · 文档 · 文

AmisAdmin 184 Aug 8, 2022
Cookiecutter API for creating Custom Skills for Azure Search using Python and Docker

cookiecutter-spacy-fastapi Python cookiecutter API for quick deployments of spaCy models with FastAPI Azure Search The API interface is compatible wit

Microsoft 336 Aug 2, 2022
Generate modern Python clients from OpenAPI

openapi-python-client Generate modern Python clients from OpenAPI 3.x documents. This generator does not support OpenAPI 2.x FKA Swagger. If you need

Triax Technologies 431 Aug 12, 2022
Docker image with Uvicorn managed by Gunicorn for high-performance FastAPI web applications in Python 3.6 and above with performance auto-tuning. Optionally with Alpine Linux.

Supported tags and respective Dockerfile links python3.8, latest (Dockerfile) python3.7, (Dockerfile) python3.6 (Dockerfile) python3.8-slim (Dockerfil

Sebastián Ramírez 1.9k Aug 7, 2022
High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (w/ Redis and PostgreSQL).

fastapi-gino-arq-uvicorn High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (powered by Redis & PostgreSQL). Contents Get Star

Leo Sussan 320 Jul 20, 2022
Turns your Python functions into microservices with web API, interactive GUI, and more.

Instantly turn your Python functions into production-ready microservices. Deploy and access your services via HTTP API or interactive UI. Seamlessly export your services into portable, shareable, and executable files or Docker images.

Machine Learning Tooling 2.7k Aug 8, 2022