-
Notifications
You must be signed in to change notification settings - Fork 15.5k
fix(telegram): skip message_thread_id for General topic messages #848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(telegram): skip message_thread_id for General topic messages #848
Conversation
773476e to
3821d47
Compare
erik-agens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me and solves an issue that takes a bit of time to debug.
👍
|
Update after upstream refactor The original fix was lost during the
Force-pushed to align with current upstream main. |
abfa3a7 to
fec4ad7
Compare
ad86b93 to
9b44cef
Compare
|
Correction: My previous comment was incorrect. The actual behavior:
Two helper functions:
|
Telegram General topic (id=1) has inconsistent API behavior: - sendMessage: rejects explicit message_thread_id=1 - sendChatAction: requires message_thread_id=1 for typing to show Split into two helper functions: - buildTelegramThreadParams: excludes General topic for messages - buildTypingThreadParams: includes General topic for typing
9b44cef to
6146acb
Compare
Problem
In Telegram forum groups, the General topic uses
thread_id=1. The Telegram Bot API has inconsistent behavior for this topic:sendMessagewithmessage_thread_id=1→ ❌ Rejected ("message thread not found")sendChatAction(typing) withoutmessage_thread_id→ ❌ No typing shownAfter the channels rename refactor, Clawdbot started explicitly sending
message_thread_id=1for messages in the General topic, triggering this error:Investigation
We tested the Telegram Bot API behavior for the General topic:
sendMessagesendChatActionThis is an inconsistency in the Telegram Bot API — it requires opposite handling for messages vs typing indicators.
Solution
Refactored thread handling into two distinct functions to work around the API inconsistency:
buildTelegramThreadParams()For sending messages. Omits
message_thread_idfor General topic (1) — Telegram routes automatically.buildTypingActionParams()For typing indicators (
sendChatAction). Includesmessage_thread_id=1— required by the API for typing to appear.Testing
Tested in a Telegram forum group: