openclaw - ✅(Solved) Fix [Feature]: Telegram: Display pairing code in a Markdown code block for easier copy/paste [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#52761Fetched 2026-04-08 01:19:49
View on GitHub
Comments
2
Participants
2
Timeline
12
Reactions
0
Author
Timeline (top)
mentioned ×3subscribed ×3commented ×2closed ×1

When OpenClaw returns a pairing code, the code is currently shown as plain text inside a normal message. This makes it less convenient to copy, especially in chat clients or terminal-style outputs where users may accidentally select extra text or miss part of the code.

It would be better to render the pairing code inside a dedicated Markdown code block. The approval command could also be shown in its own code block for consistency and easier copying.

Example:

OpenClaw: access not configured.

Your Telegram user id: 58466xxxx

Pairing code: CLD9xxxx

Ask the bot owner to approve with:

openclaw pairing approve telegram CLD9xxxx

Error Message

  1. The approval command and pairing code are both copy-sensitive, so clearer formatting would reduce user error.

Root Cause

Overall, this change should improve completion rate for pairing and reduce minor support/debugging overhead caused by formatting-related user mistakes.

Fix Action

Fixed

PR fix notes

PR #52784: Telegram: format pairing challenge for easier copy

Description (problem / solution / changelog)

Summary

  • Format Telegram pairing challenge content so copy-sensitive values are easier to use.
  • Render the pairing code and the approval command in fenced code blocks in pairing messages.
  • Send Telegram DM pairing replies with Telegram HTML rendering (parse_mode: "HTML") so code blocks display correctly in Telegram clients.
  • Update pairing and Telegram tests to assert the new formatting behavior.

Why

Pairing codes and approval commands are copy-sensitive. Plain text formatting makes copy/paste error-prone in chat UIs. Code-block presentation improves readability and reduces setup friction.

Scope

  • src/pairing/pairing-messages.ts
  • extensions/telegram/src/dm-access.ts
  • src/pairing/pairing-messages.test.ts
  • extensions/telegram/src/dm-access.test.ts
  • extensions/telegram/src/bot.create-telegram-bot.test.ts

Test plan

  • pnpm test -- src/pairing/pairing-messages.test.ts extensions/telegram/src/dm-access.test.ts extensions/telegram/src/bot.create-telegram-bot.test.ts
  • Manually verified Telegram pairing challenge now shows:
    • One code block for pairing code
    • One code block for full approve command

Related issue

Before

<img width="378" height="210" alt="image" src="https://github.com/user-attachments/assets/0351b95a-a2a7-434c-9636-859b3ef4960d" />

After

<img width="442" height="340" alt="Screenshot From 2026-03-23 16-01-12" src="https://github.com/user-attachments/assets/26b6e188-bf83-4531-a1e2-564d00ff0bbc" />

Changed files

  • extensions/telegram/src/bot.create-telegram-bot.test.ts (modified, +16/-6)
  • extensions/telegram/src/dm-access.test.ts (modified, +6/-2)
  • extensions/telegram/src/dm-access.ts (modified, +3/-1)
  • src/pairing/pairing-messages.test.ts (modified, +3/-1)
  • src/pairing/pairing-messages.ts (modified, +8/-2)

Code Example

openclaw pairing approve telegram CLD9xxxx
RAW_BUFFERClick to expand / collapse

Summary

When OpenClaw returns a pairing code, the code is currently shown as plain text inside a normal message. This makes it less convenient to copy, especially in chat clients or terminal-style outputs where users may accidentally select extra text or miss part of the code.

It would be better to render the pairing code inside a dedicated Markdown code block. The approval command could also be shown in its own code block for consistency and easier copying.

Example:

OpenClaw: access not configured.

Your Telegram user id: 58466xxxx

Pairing code: CLD9xxxx

Ask the bot owner to approve with:

openclaw pairing approve telegram CLD9xxxx

Problem to solve

The current plain-text presentation creates unnecessary friction in the pairing flow:

  1. The pairing code is less visually distinct.
  2. Users may accidentally copy surrounding text.
  3. Copying is less convenient on Telegram and similar chat surfaces.
  4. The approval command and pairing code are both copy-sensitive, so clearer formatting would reduce user error.

Using Markdown code blocks would improve readability, make the important values stand out, and make the whole pairing experience more user-friendly.

Proposed solution

Using Markdown code blocks warp pairing command.

Alternatives considered

No response

Impact

This is a small UX improvement, but it has a direct effect on the success and smoothness of the pairing flow.

  • Reduces copy/paste mistakes for the pairing code and approval command
  • Makes the most important values visually obvious in chat-based and terminal-like interfaces
  • Improves usability on Telegram and other clients where selecting plain text can be awkward
  • Lowers friction for first-time setup and reduces avoidable user confusion
  • Creates a more consistent and polished output format for sensitive, copyable values

Overall, this change should improve completion rate for pairing and reduce minor support/debugging overhead caused by formatting-related user mistakes.

Evidence/examples

No response

Additional information

No response

extent analysis

Fix Plan

To improve the pairing flow by rendering the pairing code and approval command in dedicated Markdown code blocks, follow these steps:

  • Modify the message formatting to use Markdown code blocks for the pairing code and approval command.
  • Update the code to generate the message with the new formatting.

Example code snippet in Python:

def generate_pairing_message(pairing_code, user_id):
    message = f"""
OpenClaw: access not configured.

Your Telegram user id: {user_id}

```python
Pairing code: {pairing_code}

Ask the bot owner to approve with:

openclaw pairing approve telegram {pairing_code}

""" return message

* Replace the existing message generation code with the updated function.

### Verification
To verify the fix, test the pairing flow and check that:
* The pairing code is displayed in a Markdown code block.
* The approval command is displayed in a Markdown code block.
* The code blocks are correctly formatted and easy to copy.

### Extra Tips
* Ensure that the Markdown code blocks are properly escaped to prevent any formatting issues.
* Consider adding a test case to verify the correct formatting of the pairing message.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING