Search code examples
python-3.xslack-apirtm

Nothing happening while listening for messages using Slack RTM API


I have a classic app key without granular permissions, and the key works when I test it using Slack's api tester for rtm.start. But when I try to run the code bellow, nothing happens after rtm_client.start. the message "I'm listening" in list_message() never prints. There are no error messages, I've tried posting messages to General, to other public channels, and messaging the App directly. Nothing ever happens and the Python script just keeps running.

from slack import RTMClient

@RTMClient.run_on(event="message")
def list_message(**payload):
    print("I'm listening")


rtm_client = RTMClient(
    token="xoxb-XXXXXXXXXX"
)

rtm_client.start()

Solution

  • I ended up getting it to work just a bit ago. It was one of two things:

    1. I reinstalled the app
    2. I messaged the application and got a result. Then I added the application to the channel I was testing in and it worked.

    I suspect the answer is I will need to add the application to every single channel I need it to work in.