Remove per-device and relay-level carousel debug logging that dumped
full base64-encoded protobuf bytes and JSON structures to the logs.
These were temporary debugging aids that generated excessive output.
https://claude.ai/code/session_018DkDxsjWzM131jy3ivWjZp
The messageContextInfo with deviceListMetadata was only inside the V2 wrapper.
relayMessage copies message.messageContextInfo to meMsg for sender's own
devices (DSM), so it needs to be at the outer level too.
https://claude.ai/code/session_018DkDxsjWzM131jy3ivWjZp
Switch carousel from direct interactiveMessage to viewOnceMessageV2
wrapper (field 55), confirmed by Z-API as the stable approach for
WhatsApp Web rendering from non-Cloud API accounts.
Key changes:
- Wrap carousel in viewOnceMessageV2 > message > interactiveMessage
(V1 caused error 479, direct interactiveMessage didn't render on Web)
- Add messageContextInfo with deviceListMetadata and version 2 for
multi-device rendering compatibility
- Update all helper functions (getButtonType, isCarouselMessage,
isCatalogMessage, isListNativeFlow, getButtonArgs) to check V2 path
- Update per-device and biz node debug logging for V2 detection
https://claude.ai/code/session_018DkDxsjWzM131jy3ivWjZp
Pastorini's working implementation confirms carousels must be sent as
direct interactiveMessage at the message root level, NOT wrapped in
viewOnceMessage. The viewOnce wrapper prevented rendering on WhatsApp
Web and delivery to Apple/iOS users.
https://claude.ai/code/session_018DkDxsjWzM131jy3ivWjZp
Three changes matching Pastorini's working implementation:
1. Always set root header in generateCarouselMessage - the root
interactiveMessage header must always be present with title and
hasMediaAttachment:false. Previously it was undefined when no text
was provided, which violates WhatsApp MD protocol requirements.
2. Return plain JS object from generateWAMessageContent for carousel -
skip WAProto.Message.fromObject() which can corrupt nested carousel
structures by incorrectly handling oneOf fields in deeply nested
InteractiveMessage cards. protobuf encode() handles plain objects
correctly during serialization.
3. Pass plain JS object directly to relayMessage in sendMessage - call
relayMessage(jid, msgContent) with the plain object instead of
going through proto.WebMessageInfo.fromObject() first. This matches
Pastorini's approach of relayMessage(jid, plainObject, opts).
https://claude.ai/code/session_018DkDxsjWzM131jy3ivWjZp
Debug logging revealed that error 479 comes exclusively from the
sender's own linked devices (WhatsApp Web/Desktop) when they receive
the carousel wrapped in deviceSentMessage (DSM). Recipient devices
receive the raw carousel (without DSM) and process it correctly.
The fix skips sending carousel to sender's own linked devices:
- Skip meRecipients (own devices) when message is carousel
- Skip DSM wrapper in createParticipantNodes for carousel
- Skip DSM in retry path for own devices when carousel
The carousel still renders correctly on:
- Sender's phone (initiator)
- All recipient devices (phone + Web/Desktop)
https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
- Remove hasSubtitle (field 10) from Header proto definition, index.js
and index.d.ts - this field was adding extra bytes to encoded protobuf
that working implementations don't send, potentially causing rejection
- Remove hasSubtitle from carousel card headers and root header
- Add [CAROUSEL DEBUG] logging in relayMessage to dump:
- Encoded message bytes as base64 (for binary comparison)
- Message structure as JSON
- Per-device encoded bytes with DSM flag
- This enables byte-level comparison with working implementations
https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
Implementação completa baseada na análise ponto-a-ponto de 5 diferenças:
1. hasSubtitle adicionado ao proto schema (field 10, bool em Header)
- Adicionado ao WAProto.proto, index.js (encode/decode/fromObject/toObject)
- Adicionado ao index.d.ts (IHeader, Header class)
- Usado no root header e em cada card do carousel
2. relayMessage direto para carousel em sendMessage
- Detecta nativeCarousel no content e bypassa generateWAMessage inteiro
- Chama generateWAMessageContent (que usa fromObject) diretamente
- Depois relayMessage sem passar por generateWAMessageFromContent
- Elimina: segundo WAProto.Message.create(), contextInfo.expiration, etc.
3. Pipeline final do carousel agora:
sendMessage → generateWAMessageContent(fromObject) → relayMessage
Sem: generateWAMessageFromContent, WAProto.Message.create, ephemeral
Commits anteriores já incluem:
- viewOnceMessage wrapper
- fromObject no generateWAMessageContent
- Skip tctoken no stanza
https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR
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
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
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
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
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
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
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
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
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
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
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
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
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
- 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
- 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
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
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
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
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