Triggering an event by listening for a certain message with Slack Bolt (WebClient)

Viewed 10

I've come across a strange issue with the Slack API/Bolt library, whereby listeners which work when triggered by genuine messages (i.e. sent via the Slack GUI) trigger these events with no issues, but messages which should trigger the listener that are sent through code work only very sporadically (maybe once eveery 10-15 times, usually a bit more after you've re-installed your app to the workspace).

The below code is an example listener:

@bolt_app.message("test")
def test_funct(message, say):
    say("found")

The following is an example snippet to produce a message which meets the criteria:

client.chat_postMessage(
            channel="#test-channel",
            text="test"
        )

I've tried using an alias for bot when sending, but no notable difference. Permissions all check out according to the documentation. It's also worth noting that the client configuration is the same for both (we're using the same app and the same tokens etc).

0 Answers
Related