oclaw/docs/GATEWAY_TELEGRAM_NORMALIZATION.md
oliver 4a23b715a2 重构仓库目录为统一的 runtime 分层并清理历史 openclaw 残留。
本次迁移将网关/通道/工具/技能/脚本与协议资源集中到新结构,统一路径常量与脚本转发机制,减少顶层噪音并保证运行与测试行为一致。

Made-with: Cursor
2026-04-25 01:24:23 +08:00

1.2 KiB

Gateway Telegram Normalization

This document describes how gateway send-related handlers normalize Telegram transport targets.

Scope

Normalization is applied in these handlers:

  • send
  • chat.send
  • sessions.send

The shared implementation lives in oclaw/interfaces/gateway/server_methods/telegram_send_normalize.py.

Input fields

When channel == "telegram", the normalizer reads:

  • to
  • threadId (optional)
  • replyToId (optional)

Supported to examples:

  • telegram:group:-100123:topic:42
  • telegram:-100123:42
  • @username
  • https://t.me/username

Output fields

The normalizer returns:

  • normalized to
  • target:
    • chatId
    • chatType (direct | group | unknown)
    • messageThreadId (when present in target)
  • threadId (normalized integer if present/resolved)
  • replyToMessageId (normalized integer if present)

Precedence

  • threadId in request params overrides thread inferred from target suffix.
  • replyToId is converted to replyToMessageId if numeric; otherwise omitted.

Notes

  • Non-Telegram channels pass through unchanged.
  • Normalized fields are included in handler payloads and in forwarded params for chat.send -> enqueue_chat_send.