Skip to content

Handle message event from incomming webhook #197

Description

@uc-dang-tiki

(Describe your issue and goal here)
I want to trigger my bot from a script (use incomming webook), but seem like bolt cannot listen message event send from my script even the message pattern is right.
Here is the full message:

WARNING:slack_bolt.AsyncApp:Unhandled request ({'token': 'xxx', 'team_id': 'xxx', 'api_app_id': 'xxx', 'event': {'type': 'message', 'subtype': 'bot_message', 'text': '.kc apply connector', 'ts': '1610182783.003000', 'bot_id': 'xx', 'channel': 'xx', 'event_ts': '1610182783.003000', 'channel_type': 'channel'}, 'type': 'event_callback', 'event_id': 'xx', 'event_time': 1610182783, 'authorizations': [{'enterprise_id': None, 'team_id': 'xx', 'user_id': 'xx', 'is_bot': True, 'is_enterprise_install': False}], 'is_ext_shared_channel': False, 'event_context': '1-message-xxx'})

Reproducible in:

The slack_bolt version

(Paste the output of pip freeze | grep slack)

slack-bolt==1.1.4
slack-sdk==3.1.0
slackclient==2.9.3
slackeventsapi==2.2.1

Python runtime version

(Paste the output of python --version)

Python 3.9.1

OS info

(Paste the output of sw_vers && uname -v on macOS/Linux or ver on Windows OS)

ProductName:	Mac OS X
ProductVersion:	10.15.7
BuildVersion:	19H2
Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64

Steps to reproduce:

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

1.curl -X POST -H 'Content-type: application/json' --data '{"text":"apply connector"}' https://hooks.slack.com/services/xxxxxx
2. and your bot:
3.

@app.message(regcomplie("(apply .*)"))
async def apply_connector_config_from_last_commit(message, client, say, logger):
    logger.debug(message)

Expected result:

Bot can recognize message and print message

Actual result:

Bot cannot recognize, message is unhandled message

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.

Activity

  1. added this to the 1.2.0 milestone on Jan 10, 2021
  2. seratch commented on Jan 10, 2021

    @seratch
    Contributor

    @uc-dang-tiki Thank you for taking the time to report this issue. I've confirmed this situation can arise when a message is posted by a classic app (= the app that still uses the old permission model).

    I've submitted a pull request to resolve this at #198 - the change will be merged shortly. We are going to release a new version within a few days. The change will be included in it.

  3. uc-dang-tiki commented on Jan 10, 2021

    @uc-dang-tiki
    Author

    Thanks for your quick fix 👍

  4. added a commit that references this issue on Jan 12, 2021
    47063fa
  5. mariebarrramsey commented on Apr 22, 2021

    @mariebarrramsey

    Hello, I'm having the same error but when using socket mode for my app. I've gone through all the steps here: https://github.com/slackapi/bolt-python but keep getting the same error "Unhandled request" with ({'token': 'xxx', 'team_id': 'xxx', 'api_app_id': 'xxx', 'event': {'type': 'message', 'subtype': 'bot_message', 'text': ....etc) no matter what.

  6. seratch commented on Apr 22, 2021

    @seratch
    Contributor

    @mariebarrramsey Regarding the event payload handling, there is no difference between Socket Mode and HTTP Mode. Please make sure your app has listeners before the SocketModeHandler#start() method call in your source code. If you see an issue that only happens with Socket Mode, please create a new ticket in this issue tracker with more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions