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:
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
}
}]
};
3 Replies
you did it with function inside of agent on a woocomerce?do you know how to create dynamic carousel?
Yes, I did it with function step inside agent. The dynamic carousel works. It shows products on cards as expected with one exception. When clicking the button, it doesn't open the URL as it should. I guess it is related to the upper part of the JS code on the print screen, the request.type. But this part of the code is Voiceflow specific, not JS generic. Thus, I would appreciate some advise on what am I doing wrong in the code. Alternatively, Voiceflow doesn't allow to open URL in carousel built in Function step (platform limitation).
can you please send the workflow and what did you do inside agent cause i have problem?