Search code examples
actions-on-googlegoogle-assistant-sdkapi-aidialogflow-es

askWithCarousel() is returning empty response


here is the code snippet i'm using:

app.askWithCarousel('Which of these looks good?',
    app.buildCarousel()
        .addItems([
            app.buildOptionItem("SELECTION_KEY_ONE",
                ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'])
                .setTitle('Number one'),
            app.buildOptionItem("SELECTION_KEY_TWO",
                ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'])
                .setTitle('Number two'),
        ]));

here is the screenshot:

enter image description here enter image description here


Solution

  • I found a solution. It's probably a Google bug. All you have to do is to add .setDescription method

    app.askWithCarousel('Which of these looks good?',
        app.buildCarousel()
            .addItems(
                app.buildOptionItem("SELECTION_KEY_ONE",
                                ['synonym of KEY_ONE 1', 'synonym of KEY_ONE 2'])
                                .setTitle('Number one')
                                .setDescription('Number one description')
                )
            .addItems(
                app.buildOptionItem("SELECTION_KEY_TWO",
                                ['synonym of KEY_TWO 1', 'synonym of KEY_TWO 2'])
                                .setTitle('Number two')
                                .setDescription('Number two description')
                )
    );
    

    UPDATE

    I've found out just now it's impossible to set an empty string like .setDescription(''). It returns an error. So, I got along with space .setDescription(' ')