openclaw - 💡(How to fix) Fix Telegram edit action: support editMessageCaption and editMessageReplyMarkup for media messages

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

GrammyError: Call to 'editMessageText' failed! (400: Bad Request: there is no text in the message to edit)

Fix Action

Fix / Workaround

Current Workarounds Attempted

Code Example

GrammyError: Call to 'editMessageText' failed! (400: Bad Request: there is no text in the message to edit)

---

if only presentation changed → editMessageReplyMarkup
else if target message is media → editMessageCaption
else → editMessageText
RAW_BUFFERClick to expand / collapse

Problem

The message tool's edit action always calls Telegram's editMessageText API method. This fails on photo/media messages with:

GrammyError: Call to 'editMessageText' failed! (400: Bad Request: there is no text in the message to edit)

Use Case

We send daily vision board images (photo + caption + inline keyboard buttons). When a user clicks an inline button, we want to update the button label (e.g., "Darren" → "Darren ✅") and style (primary → success) without changing the photo or caption.

Requested Changes

The edit action should detect the message type and use the appropriate Telegram Bot API method:

  1. editMessageReplyMarkup — when only presentation (inline keyboard) is being changed, no text/caption update needed
  2. editMessageCaption — when editing the caption of a media message (photo, video, document, animation)
  3. editMessageText — current behavior, for text-only messages

Suggested logic:

if only presentation changed → editMessageReplyMarkup
else if target message is media → editMessageCaption
else → editMessageText

Current Workarounds Attempted

  • Separating buttons into a follow-up text message (worse UX, 2 messages per image)
  • Using react action (requires messageId from callback context, not always available)
  • Passing caption param to edit (tool requires message field, then calls editMessageText anyway)

Environment

  • Channel: Telegram
  • Grammy bot framework
  • Inline keyboard buttons with callback data

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Telegram edit action: support editMessageCaption and editMessageReplyMarkup for media messages