# Buggy code
def __init__(
    self,
    slack_token: Text,
    slack_channel: Optional[Text] = None,
    slack_retry_reason_header: Optional[Text] = None,
    slack_retry_number_header: Optional[Text] = None,
    errors_ignore_retry: Optional[List[Text]] = None,
) -> None:
    """Create a Slack input channel.

    Needs a couple of settings to properly authenticate and validate
    messages. Details to setup:

    https://github.com/slackapi/python-slackclient

    Args:
        slack_token: Your Slack Authentication token. You can create a
            Slack app and get your Bot User OAuth Access Token
            `here <https://api.slack.com/slack-apps>`_.
        slack_channel: the string identifier for a channel to which
            the bot posts, or channel name (e.g. '#bot-test')
            If not set, messages will be sent back
            to the "App" DM channel of your bot's name.
        slack_retry_reason_header: Slack HTTP header name indicating reason that slack send retry request.
        slack_retry_number_header: Slack HTTP header name indicating the attempt number
        errors_ignore_retry: Any error codes given by Slack
            included in this list will be ignored.
            Error codes are listed
            `here <https://api.slack.com/events-api#errors>`_.

    """
    self.slack_token = slack_token
    self.slack_channel = slack_channel
    self.errors_ignore_retry = errors_ignore_retry or ("http_timeout",)
    self.retry_reason_header = slack_retry_reason_header
    self.retry_num_header = slack_retry_number_header


# Traceback (ValueError)
File "c:\users\jitesh\appdata\local\programs\python\python37\lib\site-packages\sanic\request.py", line 173, in load_json
self.parsed_json = loads(self.body)
ValueError: Expected object or value

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\users\jitesh\appdata\local\programs\python\python37\lib\site-packages\sanic\app.py", line 976, in handle_request
response = await response
File "c:\users\jitesh\appdata\local\programs\python\python37\lib\site-packages\rasa\core\channels\slack.py", line 356, in webhook
metadata = self.get_metadata(request)
File "c:\users\jitesh\appdata\local\programs\python\python37\lib\site-packages\rasa\core\channels\slack.py", line 329, in get_metadata
slack_event = request.json
File "c:\users\jitesh\appdata\local\programs\python\python37\lib\site-packages\sanic\request.py", line 167, in json
self.load_json()
File "c:\users\jitesh\appdata\local\programs\python\python37\lib\site-packages\sanic\request.py", line 177, in load_json
raise InvalidUsage("Failed when parsing body as json")
sanic.exceptions.InvalidUsage: Failed when parsing body as json

# Fixed code
def __init__(
    self,
    slack_token: Text,
    slack_channel: Optional[Text] = None,
    slack_retry_reason_header: Optional[Text] = None,
    slack_retry_number_header: Optional[Text] = None,
    errors_ignore_retry: Optional[List[Text]] = None,
    use_threads: Optional[bool] = False,
) -> None:
    """Create a Slack input channel.

    Needs a couple of settings to properly authenticate and validate
    messages. Details to setup:

    https://github.com/slackapi/python-slackclient

    Args:
        slack_token: Your Slack Authentication token. You can create a
            Slack app and get your Bot User OAuth Access Token
            `here <https://api.slack.com/slack-apps>`_.
        slack_channel: the string identifier for a channel to which
            the bot posts, or channel name (e.g. '#bot-test')
            If not set, messages will be sent back
            to the "App" DM channel of your bot's name.
        slack_retry_reason_header: Slack HTTP header name indicating reason that slack send retry request.
        slack_retry_number_header: Slack HTTP header name indicating the attempt number
        errors_ignore_retry: Any error codes given by Slack
            included in this list will be ignored.
            Error codes are listed
            `here <https://api.slack.com/events-api#errors>`_.
        use_threads: If set to True, your bot will send responses in Slack as a threaded message.
            Responses will appear as a normal Slack message if set to False.

    """
    self.slack_token = slack_token
    self.slack_channel = slack_channel
    self.errors_ignore_retry = errors_ignore_retry or ("http_timeout",)
    self.retry_reason_header = slack_retry_reason_header
    self.retry_num_header = slack_retry_number_header
    self.use_threads = use_threads