Commit Graph

2679 Commits

Author SHA1 Message Date
Claude dede2fa3c0 fix(carousel): skip segundo create() + tctoken + ephemeral para corrigir 479
Três correções para eliminar erro 479 em dispositivos vinculados:

1. Skip WAProto.Message.create() em generateWAMessageFromContent para carousel
   - O carousel já foi processado com fromObject() (conversão profunda)
   - O segundo create() faz cópia rasa que pode perder tipos protobuf nested
   - Preserva a estrutura deep: cards > headers > imageMessage > nativeFlowMessage

2. Skip tctoken no stanza para carousel
   - Implementações que funcionam não incluem tctoken para carousel
   - Pode causar rejeição 479 em dispositivos vinculados (Web/Desktop)

3. Skip contextInfo.expiration (ephemeral) para carousel
   - Se mensagens temporárias estão ativadas, contextInfo.expiration era
     adicionado ao interactiveMessage, o que pode causar 479
   - Implementações que funcionam não passam por generateWAMessageFromContent

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 20:56:11 +00:00
Renato Alcara c2f3aed0c4 fix(carousel): usar fromObject + viewOnceMessage para compatibilidade…
fix(carousel): usar fromObject + viewOnceMessage para compatibilidade…
2026-02-06 17:32:43 -03:00
Claude 4037b3fcdd fix(carousel): usar fromObject + viewOnceMessage para compatibilidade Web/Desktop
Mudanças críticas para renderização do carousel em dispositivos vinculados:

1. Wrap carousel em viewOnceMessage para compatibilidade multi-device (MD)
2. Usar WAProto.Message.fromObject() ao invés de create() para conversão
   profunda das estruturas nested (header, cards, nativeFlowMessage)
3. Adicionar root header com título no interactiveMessage
4. Retorno antecipado do carousel (sem messageContextInfo/reportingToken)

A diferença entre fromObject e create:
- fromObject: converte recursivamente objetos JS para tipos protobuf
- create: cópia rasa que pode não codificar corretamente estruturas deep

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 20:19:10 +00:00
Renato Alcara ffaab2c7b7 fix(carousel): remover messageContextInfo
fix(carousel): remover messageContextInfo
2026-02-06 15:43:14 -03:00
Claude 6406becee2 fix(carousel): remover messageContextInfo para evitar erro 479
sendMessage adiciona messageContextInfo.messageSecret ao proto da
mensagem (para reporting token). Isso nao existe quando relayMessage
e chamado diretamente. O messageContextInfo ao lado de
interactiveMessage.carouselMessage causa erro 479 nos dispositivos
vinculados (Web/Desktop).

Agora o carousel pula a adicao de messageContextInfo, resultando em
um proto limpo: { interactiveMessage: { carouselMessage: {...} } }

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 18:40:15 +00:00
Renato Alcara f6d4bd594f fix(carousel)sem viewOnceMessage
fix(carousel)sem viewOnceMessage
2026-02-06 15:25:23 -03:00
Claude 5d5a973ffd fix(carousel): enviar interactiveMessage direto + biz node + sem viewOnceMessage
Ajuste na estrutura do carrossel para renderizar na Web:
1. Removido viewOnceMessage wrapper - carrossel usa interactiveMessage direto
2. Biz node habilitado com native_flow v=9 name=mixed
3. Removido subtitle vazio e header vazio do nível raiz
4. Sem bot node (já estava correto)

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 18:23:47 +00:00
Renato Alcara 9cf6598931 fix(carousel): re-habilitar biz node para carrossel
fix(carousel): re-habilitar biz node para carrossel
2026-02-06 15:04:11 -03:00
Claude 7b4c9c8d4c fix(carousel): re-habilitar biz node para carrossel (Pastorini confirma necessario)
Comparação com Pastorini revelou que o biz node É NECESSÁRIO para
carrossel. Pastorini injeta exatamente:
  <biz><interactive type="native_flow" v="1">
    <native_flow v="9" name="mixed"/>
  </interactive></biz>

