#22763: feat: expose per-message linkPreview param in message tool
channel: telegram
agents
size: M
Cluster:
Telegram Streaming Enhancements
## Summary
Thread `linkPreview` boolean from the message tool schema down through the outbound pipeline to Telegram's send layer, allowing agents to control link preview per-message instead of relying solely on channel config.
## Changes (8 files)
1. **`src/agents/tools/message-tool.ts`** — Add `linkPreview` to send schema
2. **`src/infra/outbound/message-action-runner.ts`** — Read `linkPreview` param
3. **`src/infra/outbound/outbound-send-service.ts`** — Pass through to `sendMessage()`
4. **`src/infra/outbound/message.ts`** — Add to `MessageSendParams`, pass to delivery/gateway
5. **`src/infra/outbound/deliver.ts`** — Thread through delivery params and channel handler
6. **`src/channels/plugins/types.adapters.ts`** — Add to `ChannelOutboundContext`
7. **`src/channels/plugins/outbound/telegram.ts`** — Pass to `sendMessageTelegram()` calls
8. **`src/telegram/send.ts`** — Add to `TelegramSendOpts`, use as override over config
The Telegram send layer already handles `linkPreview: false` → `link_preview_options: { is_disabled: true }`. This PR just threads the value from the tool down to that layer.
Closes #22754
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Threads a new `linkPreview` boolean parameter from the message tool down through the entire outbound messaging pipeline to Telegram's send layer, enabling per-message control of link previews instead of relying solely on channel configuration.
**Key changes:**
- Added `linkPreview` optional boolean to message tool schema with description
- Threaded the parameter through 7 files in the outbound pipeline (`message-action-runner.ts` → `outbound-send-service.ts` → `message.ts` → `deliver.ts` → `types.adapters.ts` → `telegram.ts` → `send.ts`)
- Implemented three-level fallback in `send.ts:472`: per-message override → account config → enabled (default)
- Parameter correctly passed to all Telegram send methods (`sendText`, `sendMedia`, `sendPayload`)
- Consistent use of `?? undefined` pattern to avoid passing `false` when not explicitly set
**Issues found:**
- Log file `openclaw-2026-02-19.log` accidentally committed (should be removed and added to `.gitignore`)
<h3>Confidence Score: 4/5</h3>
- Safe to merge after removing the log file
- The implementation correctly threads the `linkPreview` parameter through all layers with proper fallback logic. The code changes are straightforward and consistent. Only issue is the accidentally committed log file which needs removal before merging.
- Remove `openclaw-2026-02-19.log` before merging
<sub>Last reviewed commit: f9f972a</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#19102: Fix Telegram per-message link preview override
by Clawborn · 2026-02-17
87.2%
#20842: fix(telegram): preserve preview when only error payloads are delivered
by marcodelpin · 2026-02-19
79.6%
#19869: feat(telegram): add disableWebPagePreview option
by bip-bup-bip-bup · 2026-02-18
79.3%
#19399: telegram: fix MEDIA false positives and partial final drop
by HOYALIM · 2026-02-17
77.7%
#19375: telegram: align tool-error summaries
by NorthyIE · 2026-02-17
77.3%
#18678: fix(telegram): preserve draft message when all final payloads are e...
by julianubico · 2026-02-16
76.8%
#11920: Telegram: create forum topics via message tool (thread-create)
by larsderidder · 2026-02-08
75.5%
#22434: feat(telegram): support sending original quality images
by godenjan · 2026-02-21
75.4%
#19213: Telegram: preserve DM topic thread in direct replies
by Kemalau · 2026-02-17
75.3%
#15864: feat: add deliverOnlyToolMessages config for clean messaging channe...
by gandalf-the-engineer · 2026-02-14
75.2%