botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
68 stars 83 forks source link

Send custom Carousel from action.js #520

Closed CosmoAbdon closed 5 years ago

CosmoAbdon commented 5 years ago

Make sure these checkboxes are checked before raising an issue, thank you!

Please also fill in these fields:


Botpress version: 10.48.5

Channels: channel-web

Hi, i'm having a little problem. Actually I fetch some data from my API and dynamically create and object (let's call it carouselData). When I finish everything about my carouselData, it look's like it when I use console.log(carouselData[0]) (the [0] is just cuz formData is inside an array, ur guys gonna see)

Outputs:

{ id: 'builtin_carousel-C69qK~',
    formData:
     [ { title: 'Produto 1',
         subtitle: 'R$ 10',
         image: '',
         actions: [ { title: 'Produto 1', action: 'Say something' } ],
         typing: true },
       { title: 'Produto21',
         subtitle: 'R$ 20',
         image: '',
         actions: [ { title: 'Produto21', action: 'Say something' } ],
         typing: true } ],
    createdBy: 'admin',
    createdOn: '2018-10-24T03:23:24.791Z' }

I already tried using this 2 methods:

And every single time I got this:

TypeError: Cannot read property 'map' of undefined

I already saw botpress/v12#502 , but without any sucess.

Anyone knows what is needed?

Thanks in advance !

epaminond commented 5 years ago

@CosmoAbdon , it seems the object you are passing doesn't have items key in it, while builtin_carousel renderer expects it.