Sem biz node = error 479. Com biz node = mensagem entregue.

O erro 479 anterior era causado por messageContextInfo no viewOnceMessage,
não pelo biz node em si.

Estado atual: biz node (SIM) + viewOnceMessage sem messageContextInfo +
bot node (NÃO para carousel/native_flow)

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 17:59:53 +00:00
Renato Alcara 7a530d51b7 fix(carousel): pular injeção do biz node para carrossel (causa erro 479)
fix(carousel): pular injeção do biz node para carrossel (causa erro 479)
2026-02-06 14:39:34 -03:00
Claude 4c56dacc81 fix(carousel): pular injeção do biz node para carrossel (causa erro 479)
O código experimental de injeção do biz node tentava extrair botões de
interactiveMessage.nativeFlowMessage.buttons (nível raiz), mas no
carrossel os botões estão em carouselMessage.cards[].nativeFlowMessage.

Resultado: biz node injetado com buttonNames:[] e dados vazios,
WhatsApp via erro 479 rejeitando a mensagem nos dispositivos vinculados.

Pastorini usa relayMessage direto sem injetar biz node no carrossel.
Agora o carrossel pula a injeção do biz node completamente.

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 17:36:49 +00:00
Renato Alcara 71c468efd5 fix(carousel): viewOnceMessage wrapper sem messageContextInfo
fix(carousel): viewOnceMessage wrapper sem messageContextInfo
2026-02-06 14:26:04 -03:00
Claude 1ebf95b5d6 fix(carousel): viewOnceMessage wrapper sem messageContextInfo + estrutura Pastorini
Mudanças baseadas na comparação com Pastorini:

1. Adicionado viewOnceMessage wrapper MÍNIMO (sem messageContextInfo)
   - viewOnceMessage é obrigatório para Web/Desktop renderizar carousel
   - messageContextInfo pode ter causado o erro 479 anterior

2. Removido campos extras que Pastorini não usa:
   - Removido messageParamsJson dos cards
   - Removido messageVersion dos cards
   - Removido carouselCardType (Pastorini não define)
   - Removido header vazio no nível raiz (Pastorini não envia)

3. Estrutura final:
   viewOnceMessage.message.interactiveMessage.carouselMessage

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 17:21:34 +00:00
Renato Alcara 3dc37d7fe6 fix(carousel): add carouselCardType HSCROLL_CARDS
fix(carousel): add carouselCardType HSCROLL_CARDS
2026-02-06 14:05:12 -03:00
Claude 0c39339e00 fix(carousel): add carouselCardType HSCROLL_CARDS and remove viewOnceMessage
Two changes to fix carousel rendering on WhatsApp Web/Desktop:

1. Added carouselCardType: 1 (HSCROLL_CARDS) to carouselMessage - this
   proto field tells the client how to render carousel cards. Without it,
   Web/Desktop doesn't know to render horizontal scrollable cards.

