hello community! I have another question today :)....
# đź’»developers
g
hello community! I have another question today :). Basically, I'm trying to add carousel cards dynamically based on the amount the products received. I have the following code which is not failing apparently: const productRecommendations = workflow.product_recommendations // Create an array to store the carousel cards const carouselCards = [] // Iterate over each product recommendation for (const product of productRecommendations) { // Create a card object for each product const card = { type: 'carousel-card', content: { title: product.product_name, description: product.product_price ?
Price: ${product.product_price}
: 'Price: N/A', imageUrl: product.product_image_url, buttons: [ { type: 'url', text: 'View Product', url: product.product_url } ] } } // Add the card to the carousel cards array carouselCards.push(card) } // Create the carousel payload const carouselPayload = { type: 'carousel', content: carouselCards } // Set the carousel payload as the event payload event.payload = carouselPayload But I don't know how this can be shown. I haven't succeeded so far... Has anybody some clue if this can be done?