communication rate_limiting ai_generated true

Slack API returns 429 Too Many Requests on one method while other methods work fine

ID: communication/slack-rate-limit-per-method-not-global

Also available as: JSON · Markdown
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

Slack rate limits are per-method and per-workspace, not global. chat.postMessage has ~1 req/sec per channel. conversations.list has different limits. Hitting the limit on one method doesn't affect others. The Retry-After header tells you exactly how long to wait.

generic

Workarounds

  1. 92% success Implement per-method rate limiting using Slack's published tier limits
    Tier 1: 1/min, Tier 2: 20/min, Tier 3: 50/min, Tier 4: 100/min. chat.postMessage is Tier 2-3 depending on context.
  2. 95% success Always respect the Retry-After header on 429 responses
    retry_after = int(response.headers.get('Retry-After', 1)); time.sleep(retry_after)
  3. 88% success Use Slack's Web API with built-in rate limit handling (slack_sdk)
    from slack_sdk import WebClient; client = WebClient(token=token)  # automatically handles rate limits with retries

Dead Ends

Common approaches that don't work:

  1. Implement a single global rate limiter for all Slack API calls 82% fail

    Rate limits are per-method. A global limiter is either too restrictive (slows unaffected methods) or too loose (still hits per-method limits).

  2. Retry immediately on 429 response 88% fail

    Immediate retry will also be rate-limited. Always respect the Retry-After header value.