2. Removed viewOnceMessage wrapper - confirmed it causes error 479
   rejection from linked devices (Web/Desktop). Carousel works as
   direct interactiveMessage on phone; carouselCardType should fix Web.

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 17:02:46 +00:00
Renato Alcara 50c830415e fix(carousel): restore viewOnceMessage wrapper for Web/Desktop rendering
fix(carousel): restore viewOnceMessage wrapper for Web/Desktop rendering
2026-02-06 13:48:42 -03:00
Claude ceb8edb8b1 fix(carousel): restore viewOnceMessage wrapper for Web/Desktop rendering
WhatsApp Web/Desktop requires interactiveMessage to be wrapped inside
viewOnceMessage.message to render carousels fully. Without the wrapper,
only the header/body text is shown. The previous error 479 was caused by
missing messageVersion and empty messageParamsJson in cards, not by the
viewOnceMessage wrapper itself. Those card fixes are preserved.

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 16:40:15 +00:00
Renato Alcara 6a06372195 fix(carousel): add messageVersion and fix messageParamsJson in card n…
fix(carousel): add messageVersion and fix messageParamsJson in card n…
2026-02-06 12:31:53 -03:00
Claude 94737a013f fix(carousel): add messageVersion and fix messageParamsJson in card nativeFlowMessage
Each carousel card's nativeFlowMessage was missing messageVersion and
had empty string '' for messageParamsJson instead of '{}'. This caused
error 479 on linked devices (Web/Desktop) while phone rendered OK.

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 15:29:56 +00:00
Renato Alcara bcff5791f1 Merge pull request #102 from rsalcara/claude/ephemeral-key-pair-iQvhR
fix(carousel): send as direct interactiveMessage
2026-02-06 12:15:41 -03:00
Claude b67c7b7348 fix(carousel): send as direct interactiveMessage instead of viewOnceMessage
Carousels wrapped in viewOnceMessage cause error 479 rejection.
Pastorini sends carousel as direct interactiveMessage which works
on all platforms including WhatsApp Web/Desktop.

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 15:13:24 +00:00
Renato Alcara f4036e2db8 fix(buttons): remove bot node for ALL native_flow buttons (Web/Deskto…
fix(buttons): remove bot node for ALL native_flow buttons (Web/Deskto…
2026-02-06 11:58:01 -03:00
Claude 4cfa95bb92 fix(buttons): remove bot node for ALL native_flow buttons (Web/Desktop compat)
The <bot biz_bot="1"/> node prevents WhatsApp Web/Desktop from rendering
ALL native_flow button types, not just CTA. Quick_reply buttons had the
same issue: visible on smartphone only.

Confirmed: removing bot node fixes rendering on Web/Desktop for both
CTA buttons and quick_reply buttons.

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 14:55:33 +00:00
Renato Alcara eafb2fd0bd fix(buttons): revert native_flow name to 'mixed' - empty string cause…
fix(buttons): revert native_flow name to 'mixed' - empty string cause…
2026-02-06 11:45:41 -03:00
Claude ab0ab936d4 fix(buttons): revert native_flow name to 'mixed' - empty string causes error 405
Empty name '' is rejected by WhatsApp server (error 405 in ack).
Reverted to 'mixed' which delivers successfully.
The key fix remains: no bot node for CTA-only buttons (Web compatibility).

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 14:43:13 +00:00
Renato Alcara d6cedae010 fix(buttons): dynamic native_flow name and conditional bot
fix(buttons): dynamic native_flow name and conditional bot
2026-02-06 11:32:34 -03:00
Claude a64596202f fix(buttons): use empty native_flow name for all regular buttons + fix scope issue
- Changed native_flow name from 'mixed' to '' (empty) for all regular buttons
  (both CTA and quick_reply), matching WhatsApp client traffic analysis
- Only special flows (payment_info, mpm, order_details) get specific names
- Fixed variable scope: moved hasCTA/hasQuickReply/isCTAOnly before if/else block
  to ensure they're accessible for bot node conditional logic
- Removed duplicate CTA_BUTTON_NAMES/allButtonNames declarations

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 11:42:06 +00:00
Claude e9190e01d3 fix(buttons): dynamic native_flow name and conditional bot node for WhatsApp Web CTA compatibility
- Detect button types (CTA vs quick_reply) in nativeFlowMessage to set
  appropriate native_flow name attribute: '' for CTA-only, 'quick_reply'
  for quick_reply-only, 'mixed' for combinations
- Skip bot node injection for CTA-only buttons (cta_url, cta_copy, cta_call)
  as the bot node prevents WhatsApp Web from rendering CTA buttons
- Keep bot node for quick_reply buttons which need it for response handling

https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
2026-02-06 06:37:40 +00:00
Renato Alcara 7981f89059 Claude/fix single select
Claude/fix single select
2026-02-06 02:44:41 -03:00
Claude 930ca0a36b feat(list-message): add WhatsApp limit validation for list messages
Validates sections, rows, and string lengths before sending:
- Max 10 sections, 10 rows/section, 30 total rows
- Section title max 24 chars, row title max 24 chars
- Row description max 72 chars, row ID max 200 chars
- buttonText max 20 chars
- At least 1 section and 1 row per section required

Applied to all 3 list message paths: generateListMessage,
generateListMessageLegacy, and inline sections handler.

https://claude.ai/code/session_01SJdSHiUxtwzV8bb5dedodb
2026-02-06 05:42:28 +00:00
Claude 559ccde015 fix(list-message): remove duplicate header in nativeList conversion
When title is not provided, the text was used as fallback for both
title and description, causing the header to appear twice. Now title
only uses an explicit title field, description uses text.

https://claude.ai/code/session_01SJdSHiUxtwzV8bb5dedodb
2026-02-06 05:30:58 +00:00
Renato Alcara 16fb6812bb fix(list-message): use SINGLE_SELECT instead of PRODUCT_LIST
fix(list-message): use SINGLE_SELECT instead of PRODUCT_LIST
2026-02-06 02:19:01 -03:00
Claude 6425e06543 fix(list-message): use SINGLE_SELECT instead of PRODUCT_LIST in generateListMessageLegacy
PRODUCT_LIST type requires WhatsApp Business catalog data and causes
error 479 for regular menu lists. SINGLE_SELECT is the correct type
for interactive menu lists with sections/rows.

https://claude.ai/code/session_01SJdSHiUxtwzV8bb5dedodb
2026-02-06 05:17:39 +00:00
Renato Alcara d60d514011 add: script para aplicar fix de listMessage
add: script para aplicar fix de listMessage
2026-02-06 02:08:48 -03:00
Renato Alcara ab6933f716 fix list delivery
fix list delivery
2026-02-06 01:53:27 -03:00
Claude 8b1af33e97 fix(list-message): enable biz node for listMessage delivery
getButtonType was returning undefined for listMessage, preventing
the existing product_list biz node from being injected. Changes:

- getButtonType returns 'list' for message.listMessage (line 632)
- getButtonType returns 'list' for innerMessage.listMessage (line 675)
- Exclude list messages from bot node injection (line 1325)

https://claude.ai/code/session_01SJdSHiUxtwzV8bb5dedodb
2026-02-06 04:51:46 +00:00
Claude b24d625838 add: script para aplicar fix de listMessage no rsalcara/InfiniteAPI
Cherry-picks os 2 commits necessários:
- bd7c691: biz node diferenciado (product_list v2) para lista
- 191776a: conversão nativeFlowMessage → listMessage direto

https://claude.ai/code/session_01SJdSHiUxtwzV8bb5dedodb
2026-02-06 04:39:28 +00:00
Renato Alcara 61129699be fix(list-message): convert nativeFlowMessage to direct listMessage
fix(list-message): convert nativeFlowMessage to direct listMessage
2026-02-06 01:00:35 -03:00
Claude 191776af67 fix(list-message): convert nativeFlowMessage to direct listMessage for delivery
The viewOnceMessage > interactiveMessage > nativeFlowMessage wrapper with
single_select button was causing error 479 even with correct biz node.
WhatsApp requires the message to be in direct listMessage format (legacy)
paired with biz > list (type=product_list, v=2) node.

This matches the Pastorini implementation which sends:
- messageKeys: ['listMessage'] (NOT viewOnceMessage)
- biz > list (type=product_list, v=2)

The conversion extracts sections from nativeFlowMessage's single_select
buttonParamsJson and creates a proper listMessage with SINGLE_SELECT type.

https://claude.ai/code/session_01SJdSHiUxtwzV8bb5dedodb
2026-02-06 03:55:38 +00:00
Renato Alcara 22b3c6f97f fix(list-message): use correct biz node structure for listMes…
fix(list-message): use correct biz node structure for listMes…
2026-02-06 00:36:26 -03:00
Renato Alcara 2a23aa3d2d Revert "fix(list-message): use correct biz node structure for listMessage" 2026-02-06 00:28:12 -03:00
Renato Alcara aa7e250ac0 fix(list-message): use correct biz node structure for listMessage
fix(list-message): use correct biz node structure for listMessage
2026-02-06 00:11:55 -03:00
Renato Alcara 16564253d9 Merge branch 'master' into claude/fix-message-delivery-XlMLH 2026-02-06 00:11:42 -03:00
Claude bd7c691aa3 fix(list-message): use correct biz node structure for listMessage delivery
The listMessage was getting error 405 because the biz node used
'interactive > native_flow' structure which is wrong for list messages.
Changed to use 'biz > list (type=product_list, v=2)' structure which
matches the Pastorini reference implementation and works on both
smartphone and web WhatsApp.

Changes:
- Differentiate biz node based on message type (list vs interactive)
- For listMessage/nativeList: use biz > list (type=product_list, v=2)
- For other interactive: keep biz > interactive > native_flow
- Skip bot node injection for list messages
- All listMessages (SINGLE_SELECT + PRODUCT_LIST) now get biz node
- Add diagnostic logging matching Pastorini format

https://claude.ai/code/session_01SJdSHiUxtwzV8bb5dedodb
2026-02-06 03:07:38 +00:00
Renato Alcara 9c921f99d9 fix: Remove biz node injection for listMessage entirely
fix: Remove biz node injection for listMessage entirely
2026-02-05 23:41:47 -03:00
Claude fc65c84561 fix: Remove biz node injection for listMessage entirely
Error 479 persisted even with correct listType. The issue is that
listMessage (legacy format) does NOT need biz node injection at all.

The biz node was causing the error. listMessage works natively without it.

Changes:
- getButtonType() returns undefined for message.listMessage
- No biz node is injected for list messages
- Keep listType as PRODUCT_LIST (from previous commit)

This should allow listMessage to be delivered without error 479.

https://claude.ai/code/session_01Vgu4xrsj8aUVCHWb4pmQPF
2026-02-06 02:38:47 +00:00
Renato Alcara c5a7d702e4 fix: Change listType from SINGLE_SELECT to PRODUCT_LIST
fix: Change listType from SINGLE_SELECT to PRODUCT_LIST
2026-02-05 23:22:03 -03:00
Claude a3545d12e9 fix: Change listType from SINGLE_SELECT to PRODUCT_LIST to match pastorini
Error 479 was still occurring even with legacy listMessage format.
The issue is that listType must be PRODUCT_LIST (not SINGLE_SELECT)
to match the biz node type="product_list" v="2" that we're injecting.

This matches pastorini's working implementation exactly:
- listMessage with listType: PRODUCT_LIST
- biz node with type="product_list" v="2"

https://claude.ai/code/session_01Vgu4xrsj8aUVCHWb4pmQPF
2026-02-06 02:18:51 +00:00
Renato Alcara 1d7f053f33 fix: Use legacy listMessage format with correct biz node to fix error…
fix: Use legacy listMessage format with correct biz node to fix error…
2026-02-05 23:07:44 -03:00
Claude 35e9651490 fix: Use legacy listMessage format with correct biz node to fix error 479
The modern interactiveMessage format was causing error 479 (message rejection).
Switched to legacy listMessage format that matches pastorini's working implementation.

Changes:
1. **messages.ts**: Changed nativeList to use generateListMessageLegacy()
   - Creates listMessage directly (not viewOnceMessage wrapper)
   - Uses SINGLE_SELECT type (standard list)

2. **messages-send.ts**: Inject correct biz node for listMessage
   - For buttonType === 'list': <biz><list type="product_list" v="2">
   - Matches pastorini's working structure
   - Removed checks that skipped biz node for listMessage

Why this works:
- Legacy listMessage + product_list biz node = accepted by WhatsApp
- Modern interactiveMessage + native_flow biz node = error 479
- This matches the pastorini implementation that works on Web/iOS/Android

https://claude.ai/code/session_01Vgu4xrsj8aUVCHWb4pmQPF
2026-02-06 02:04:17 +00:00