Skip to content

feat(telegram): add copy text button and raise telegram button limit to 10 - #1692

Merged
sung17 merged 2 commits into
mainfrom
feat/telegram-copy-text-button
Nov 11, 2026
Merged

sung17 merged 2 commits into
mainfrom
feat/telegram-copy-text-button

Conversation

@sung17

@sung17 sung17 commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • New flow button type Copy Text (copyText). On Telegram it goes out as a native inline copy_text button (Bot API 7.11): a tap copies the text to the contact's clipboard. A customer asked for this to let leads copy a PIX "copia e cola" payment code returned by a payment API ({{pix_code}}).
  • Telegram flows take up to 10 buttons per message (was 3). Past three buttons, each one gets its own row so labels stay readable on a phone.

How it behaves

  • Telegram: native copy_text. The bot is not told about the tap, so, like a Call Phone Number button, it cannot continue the flow or run steps (steps: max(0)).
  • Other channels: sent as an ordinary reply button. A tap runs the new copyText step handler, which replies with the text (variables resolved again at tap time) so the contact can long-press to copy.
  • Text resolves empty or longer than 256 characters (Telegram's copy limit): on Telegram the button is sent and stored as a reply button instead, with a warn log. It is never dropped, so button counts stay equal.
  • Rejected wherever a Call Phone Number button already is: quick replies, WhatsApp / Messenger template steps, the WhatsApp Flow button (refineReplyOnlyButtons = call + copy).
  • Omnichannel flows and every other channel keep the 3-button limit.

Changes

  • packages/flow-config: copyText step type and button type (steps/copy-text.ts: 256 for a literal, 1,000 for an expression with {{variables}}); Telegram policy nativeButtonTypes: [copyText], buttonCount: 10; sendsAsNativeCopyButton(), the one check every encoder and the stored message use; flow spec copy field on a send button (compiled like call); buttonCopyTextUnsupported validation code.
  • packages/sdk: MessageButtonTemplate gains buttonType: "copyText" (copyText plus a replayable postback).
  • integrations/telegram: copy_text on step and stored buttons, plus the row layout.
  • apps/worker: the stored message records copyText only when it was sent natively; the tap reply handler; a warning for texts that cannot be copied.
  • apps/builder: "Copy Text" button action, offered only on Telegram nodes (offeredButtonsConfig; an existing copy button on another channel stays editable), with a variable-aware text field, a fallback hint, an icon on the canvas, hidden where it is rejected; the inbox renders a stored copy button that copies on click; i18n in all 21 locales.
  • Docs: new "Copy Text buttons" section in docs/flows.md; capabilities nativeButtonTypes description updated.

Behavior change to note

  • On Telegram, any keyboard with 4 or more buttons, including existing quick-reply lists, now shows one button per row instead of three per row.

Test plan

  • pnpm lint (incl. check:invariants, i18n check)
  • pnpm check-types — 66/66
  • Tests: flow-config 1307, worker 5040, builder 10501, telegram 50, sdk 184, messenger 613, zalo 77, all passing (new: copy-text schema/policy/placement/spec/compile, Telegram copy_text + fallback + layout, worker stored button + tap reply, public API copy, canvas icon)
  • invariant-guard agent — no violations
  • Manual on a real Telegram bot: PIX code from a variable copies on tap; a 10-button message; a reply-button fallback on Messenger

🤖 Generated with Claude Code

…to 10

Add a `copyText` flow button type. Telegram sends it as a native inline
`copy_text` button (Bot API 7.11), so a tap copies the text, e.g. a PIX
"copia e cola" code from a variable. Other channels, and texts that resolve
empty or longer than 256 characters, send a reply button whose tap answers
with the text. Like a call button it cannot continue the flow and is
rejected on quick replies, message templates and the WhatsApp Flow button.

Telegram flows now take up to 10 buttons per message; past three buttons
each one gets its own row. Flow specs accept `copy` on a send button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the feature New feature or request label Nov 10, 2026
The builder's button action list hides Copy Text unless the node's channel
copies natively, so other channels no longer see it. A copy button already
on another channel stays editable, and the schema still accepts it there
(reply fallback). Shorten the text field hint to drop the PIX example.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sung17
sung17 merged commit ddfde20 into main Nov 11, 2026
15 checks passed
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
…to 10 (#1692)

* feat(telegram): add copy text button and raise telegram button limit to 10

Add a `copyText` flow button type. Telegram sends it as a native inline
`copy_text` button (Bot API 7.11), so a tap copies the text, e.g. a PIX
"copia e cola" code from a variable. Other channels, and texts that resolve
empty or longer than 256 characters, send a reply button whose tap answers
with the text. Like a call button it cannot continue the flow and is
rejected on quick replies, message templates and the WhatsApp Flow button.

Telegram flows now take up to 10 buttons per message; past three buttons
each one gets its own row. Flow specs accept `copy` on a send button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(telegram): offer the copy text button only on telegram nodes

The builder's button action list hides Copy Text unless the node's channel
copies natively, so other channels no longer see it. A copy button already
on another channel stays editable, and the schema still accepts it there
(reply fallback). Shorten the text field hint to drop the PIX example.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Deathgiver <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant