← Back to Plugins
Channels

Telegram Table Fix

smonett By smonett 👁 45 views ▲ 0 votes

OpenClaw plugin: Converts Markdown tables to mobile-readable card layout for Telegram

GitHub

Configuration Example

{
  "plugins": {
    "entries": {
      "telegram-table-fix": {
        "enabled": true,
        "hooks": {
          "allowConversationAccess": true
        }
      }
    }
  }
}

README

# telegram-table-fix

An OpenClaw plugin that intercepts outbound Telegram messages and converts Markdown tables to a mobile-readable card layout — before delivery, at the transport layer.

## The problem

Telegram does not render Markdown tables. When an LLM generates a table in its response, Telegram users see raw ASCII pipes and dashes — or worse, the platform wraps the table in a code block that's tiny and requires horizontal scrolling on mobile.

This is a runtime formatting problem that belongs in the runtime, not in the model prompt. No amount of "don't use tables in Telegram" system instructions will catch every case.

## The solution

This plugin hooks into `message_sending` and rewrites any Markdown table into a vertical card layout before the message reaches Telegram. The model never knows it happened — it generates the best format for the content, and the plugin handles the channel constraint.

### Card layout (3+ columns)

Input:
```
| Project | Status | Priority |
|---|---|---|
| telegram-table-fix | Testing | P1 |
| agent-stack | 64% coverage | P0 |
```

Output:
```
🔹 **telegram-table-fix**
├ **Status:** Testing
└ **Priority:** P1

🔹 **agent-stack**
├ **Status:** 64% coverage
└ **Priority:** P0
```

### Key-value layout (2 columns)

Input:
```
| Setting | Value |
|---|---|
| Model | claude-sonnet-4-6 |
| Context | continuation-skip |
```

Output:
```
• **Model** — claude-sonnet-4-6
• **Context** — continuation-skip
```

## Why this format?

The card layout was selected after a 4-model frontier panel evaluation (Grok 4.3, Claude Opus 4.7, GPT-5.5-pro, Gemini 3.1 Pro). All four models converged on the same recommendation: **labeled vertical cards** with emoji anchors and box-drawing characters for visual grouping.

Key advantages on mobile Telegram:
- **No horizontal alignment** — survives any screen width
- **Self-describing** — column headers become inline labels, so context is preserved when messages are forwarded or quoted
- **Visual grouping** — emoji anchors (`🔹`) and tree characters (`├`, `└`) make row boundaries obvious at a glance
- **Width-independent** — only uses vertical space; no wrapping breakage

## Installation

### From ClawHub

```bash
clawhub package install telegram-table-fix
```

### Manual

Copy the plugin to your extensions directory:

```bash
cp -r telegram-table-fix ~/.openclaw/extensions/
```

### Configuration

The plugin requires conversation access to read and rewrite outbound messages. Add this to your `openclaw.json`:

```json
{
  "plugins": {
    "entries": {
      "telegram-table-fix": {
        "enabled": true,
        "hooks": {
          "allowConversationAccess": true
        }
      }
    }
  }
}
```

Then restart the gateway (`openclaw gateway restart` or SIGUSR1).

## How it works

1. Hooks into `message_sending` (fires before channel delivery)
2. Checks if the target channel is Telegram (`ctx.channelId`)
3. Scans the message content for Markdown table patterns (`|...|`)
4. Parses tables into headers + rows
5. Converts to the appropriate format (card layout for 3+ columns, key-value for 2 columns)
6. Returns the rewritten content; non-table content passes through unchanged

The plugin only touches messages going to Telegram. All other channels receive the original content unmodified.

## Requirements

- OpenClaw 2026.4.20+
- `plugins.entries.telegram-table-fix.hooks.allowConversationAccess: true` in config
- Telegram channel configured

## License

MIT
channels

Comments

Sign in to leave a comment

Loading comments...