Skip to content

Fix/interactive buttons - #2764

Closed
delapazfonseca21 wants to merge 4 commits into
evolution-foundation:mainfrom
delapazfonseca21:fix/interactive-buttons
Closed

delapazfonseca21 wants to merge 4 commits into
evolution-foundation:mainfrom
delapazfonseca21:fix/interactive-buttons

Conversation

@delapazfonseca21

@delapazfonseca21 delapazfonseca21 commented Oct 23, 2026 •

Copy link
Copy Markdown

📋 Description

Se corrige la renderización de botones interactivos y listas en WhatsApp Web y Desktop.

Previamente, los mensajes de botones (buttonMessage) se envolvían en un wrapper viewOnceMessage, lo que causaba que los botones no se renderizaran correctamente en clientes web/desktop. Este cambio elimina el envoltorio viewOnce y vuelve a la forma original de la stanza, inyectando el nodo biz <biz><interactive/></biz> para botones y <biz><list/></biz> para listas como nodos adicionales (additionalNodes) en el envío de mensajes.

Además, listMessage regresa al formato legado con listType: SINGLE_SELECT, necesario para que se renderice en WhatsApp Web y Desktop (el formato moderno con interactiveMessage + single_select solo funciona en móvil reciente).

🧪 Type of Change

  • [x ] 🐛 Bug fix (non-breaking change which fixes an issue)
  • [x ] ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧹 Code cleanup
  • 🔒 Security fix

🧪 Testing

  • [x ] Manual testing completed
  • [x ] Functionality verified in development environment
  • [x ] No breaking changes introduced
  • Tested with different connection types (if applicable)

✅ Checklist

  • My code follows the project's style guidelines
  • [x ] I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • [x ] I have manually tested my changes thoroughly
  • [x ] I have verified the changes work with different scenarios
  • Any dependent changes have been merged and published

📝 Additional Notes

  • src/api/integrations/channel/whatsapp/helpers/interactiveMessage.helper.ts (nuevo): agrega buildInteractiveBizNode() y buildListBizNode() para construir los nodos biz de WhatsApp.
  • src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:
    • Elimina el wrapper viewOnceMessage de buttonMessage (PIX y generales).
    • buttonMessage ahora usa interactiveMessage con nativeFlowMessage e inyecta [buildInteractiveBizNode()] vía additionalNodes.
    • listMessage usa el formato legado (listMessage + SINGLE_SELECT) e inyecta [buildListBizNode()].
    • Se agrega el parámetro additionalNodes a sendMessage y sendMessageWithTyping para soportar la inyección de nodos biz.

Motivo:

Corrige que los botones interactivos y listas no se renderizaran en WhatsApp Web y Desktop debido al envoltorio viewOnce y al uso del formato moderno de mensajes interactivos incompatibles con esos clientes.

Summary by Sourcery

Fix WhatsApp interactive button and list delivery across web, desktop, and mobile clients.

Bug Fixes:

  • Restore WhatsApp interactive buttons and lists so they render correctly in WhatsApp Web and Desktop.
  • Remove incompatible view-once wrapping and add the required WhatsApp business metadata for interactive messages.
  • Use the legacy single-select list message format for cross-client compatibility.

Enhancements:

  • Add reusable helpers for constructing interactive and list business nodes and native-flow button payloads.
  • Extend message sending APIs to support additional protocol nodes and enforce button-type compatibility limits.

Build:

  • Use the fast tsup configuration for Docker builds and include it in the final image.

José De La Paz added 4 commits August 11, 2026 20:06
- Add interactiveMessage.helper.ts with buildInteractiveBizNode and buildListBizNode
- Remove viewOnceMessage wrapper from buttonMessage (PIX + general)
- Switch listMessage to legacy format with SINGLE_SELECT listType
- Add additionalNodes parameter to sendMessage and sendMessageWithTyping
- Inject <biz><interactive/></biz> node for buttons and <biz><list/></biz> for lists

This fixes button/list rendering on WhatsApp Web and Desktop clients.
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Fixes WhatsApp Web/Desktop rendering for interactive buttons and lists by using compatible message payloads and injected Biz nodes, while extending the send pipeline to carry those nodes. The Docker image build is also switched to a new fast tsup configuration.

Sequence diagram for WhatsApp interactive message delivery

sequenceDiagram
    participant API
    participant BaileysStartupService
    participant WhatsApp
    participant WebDesktop

    API->>BaileysStartupService: sendMessageWithTyping
    BaileysStartupService->>BaileysStartupService: buildInteractiveBizNode
    BaileysStartupService->>WhatsApp: relayMessage with interactiveMessage and additionalNodes
    WhatsApp-->>WebDesktop: Render native flow buttons
Loading

Sequence diagram for legacy WhatsApp list delivery

sequenceDiagram
    participant API
    participant BaileysStartupService
    participant WhatsApp
    participant WebDesktop

    API->>BaileysStartupService: listMessage
    BaileysStartupService->>BaileysStartupService: buildListBizNode
    BaileysStartupService->>WhatsApp: relayMessage with listMessage SINGLE_SELECT and additionalNodes
    WhatsApp-->>WebDesktop: Render selectable list
Loading

Flow diagram for compatible WhatsApp message payload selection

flowchart LR
    A[Interactive message request] --> B{Message type}
    B -->|Buttons| C[interactiveMessage with nativeFlowMessage]
    C --> D[buildInteractiveBizNode]
    B -->|List| E[listMessage with SINGLE_SELECT]
    E --> F[buildListBizNode]
    D --> G[sendMessageWithTyping]
    F --> G
    G --> H[relayMessage with additionalNodes]
    H --> I[WhatsApp Web/Desktop rendering]
Loading

File-Level Changes

Change Details Files
Reworks WhatsApp interactive button and list serialization to render correctly on Web/Desktop by removing view-once wrappers, selecting compatible payload formats, and injecting Biz metadata nodes.
  • Adds builders for native-flow and legacy list Biz nodes.
  • Sends PIX and CTA/reply buttons as direct interactive messages with additionalNodes metadata.
  • Restores lists to listMessage with SINGLE_SELECT and injects the corresponding Biz node.
  • Adds CTA validation and preserves restrictions on button combinations and counts.
src/api/integrations/channel/whatsapp/helpers/interactiveMessage.helper.ts
src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
Extends the Baileys send pipeline to propagate optional extra binary nodes through typed message relay paths.
  • Adds additionalNodes parameters to message-sending methods.
  • Passes nodes to relayMessage when present.
src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
Introduces a dedicated fast container build configuration and updates the Docker build to use it.
  • Uses tsup.config.fast.ts instead of the standard build configuration.
  • Defines non-minified CJS/ESM output without sourcemaps and copies translations after building.
  • Updates builder and final-stage file references.
Dockerfile
tsup.config.fast.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. The changed PIX flow can send payment details or an incorrectly rendered payment button to WhatsApp recipients; messages already delivered cannot be recalled by reverting, though a revert stops future sends.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@delapazfonseca21

Copy link
Copy Markdown
Author

Error

@delapazfonseca21
delapazfonseca21 deleted the fix/interactive-buttons branch October 23, 2026 09:09
@delapazfonseca21
delapazfonseca21 restored the fix/interactive-buttons branch October 23, 2026 09:17
@delapazfonseca21
delapazfonseca21 deleted the fix/interactive-buttons branch October 23, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant