Carousel Action button can't get link from JSON.
# 🤝help
b
The title. I can basically get a link to the image for the carousel, I can grab a title and a subtitle but the link to the button does not work.
@flaky-tailor-99511
@acceptable-kangaroo-64719 🙏
a
Hey @bored-australia-39539, how are you building your carousel? Are you using code, variables?
b
@acceptable-kangaroo-64719 i get an api response in the form of a JSON i then create seperate variables that contain dictonaries and then call the individual values inside
a
Cool, the recipe bot does this, too. You can steal the code from it as a head start. Cards in a carousel have to be in a certain format like this:
Copy code
js
{
    type: 'card',
    title: {
      dynamicValue: `${recipe.title}`,
      valueType: 'dynamic'
    },
    subtitle: {
      dynamicValue: '',
      valueType: 'dynamic'
    },
    imageUrl: {
      dynamicValue: `${recipe.image}`,
      valueType: 'dynamic'
    },
    actions: [
      {
        action: 'url',
        label: 'View Recipe',
        value: `${recipe.sourceUrl}`
      }
    ]
  }
}
Are you formatting your API data into cards like this before passing them to the carousel object?
Then the card should look like this

https://cdn.discordapp.com/attachments/1129439958701191270/1130548998432891042/image.png

2 Views