Course contentsShow
← AI Engineering
Lesson 1826 of 1,88644. Integrations and EcosystemFree lesson

Rate Limiting and Platform Constraints

Handling API rate limits, message length restrictions, typing indicators, and platform-specific throttling.

Rate Limiting and Platform Constraints

What you'll learn: How to handle API rate limits, message restrictions, and platform-specific throttling when building AI-powered communication bots.

The Challenge of Platform Boundaries

When your AI bot communicates through platforms like Slack, Discord, or Microsoft Teams, you're not just constrained by LLM API limits—you must also respect each platform's specific guardrails. These include message rate limits (messages per second), character limits per message, typing indicator duration caps, and file upload throttling.

Core Constraint Categories

API Rate Limits

Most platforms enforce per-minute or per-second request limits. Slack might allow 1 message per second per channel, while Discord has burst allowances with cooldowns. Exceeding these triggers 429 errors or temporary blocks.

Message Length Restrictions

Slack limits messages to ~40,000 characters, Discord to 2,000 (4,000 for Nitro). Long LLM outputs must be chunked intelligently—splitting mid-sentence breaks user experience.

Typing Indicators and Presence

Showing "Bot is typing..." improves UX, but platforms timeout these indicators (typically 3-5 seconds). You can't just set it once for a 30-second LLM call—you must refresh it periodically.

Platform-Specific Throttling

Teams might throttle bot mentions, Discord limits embed fields, Slack rate-limits file uploads differently than messages. Each requires custom handling logic.

Practical Handling Patterns

Queue outgoing messages with configurable delays between sends. Pre-chunk responses based on platform limits before sending. Implement retry logic with exponential backoff for 429 responses. Refresh typing indicators every 2-3 seconds during long operations. Cache platform limit metadata to avoid trial-and-error production failures.

Key Takeaway: Building production communication bots requires treating platform constraints as first-class requirements—rate limit awareness, message chunking, and typing indicator management are as critical as your LLM prompt design.