fix: remove bot node for carousels and restore ProductCarousel
- Fix carousel detection in getButtonType to return native_flow - Add isCarouselMessage helper function - Skip bot node injection for carousel messages (fixes error 479) - Restore ProductCarouselCard and ProductCarouselMessageOptions types - Restore generateProductCarouselMessage function - Add productCarousel handler in generateWAMessageContent The bot node with biz_bot='1' was causing error 479 for media carousels because carousels are regular interactive messages, not bot messages. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+28
-27
@@ -637,18 +637,18 @@ export type ProductCarouselCard = {
|
||||
* { productId: 'iphone_15' },
|
||||
* { productId: 'macbook_air' },
|
||||
* { productId: 'apple_watch' }
|
||||
* ],
|
||||
* body: 'Check out our featured products!'
|
||||
* }
|
||||
* ]
|
||||
* },
|
||||
* body: 'Check out our featured products!'
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
export type ProductCarouselMessageOptions = {
|
||||
/** JID of the business owner (catalog owner) - e.g., '5511999999999@s.whatsapp.net' */
|
||||
/** JID of the business owner (who owns the catalog) */
|
||||
businessOwnerJid: string
|
||||
/** Products to display (2-10 cards required) */
|
||||
products: ProductCarouselCard[]
|
||||
/** Body text for the carousel message */
|
||||
/** Body text for the message */
|
||||
body?: string
|
||||
}
|
||||
|
||||
@@ -753,6 +753,29 @@ export type AnyRegularMessageContent = (
|
||||
text?: string
|
||||
footer?: string
|
||||
}
|
||||
| {
|
||||
/**
|
||||
* Product Carousel Message - Swipeable product cards from WhatsApp Business catalog
|
||||
* Requires: WhatsApp Business account with configured catalog
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* await sock.sendMessage(jid, {
|
||||
* productCarousel: {
|
||||
* businessOwnerJid: '5511999999999@s.whatsapp.net',
|
||||
* products: [
|
||||
* { productId: 'produto_001' },
|
||||
* { productId: 'produto_002' },
|
||||
* { productId: 'produto_003' }
|
||||
* ]
|
||||
* },
|
||||
* body: 'Confira nossos produtos em destaque!'
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
productCarousel: ProductCarouselMessageOptions
|
||||
body?: string
|
||||
}
|
||||
| {
|
||||
/**
|
||||
* Native List Message - Interactive list with sections
|
||||
@@ -786,28 +809,6 @@ export type AnyRegularMessageContent = (
|
||||
title?: string
|
||||
footer?: string
|
||||
}
|
||||
| {
|
||||
/**
|
||||
* Product Carousel Message - Swipeable product cards from WhatsApp Business catalog
|
||||
* Requires: WhatsApp Business account with configured catalog
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* await sock.sendMessage(jid, {
|
||||
* productCarousel: {
|
||||
* businessOwnerJid: '5511999999999@s.whatsapp.net',
|
||||
* products: [
|
||||
* { productId: 'produto_001' },
|
||||
* { productId: 'produto_002' },
|
||||
* { productId: 'produto_003' }
|
||||
* ],
|
||||
* body: 'Confira nossos produtos em destaque!'
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
productCarousel: ProductCarouselMessageOptions
|
||||
}
|
||||
| {
|
||||
/**
|
||||
* Album message - send multiple images/videos grouped together
|
||||
|
||||
Reference in New Issue
Block a user