fix: separate carousel header title from body text to avoid duplicate display

Previously the same `text` field was used for both header.title and body.text,
causing duplicate content to appear. Now `title` controls the header (defaults
to a space like Pastorini) and `text` controls the body independently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Renato Alcara
2026-02-14 22:55:32 -03:00
parent 838d9f28f6
commit 566e7a9a29
2 changed files with 5 additions and 2 deletions
+3 -2
View File
@@ -591,7 +591,7 @@ export const generateCarouselMessage = async (
options: CarouselMessageOptions,
mediaOptions?: MessageContentGenerationOptions
): Promise<WAMessageContent> => {
const { cards, text, footer } = options
const { cards, title, text, footer } = options
if (!cards || cards.length < 2) {
throw new Boom('Carousel requires at least 2 cards', { statusCode: 400 })
@@ -689,7 +689,7 @@ export const generateCarouselMessage = async (
// - messageVersion: 1 in carouselMessage
// - Body and footer at root level
const interactiveMessage: proto.Message.IInteractiveMessage = {
header: { title: text || '', hasMediaAttachment: false },
header: { title: title || ' ', hasMediaAttachment: false },
body: { text: text || '' },
footer: footer ? { text: footer } : undefined,
carouselMessage: {
@@ -1238,6 +1238,7 @@ export const generateWAMessageContent = async (
const carouselMsg = message as any
const carouselOptions: CarouselMessageOptions = {
cards: carouselMsg.nativeCarousel.cards,
title: carouselMsg.nativeCarousel.title || carouselMsg.title,
text: carouselMsg.text,
footer: carouselMsg.footer
}