Skip to content

fix(tgbotapi): webhook inline responses ('method=' not 'TelegramMethod=') and chunked response bodies - #15

Merged
trakhimenok merged 1 commit into
mainfrom
fix-webhook-inline-response
Jul 29, 2026
Merged

fix(tgbotapi): webhook inline responses ('method=' not 'TelegramMethod=') and chunked response bodies#15
trakhimenok merged 1 commit into
mainfrom
fix-webhook-inline-response

Conversation

@trakhimenok

Copy link
Copy Markdown
Contributor

Two fixes surfaced by chatwright e2e testing of the chess extension:

  1. ReplyToResponse wrote TelegramMethod= instead of method= in the urlencoded webhook reply. The Bot API expects method (docs), so inline webhook responses have most likely been dead in production too — every reply silently fell back to direct API calls. ⚠️ Merging activates this path: bots will start answering via webhook response where they previously made an extra HTTP call. Behavior change worth a conscious review.
  2. MakeRequest only read response bodies when ContentLength > 0 — chunked/no-length responses (e.g. test emulators, some proxies) unmarshalled nil bytes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RdhN3imH93tZ3M2mz9oFGi

ReplyToResponse wrote 'TelegramMethod=' in the urlencoded webhook reply;
the Bot API expects 'method=', so inline responses were silently ignored
(by Telegram and by test emulators alike) and every reply fell back to
direct API calls. MakeRequest skipped reading bodies without a
Content-Length header (chunked responses), unmarshalling nil bytes.

Found by chatwright e2e for the chess extension: the emulator parses the
inline response exactly as Telegram documents it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RdhN3imH93tZ3M2mz9oFGi
@trakhimenok
trakhimenok force-pushed the fix-webhook-inline-response branch from 243fe45 to 35f80a9 Compare July 27, 2026 10:50
@trakhimenok
trakhimenok force-pushed the main branch 2 times, most recently from 139aaee to edb2a76 Compare July 28, 2026 11:35
@trakhimenok
trakhimenok merged commit fdf0c39 into main Jul 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant