SShortSingh.
Back to feed

How to Handle Telegram Bot API Rate Limits and 429 Errors in PHP

0
·1 views

Telegram's Bot API enforces strict rate limits, including roughly one message per second per chat and 30 messages per second globally per bot, returning HTTP 429 errors with a Retry-After value when limits are exceeded. A DEV Community tutorial outlines a PHP-based approach to correctly parse these 429 responses using cURL and extract the retry_after parameter from the JSON body. The guide introduces a per-chat outbound queue that serializes message sends and respects Telegram's authoritative Retry-After delay rather than using arbitrary backoff values. It also covers grouping message bursts to a single chat to stay within the one-message-per-second ceiling and flags common failure patterns during mass broadcasts. The pattern is designed as a drop-in solution for webhook handlers without relying on any specific PHP framework.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

rspec-wasm Lets Developers Write Native RSpec Tests for Ruby WebAssembly Code

A developer has released rspec-wasm, an open-source tool that allows Ruby WebAssembly applications to be tested using standard RSpec syntax instead of embedding Ruby code inside JavaScript template literals. Previously, testing ruby.wasm modules required passing stringified Ruby into a JavaScript VM, manually serializing outputs to JSON, and relying on Node.js assertion libraries. rspec-wasm removes that wrapper layer by executing native RSpec directly within a Node.js-based ruby.wasm virtual machine. The tool supports automatic spec file discovery, full IDE features like syntax highlighting and linting, and requires no local Ruby installation — running instantly via npx. It is aimed at developers building Ruby WebAssembly projects who want a cleaner, more idiomatic testing workflow.

0
ProgrammingDEV Community ·

Why Real-Time Streaming Infrastructure Is Critical for Crypto Analytics

Crypto markets move in milliseconds, making traditional batch-based data pipelines inadequate for reliable analytics. Stale data in crypto contexts can be actively misleading, as even a 500-millisecond-old liquidity snapshot may misrepresent current market conditions. Effective real-time analytics requires four distinct layers: transport, ingestion and ordering, stream processing, and a serving layer — with most teams underinvesting in the middle two. A key technical challenge is handling inconsistent timestamps across exchanges, nodes, and oracles, which can cause windowed aggregations like VWAP to silently produce incorrect results in production. Beyond raw event delivery, meaningful crypto analytics also demands stateful processing, since individual events only carry significance when interpreted against prior market context.

0
ProgrammingDEV Community ·

Developer Builds No-Login CV Builder With Live Preview and Browser-Based Storage

A developer has created an open-source CV builder that requires no account or sign-up, allowing users to begin crafting a resume immediately upon opening the page. The tool renders a live preview with every keystroke using a single vanilla JavaScript function, with no frameworks or external dependencies. PDF export is handled natively via the browser's print function, ensuring the downloaded output matches the on-screen layout exactly. A browser-based key-value storage layer enables auto-save and multiple saved CV versions without any backend server or database. The developer acknowledges current limitations such as no version history and single-environment storage, noting that a future version could incorporate proper authentication and a database if needed.

0
ProgrammingDEV Community ·

Developer Launches Free Coding Platform MAK UI Studio with 30+ Lessons

A developer has built and launched MAK UI Studio, a free coding platform designed to make programming education accessible to absolute beginners without sign-ups, ads, or paywalls. The platform currently offers over 30 lessons across three courses covering HTML, Python, and AI, along with free UI snippets and comprehensive long-form guides. Built entirely with static frontend technologies — HTML, CSS, and JavaScript — the site requires no backend infrastructure, keeping it simple and universally accessible. The creator published lessons consistently at a rate of one per week and noted that interactive, real-time code demos significantly improved the learning experience. Intermediate lessons for all three courses are currently in development, with the long-term goal of making makuistudio.com the most beginner-friendly free coding resource available.