1

I am working on a note taking Slack bot and I keep getting the 429_client_error. First of all, is it the same error as the 429 too many requests error describe in the Slack API documentation here ? If not, what is it ?

If it is indeed due to the Slack rate limits, I don't understand. I printed a log of all the bot answers and they are sent at least a second apart. I also have the error even when I use the note taking bot "very slowly" and wait between requests.

Here is an exemple of interaction.

User : I want to add a note.

Slack-Bot : Sure. What is the content of your note ?

User : I met with my Abigail yesterday. I need to send him the pictures I took Saturday.

Slack-Bot : Go on.

User : I am done.

Slack-Bot : Great. You can add one of the following participants to your note.

  1. Abigail Allan
  2. Brian Bernard
  3. Carl Carlson
  4. Done

At this last part, I use interactive messages with buttons to propose participants. Behind the scenes, I actually load more than 3 people, so when the user chooses to add Brian for example, my bot replaces the whole message with a new list of participants the user can choose from. Then, when the user is done, he has to select the last button "done".

In other words, I have a list of buttons that keeps updating each time the user select one item in the list until the user is satisfied.

This seems to be part of the problem, since I seem to get the 429_client_error only at this stage of the conversation. I use delays to ensure that the Slack bot does not answer too fast for the user. I don't understand what is the problem.

1 Answers1

0

I ran into the same issue on a python application for slack and found a discussion about it in the slacker github repo.

According to the slacker main developer os, the solution are local caches of the information. They're even providing a sample code here:

from slacker import Users

class CachedUsers(Users):
    def __init__(self, *args, **kwargs):
        super(Users, self).__init__(*args, **kwargs)
        self.user_ids = {}

    def get_user_id(self, user_name):
        user_id = self.user_ids.get(user_name)

        if not user_id:
            user_id = super().get_user_id(user_name)
            self.user_ids[user_name] = user_id

        return user_id

If you're looking into stuff that cannot be cached locally before, check out the rate limits you can find the tier on each method in the Slack API.

m02ph3u5
  • 3,022
  • 7
  • 38
  • 51