AndrejG84A
Voiceflow Partners7mo ago
3 replies
AndrejG84

Dynamic carousel

Hi. I've created a dynamic carousel in Function step. It should show carousel cards, each with product picture, description, price and button called "More details." Upon clicking the button, an url link (contained in variable record.fields.Link) should be open. Everything works as expected except for the fact that the button doesn't open the URL link. I've checked the URL link and it's not broken. In the Javascript code I use type: "open_url". I've also tried "url" and "web_url" but it still doesn't work. Can someone advise how to fix this? Here is the code for the button and for showing the carousel trace:
const carouselCards = records.map(record => ({
title: record.fields.Product,
description: { text:
€${record.fields.Price}
},
imageUrl: record.fields.Photo,
buttons: [
{
name: "More details",
request: {
type: "open_url",
payload: {
url: record.fields.Link
}
}
}
]
}));

// Return to Voiceflow with carousel trace and next path
return {
next: { path: "success" },
trace: [{
type: "carousel",
payload: {
cards: carouselCards
}
}]
};
image.png
Was this page helpful?