#17432: fix(telegram): skip message_thread_id for private chats in sticker/poll sends
channel: telegram
size: S
Cluster:
Messaging Platform Improvements
## Summary
Private chats (chatId > 0) don't support `message_thread_id`. This was fixed for `sendMessageTelegram` but not for `sendStickerTelegram` and `sendPollTelegram`, causing 'message thread not found' errors in DMs.
## Changes
Now all three functions check if chatId is positive (private chat) and use scope `'dm'` instead of `'forum'` so `buildTelegramThreadParams` returns undefined and skips the thread parameter.
This is a **proactive fix** that prevents the error entirely, rather than relying on the `sendWithThreadFallback` retry mechanism.
## Test Plan
- Updated existing tests to use negative chatIds (group chats) for testing thread fallback
- Added new test `skips message_thread_id for private chats` in poll tests
- All 65 telegram send tests pass
## Related
Completes the fix from PR #17252 which only addressed `sendMessageTelegram`.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Extends the private chat fix from a previous PR to cover `sendStickerTelegram` and `sendPollTelegram`. These functions now correctly skip `message_thread_id` for private chats (positive chatId) by setting scope to `'dm'`, preventing 'message thread not found' errors in DMs. Tests updated to use negative chatIds for group chat scenarios and new tests added to verify private chat behavior.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no risk
- The fix is straightforward, follows established patterns, has comprehensive test coverage, and completes a previously incomplete fix. The logic correctly distinguishes private chats from groups using Telegram's chatId convention (positive for private, negative for groups).
- No files require special attention
<sub>Last reviewed commit: 4d4865e</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#19050: fix(telegram): skip message_thread_id for private chats to prevent ...
by Limitless2023 · 2026-02-17
90.2%
#14443: fix(telegram): skip General topic thread ID for all chat types (#14...
by lailoo · 2026-02-12
84.2%
#7261: fix(telegram): preserve DM topic thread id for outbound media
by ViffyGwaanl · 2026-02-02
84.1%
#12936: fix(telegram): omit message_thread_id for private DM chats
by omair445 · 2026-02-09
82.5%
#16548: fix(telegram): enhance chat_id validation and diagnostics
by tanujbhaud · 2026-02-14
81.6%
#17952: fix(telegram): support message_thread_id for DM topics
by timbrinded · 2026-02-16
81.1%
#17968: fix(telegram): restore DM topic thread ids with send-path fallback
by Leonccaa · 2026-02-16
79.7%
#19213: Telegram: preserve DM topic thread in direct replies
by Kemalau · 2026-02-17
79.1%
#3368: fix: sessions navigation, DM thread display, and DM thread delivery...
by Lukavyi · 2026-01-28
78.3%
#6192: Telegram: fix DM Topics thread routing
by ViffyGwaanl · 2026-02-01
78.0%