Skip to content

[Bug]: Telegram outbound sendPayload bypasses text chunking, drops messages over 4096 chars #28851

@kckylechen1

Description

@kckylechen1

Description

When an outbound Telegram message includes channelData (e.g., inline buttons, quote text), the delivery path goes through telegramOutbound.sendPayload() instead of sendText(). The sendPayload path sends the full text in a single sendMessage API call without chunking, causing Telegram to reject it with 400: Bad Request: message is too long.

The message then enters the delivery-recovery queue, retries, and is eventually permanently skipped (1 skipped (max retries)), silently dropping the user's message.

Root Cause

src/channels/plugins/outbound/telegram.ts — the telegramOutbound adapter correctly configures:

chunker: markdownToTelegramHtmlChunks,
textChunkLimit: 4000,

But these only take effect for the sendText path (via deliver.tssendTextChunks). The sendPayload path (L103-108) directly calls send(to, text, ...) without splitting.

Steps to Reproduce

  1. Have an OpenClaw agent generate a response longer than 4096 characters
  2. The response includes channelData.telegram (e.g., inline buttons)
  3. Observe in gateway logs:
    telegram message failed: Call to 'sendMessage' failed! (400: Bad Request: message is too long)
    Delivery recovery complete: 0 recovered, 0 failed, 1 skipped (max retries)
    

Expected Behavior

Long messages should be automatically split into chunks ≤4000 chars using the existing markdownToTelegramHtmlChunks chunker, with inline buttons attached to the last chunk.

Environment

  • OpenClaw 2026.2.26
  • macOS (Darwin arm64)
  • Node 25.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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