openclaw - ✅(Solved) Fix Telegram callback_query should include message_id [1 pull requests, 1 participants]

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…
GitHub stats
openclaw/openclaw#55462Fetched 2026-04-08 01:39:13
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1referenced ×1
  • Telegram's callback_query object already includes message.message_id — it just needs to be forwarded to the agent.
  • The editMessage action already exists and accepts chatId + messageId, so the only missing piece is passing the message ID from the callback.

Root Cause

  • Telegram's callback_query object already includes message.message_id — it just needs to be forwarded to the agent.
  • The editMessage action already exists and accepts chatId + messageId, so the only missing piece is passing the message ID from the callback.

Fix Action

Fixed

PR fix notes

PR #55548: fix: include message_id in Telegram callback_query data (#55462)

Description (problem / solution / changelog)

Summary

  • Fixes #55462
  • Telegram callback_query handler now includes callback_message_id from the source message
  • Enables agents to use editMessage in response to inline button clicks

Test plan

  • Send a message with inline buttons via Telegram bot
  • Click a button and verify the agent receives callback_message_id alongside callback_data

Changed files

  • extensions/telegram/src/bot-handlers.runtime.ts (modified, +1/-0)
  • extensions/telegram/src/bot-message-context.session.ts (modified, +1/-0)
  • extensions/telegram/src/bot-message-context.types.ts (modified, +2/-0)
  • src/auto-reply/reply/agent-runner-utils.ts (modified, +6/-1)
  • src/auto-reply/reply/inbound-meta.ts (modified, +4/-0)
  • src/auto-reply/templating.ts (modified, +2/-0)

Code Example

callback_data: weather_today

---

callback_data: weather_today
callback_message_id: 363

---

callback_data: weather_today (message_id: 363, chat_id: 507911743)
RAW_BUFFERClick to expand / collapse

Problem

When a user clicks an inline button in Telegram, OpenClaw passes only callback_data: <value> to the agent session. The original message's message_id is not included.

This makes it impossible for the agent to use editMessage to update the original message in response to button clicks — a common UX pattern (e.g., switching between tabs/views in a single message).

Current behavior

Agent receives:

callback_data: weather_today

Expected behavior

Agent should also receive the source message ID, e.g.:

callback_data: weather_today
callback_message_id: 363

Or in a structured format like:

callback_data: weather_today (message_id: 363, chat_id: 507911743)

Use case

A weather bot sends a message with three inline buttons: Today, Tomorrow, Week. When the user clicks a button, the bot should edit the same message to show the selected weather view, keeping the buttons intact. This requires knowing the message_id of the original message.

Context

  • Telegram's callback_query object already includes message.message_id — it just needs to be forwarded to the agent.
  • The editMessage action already exists and accepts chatId + messageId, so the only missing piece is passing the message ID from the callback.

extent analysis

Fix Plan

To fix this issue, we need to modify the OpenClaw code to include the message_id in the callback data. Here are the steps:

  • Modify the callback handler to extract the message_id from the Telegram callback_query object.
  • Add the message_id to the callback data sent to the agent.

Example code:

# Assuming the callback handler is a Python function
def handle_callback(query):
    # Extract the message_id from the callback_query object
    message_id = query.message.message_id
    
    # Create a structured callback data object
    callback_data = {
        'callback_data': query.data,
        'message_id': message_id,
        'chat_id': query.message.chat.id
    }
    
    # Send the callback data to the agent
    send_to_agent(callback_data)

Alternatively, you can also use a string format to include the message_id in the callback data:

callback_data = f"{query.data} (message_id: {query.message.message_id}, chat_id: {query.message.chat.id})"

Verification

To verify that the fix worked, you can:

  • Test the weather bot use case and check if the message is updated correctly when a button is clicked.
  • Check the agent logs to ensure that the message_id is being received correctly.

Extra Tips

  • Make sure to handle cases where the message_id is not available (e.g., if the message has been deleted).
  • Consider adding error handling to ensure that the agent can handle cases where the message_id is invalid or missing.

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…

FAQ

Expected behavior

Agent should also receive the source message ID, e.g.:

callback_data: weather_today
callback_message_id: 363

Or in a structured format like:

callback_data: weather_today (message_id: 363, chat_id: 507911743)

Still need to ship something?

×6

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

Back to top recommendations

TRENDING