Skip to content

[Bug]: OpenClaw Telegram Topic/Thread Support Broken for Skills and Message Tool #14032

@spidgrou

Description

@spidgrou

Summary

OpenClaw fails to properly support Telegram topic/thread replies for skills and the message tool. Responses are always sent to the "general" topic instead of the correct thread, even when replyTo parameters are used. The issue can be bypassed by using the Telegram Bot API directly, confirming this is an OpenClaw bug.

Environment

  • OpenClaw Version: 2026.2.9
  • OS: Linux 6.12.57+deb12-amd64 (x64)
  • Node: v22.22.0
  • Telegram Configuration: Supergroup with forum topics enabled

Configuration

openclaw.json Telegram section (anonymized):

"telegram": {
  "enabled": true,
  "groups": {
    "<CHAT_ID>": {
      "requireMention": false,
      "groupPolicy": "open",
      "topics": {
        "7": {
          "requireMention": false
        }
      }
    }
  }
}

Problem Description

When a skill or agent attempts to reply to a message in a Telegram topic/thread, the response is incorrectly routed to the "general" topic instead of staying in the same thread.

Expected Behavior

  • Skill responses should remain in the same topic/thread as the triggering message
  • openclaw.tools.message.send() with replyTo parameter should respect thread context
  • Telegram's reply_to_message_id should propagate through OpenClaw

Actual Behavior

  • All skill responses go to "general" topic
  • message tool with replyTo parameter ignores thread context
  • Only direct Telegram Bot API calls work correctly

Evidence and Testing

1. Skill Return Text (FAILS)

Code:

async run(context) {
  return {
    text: "Response text",
    done: true
  };
}

Result: Response goes to "general" topic ❌

2. Message Tool with replyTo (FAILS)

Code:

await openclaw.tools.message.send({
  session,
  text: "Response text",
  replyTo: message.id
});

Result: Response goes to "general" topic ❌

3. Telegram Bot API Direct Call (WORKS)

Code:

await axios.post(`https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`, {
  chat_id: chatId,
  text: "Response text",
  reply_to_message_id: messageId,
  parse_mode: "Markdown"
});

Response from Telegram API:

{
  "ok": true,
  "result": {
    "message_id": 957,
    "message_thread_id": 7,
    "is_topic_message": true,
    "reply_to_message": {
      "message_id": 954,
      "message_thread_id": 7
    }
  }
}

Result: Response correctly stays in topic 7 ✅

Logs Analysis

OpenClaw session logs correctly identify the topic:

"lane enqueue: lane=session:agent:main:telegram:group:<CHAT_ID>:topic:7"

However, the topic context is not propagated to skill responses or message tool calls.

Impact

  • Skills cannot participate in threaded conversations - Limits utility in forum-style groups
  • User experience degraded - Users must manually navigate to "general" to see skill responses
  • Workaround required - Developers must bypass OpenClaw and use Telegram API directly

Root Cause Hypothesis

OpenClaw is not properly handling:

  1. message_thread_id from incoming Telegram messages
  2. Propagation of thread context to skill execution environment
  3. reply_to_message_id parameter when sending messages via Telegram channel

Workaround (Current Solution)

Skills must use Telegram Bot API directly instead of OpenClaw's message tools:

// Instead of OpenClaw message tool
await openclaw.tools.message.send({ session, text: "...", replyTo: message.id });

// Use Telegram API directly
await axios.post(`https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`, {
  chat_id: message.chat.id,
  text: "...",
  reply_to_message_id: message.id,
  parse_mode: "Markdown"
});

Recommendations for Fix

  1. Propagate message_thread_id from incoming Telegram messages to skill context
  2. Support reply_to_message_id in Telegram channel message sending
  3. Add thread/topic awareness to OpenClaw's message routing system
  4. Update documentation with examples for topic-aware skill development

Reproduction Steps

  1. Create a Telegram supergroup with topics enabled
  2. Configure OpenClaw with topic settings
  3. Create a simple skill that responds to a command
  4. Invoke the skill from within a topic thread
  5. Observe response appears in "general" instead of the thread

Related Issues

Additional Context

This bug significantly impacts the usability of OpenClaw in community/forum settings where threaded conversations are essential. The workaround (direct Telegram API calls) adds complexity and reduces portability of skills across different channels.


Status: Confirmed bug with working workaround
Priority: High (breaks core functionality in forum-style groups)
Assignee: OpenClaw Telegram channel maintainer

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions