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
This commit is contained in:
+13
-6
@@ -658,11 +658,18 @@ export const generateCarouselMessage = async (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return interactiveMessage directly (NOT wrapped in viewOnceMessage)
|
// Wrap in viewOnceMessage - required for WhatsApp Web/Desktop rendering
|
||||||
// Carousels wrapped in viewOnceMessage cause error 479 rejection
|
// Without this wrapper, Web only shows the header/body text
|
||||||
// Pastorini sends carousel as direct interactiveMessage which works on all platforms
|
|
||||||
return {
|
return {
|
||||||
interactiveMessage
|
viewOnceMessage: {
|
||||||
|
message: {
|
||||||
|
messageContextInfo: {
|
||||||
|
deviceListMetadata: {},
|
||||||
|
deviceListMetadataVersion: 2
|
||||||
|
},
|
||||||
|
interactiveMessage
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1159,8 +1166,8 @@ export const generateWAMessageContent = async (
|
|||||||
}
|
}
|
||||||
// Pass options for media processing if cards have images/videos
|
// Pass options for media processing if cards have images/videos
|
||||||
const generated = await generateCarouselMessage(carouselOptions, options)
|
const generated = await generateCarouselMessage(carouselOptions, options)
|
||||||
m.interactiveMessage = generated.interactiveMessage
|
m.viewOnceMessage = generated.viewOnceMessage
|
||||||
options.logger?.info('Sending carouselMessage as direct interactiveMessage (no viewOnce wrapper)')
|
options.logger?.info('Sending carouselMessage with viewOnceMessage wrapper')
|
||||||
}
|
}
|
||||||
// Check for nativeList
|
// Check for nativeList
|
||||||
else if (hasNonNullishProperty(message, 'nativeList')) {
|
else if (hasNonNullishProperty(message, 'nativeList')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user