How to make a carousel using Google.Cloud.Dialogflow.V2 Carousel for dialogflow?












0















Im trying to build a webhook for dialogflow with help from nuget package Google.Cloud.Dialogflow.V2.
Im running the code with .Net Core 2.1.
I get the fullfilmentText to show in dialogflow, but cant make the carousel to show up.
What am I doing wrong?



Here is my method:



  [HttpPost]
public ContentResult Post([FromBody] WebhookRequest webhookRequest)
{
var dialogflowResponse = new WebhookResponse { FulfillmentText = "FulfillmentText" };

var carousel = new Intent.Types.Message.Types.CarouselSelect.Types.Item
{
Title = "My title",
Description = "This is a description",
Image = new Intent.Types.Message.Types.Image
{
ImageUri = "https://placekitten.com/200/300",
AccessibilityText = "cat"
},
Info = new Intent.Types.Message.Types.SelectItemInfo
{
Key = "Cats"
}
};

carousel.Info.Synonyms.Add("Synonym 1");
carousel.Info.Synonyms.Add("Synonym 1");

dialogflowResponse.FulfillmentMessages.Add(new Intent.Types.Message {
CarouselSelect = new Intent.Types.Message.Types.CarouselSelect()
});

dialogflowResponse.FulfillmentMessages.First().CarouselSelect.Items.Add(carousel);

return dialogflowResponse;
}


Generates followiing Json:



{
"fulfillmentText": "FulfillmentText",
"fulfillmentMessages": [
{
"carouselSelect": {
"items": [
{
"info": {
"key": "Cats",
"synonyms": [
"Synonym 1",
"Synonym 1"
]
},
"title": "My title",
"description": "This is a description",
"image": {
"imageUri": "https://placekitten.com/200/300",
"accessibilityText": "cat"
}
}
]
}
}
]
}









share|improve this question



























    0















    Im trying to build a webhook for dialogflow with help from nuget package Google.Cloud.Dialogflow.V2.
    Im running the code with .Net Core 2.1.
    I get the fullfilmentText to show in dialogflow, but cant make the carousel to show up.
    What am I doing wrong?



    Here is my method:



      [HttpPost]
    public ContentResult Post([FromBody] WebhookRequest webhookRequest)
    {
    var dialogflowResponse = new WebhookResponse { FulfillmentText = "FulfillmentText" };

    var carousel = new Intent.Types.Message.Types.CarouselSelect.Types.Item
    {
    Title = "My title",
    Description = "This is a description",
    Image = new Intent.Types.Message.Types.Image
    {
    ImageUri = "https://placekitten.com/200/300",
    AccessibilityText = "cat"
    },
    Info = new Intent.Types.Message.Types.SelectItemInfo
    {
    Key = "Cats"
    }
    };

    carousel.Info.Synonyms.Add("Synonym 1");
    carousel.Info.Synonyms.Add("Synonym 1");

    dialogflowResponse.FulfillmentMessages.Add(new Intent.Types.Message {
    CarouselSelect = new Intent.Types.Message.Types.CarouselSelect()
    });

    dialogflowResponse.FulfillmentMessages.First().CarouselSelect.Items.Add(carousel);

    return dialogflowResponse;
    }


    Generates followiing Json:



    {
    "fulfillmentText": "FulfillmentText",
    "fulfillmentMessages": [
    {
    "carouselSelect": {
    "items": [
    {
    "info": {
    "key": "Cats",
    "synonyms": [
    "Synonym 1",
    "Synonym 1"
    ]
    },
    "title": "My title",
    "description": "This is a description",
    "image": {
    "imageUri": "https://placekitten.com/200/300",
    "accessibilityText": "cat"
    }
    }
    ]
    }
    }
    ]
    }









    share|improve this question

























      0












      0








      0








      Im trying to build a webhook for dialogflow with help from nuget package Google.Cloud.Dialogflow.V2.
      Im running the code with .Net Core 2.1.
      I get the fullfilmentText to show in dialogflow, but cant make the carousel to show up.
      What am I doing wrong?



      Here is my method:



        [HttpPost]
      public ContentResult Post([FromBody] WebhookRequest webhookRequest)
      {
      var dialogflowResponse = new WebhookResponse { FulfillmentText = "FulfillmentText" };

      var carousel = new Intent.Types.Message.Types.CarouselSelect.Types.Item
      {
      Title = "My title",
      Description = "This is a description",
      Image = new Intent.Types.Message.Types.Image
      {
      ImageUri = "https://placekitten.com/200/300",
      AccessibilityText = "cat"
      },
      Info = new Intent.Types.Message.Types.SelectItemInfo
      {
      Key = "Cats"
      }
      };

      carousel.Info.Synonyms.Add("Synonym 1");
      carousel.Info.Synonyms.Add("Synonym 1");

      dialogflowResponse.FulfillmentMessages.Add(new Intent.Types.Message {
      CarouselSelect = new Intent.Types.Message.Types.CarouselSelect()
      });

      dialogflowResponse.FulfillmentMessages.First().CarouselSelect.Items.Add(carousel);

      return dialogflowResponse;
      }


      Generates followiing Json:



      {
      "fulfillmentText": "FulfillmentText",
      "fulfillmentMessages": [
      {
      "carouselSelect": {
      "items": [
      {
      "info": {
      "key": "Cats",
      "synonyms": [
      "Synonym 1",
      "Synonym 1"
      ]
      },
      "title": "My title",
      "description": "This is a description",
      "image": {
      "imageUri": "https://placekitten.com/200/300",
      "accessibilityText": "cat"
      }
      }
      ]
      }
      }
      ]
      }









      share|improve this question














      Im trying to build a webhook for dialogflow with help from nuget package Google.Cloud.Dialogflow.V2.
      Im running the code with .Net Core 2.1.
      I get the fullfilmentText to show in dialogflow, but cant make the carousel to show up.
      What am I doing wrong?



      Here is my method:



        [HttpPost]
      public ContentResult Post([FromBody] WebhookRequest webhookRequest)
      {
      var dialogflowResponse = new WebhookResponse { FulfillmentText = "FulfillmentText" };

      var carousel = new Intent.Types.Message.Types.CarouselSelect.Types.Item
      {
      Title = "My title",
      Description = "This is a description",
      Image = new Intent.Types.Message.Types.Image
      {
      ImageUri = "https://placekitten.com/200/300",
      AccessibilityText = "cat"
      },
      Info = new Intent.Types.Message.Types.SelectItemInfo
      {
      Key = "Cats"
      }
      };

      carousel.Info.Synonyms.Add("Synonym 1");
      carousel.Info.Synonyms.Add("Synonym 1");

      dialogflowResponse.FulfillmentMessages.Add(new Intent.Types.Message {
      CarouselSelect = new Intent.Types.Message.Types.CarouselSelect()
      });

      dialogflowResponse.FulfillmentMessages.First().CarouselSelect.Items.Add(carousel);

      return dialogflowResponse;
      }


      Generates followiing Json:



      {
      "fulfillmentText": "FulfillmentText",
      "fulfillmentMessages": [
      {
      "carouselSelect": {
      "items": [
      {
      "info": {
      "key": "Cats",
      "synonyms": [
      "Synonym 1",
      "Synonym 1"
      ]
      },
      "title": "My title",
      "description": "This is a description",
      "image": {
      "imageUri": "https://placekitten.com/200/300",
      "accessibilityText": "cat"
      }
      }
      ]
      }
      }
      ]
      }






      dialogflow actions-on-google






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 14:32









      Sofie SSofie S

      11




      11
























          1 Answer
          1






          active

          oldest

          votes


















          0














          i ran into the same problem with the java api. Only the basic rich messages (card, quick replies, ...) are working. BasicCard, Suggestions, Carousel, ... doesn't show up in any channel.



          I got it to work if i added some of the following custom payload to skype channel:



          {
          "skype": {
          "type": "message",
          "attachmentLayout": "carousel",
          "text": "Please select your food.",
          "attachments": [{
          "contentType": "application/vnd.microsoft.card.hero",
          "content": {
          "title": "Sushi",
          "subtitle": "Very fresh shrimp or tuna.",
          "images": [{
          "url": "https://i.ibb.co/87LmvT3/mdi.png"
          }
          ],
          "buttons": [{
          "type": "imBack",
          "title": "1 piece",
          "value": "sushi,1"
          }, {
          "type": "imBack",
          "title": "2 piece",
          "value": "sushi,2"
          }, {
          "type": "imBack",
          "title": "more",
          "value": "sushi,3+"
          }
          ]
          }
          }, {
          "contentType": "application/vnd.microsoft.card.hero",
          "content": {
          "title": "Tenpura",
          "subtitle": "Japanese first-class vegitables.",
          "images": [{
          "url": "https://i.ibb.co/87LmvT3/mdi.png"
          }
          ],
          "buttons": [{
          "type": "imBack",
          "title": "1 piece",
          "value": "tenpura,1"
          }, {
          "type": "imBack",
          "title": "2 piece",
          "value": "tenpura,2"
          }, {
          "type": "imBack",
          "title": "more",
          "value": "tenpura,3+"
          }
          ]
          }
          }
          ]
          }}


          I hope it helps!






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53302595%2fhow-to-make-a-carousel-using-google-cloud-dialogflow-v2-carousel-for-dialogflow%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            i ran into the same problem with the java api. Only the basic rich messages (card, quick replies, ...) are working. BasicCard, Suggestions, Carousel, ... doesn't show up in any channel.



            I got it to work if i added some of the following custom payload to skype channel:



            {
            "skype": {
            "type": "message",
            "attachmentLayout": "carousel",
            "text": "Please select your food.",
            "attachments": [{
            "contentType": "application/vnd.microsoft.card.hero",
            "content": {
            "title": "Sushi",
            "subtitle": "Very fresh shrimp or tuna.",
            "images": [{
            "url": "https://i.ibb.co/87LmvT3/mdi.png"
            }
            ],
            "buttons": [{
            "type": "imBack",
            "title": "1 piece",
            "value": "sushi,1"
            }, {
            "type": "imBack",
            "title": "2 piece",
            "value": "sushi,2"
            }, {
            "type": "imBack",
            "title": "more",
            "value": "sushi,3+"
            }
            ]
            }
            }, {
            "contentType": "application/vnd.microsoft.card.hero",
            "content": {
            "title": "Tenpura",
            "subtitle": "Japanese first-class vegitables.",
            "images": [{
            "url": "https://i.ibb.co/87LmvT3/mdi.png"
            }
            ],
            "buttons": [{
            "type": "imBack",
            "title": "1 piece",
            "value": "tenpura,1"
            }, {
            "type": "imBack",
            "title": "2 piece",
            "value": "tenpura,2"
            }, {
            "type": "imBack",
            "title": "more",
            "value": "tenpura,3+"
            }
            ]
            }
            }
            ]
            }}


            I hope it helps!






            share|improve this answer




























              0














              i ran into the same problem with the java api. Only the basic rich messages (card, quick replies, ...) are working. BasicCard, Suggestions, Carousel, ... doesn't show up in any channel.



              I got it to work if i added some of the following custom payload to skype channel:



              {
              "skype": {
              "type": "message",
              "attachmentLayout": "carousel",
              "text": "Please select your food.",
              "attachments": [{
              "contentType": "application/vnd.microsoft.card.hero",
              "content": {
              "title": "Sushi",
              "subtitle": "Very fresh shrimp or tuna.",
              "images": [{
              "url": "https://i.ibb.co/87LmvT3/mdi.png"
              }
              ],
              "buttons": [{
              "type": "imBack",
              "title": "1 piece",
              "value": "sushi,1"
              }, {
              "type": "imBack",
              "title": "2 piece",
              "value": "sushi,2"
              }, {
              "type": "imBack",
              "title": "more",
              "value": "sushi,3+"
              }
              ]
              }
              }, {
              "contentType": "application/vnd.microsoft.card.hero",
              "content": {
              "title": "Tenpura",
              "subtitle": "Japanese first-class vegitables.",
              "images": [{
              "url": "https://i.ibb.co/87LmvT3/mdi.png"
              }
              ],
              "buttons": [{
              "type": "imBack",
              "title": "1 piece",
              "value": "tenpura,1"
              }, {
              "type": "imBack",
              "title": "2 piece",
              "value": "tenpura,2"
              }, {
              "type": "imBack",
              "title": "more",
              "value": "tenpura,3+"
              }
              ]
              }
              }
              ]
              }}


              I hope it helps!






              share|improve this answer


























                0












                0








                0







                i ran into the same problem with the java api. Only the basic rich messages (card, quick replies, ...) are working. BasicCard, Suggestions, Carousel, ... doesn't show up in any channel.



                I got it to work if i added some of the following custom payload to skype channel:



                {
                "skype": {
                "type": "message",
                "attachmentLayout": "carousel",
                "text": "Please select your food.",
                "attachments": [{
                "contentType": "application/vnd.microsoft.card.hero",
                "content": {
                "title": "Sushi",
                "subtitle": "Very fresh shrimp or tuna.",
                "images": [{
                "url": "https://i.ibb.co/87LmvT3/mdi.png"
                }
                ],
                "buttons": [{
                "type": "imBack",
                "title": "1 piece",
                "value": "sushi,1"
                }, {
                "type": "imBack",
                "title": "2 piece",
                "value": "sushi,2"
                }, {
                "type": "imBack",
                "title": "more",
                "value": "sushi,3+"
                }
                ]
                }
                }, {
                "contentType": "application/vnd.microsoft.card.hero",
                "content": {
                "title": "Tenpura",
                "subtitle": "Japanese first-class vegitables.",
                "images": [{
                "url": "https://i.ibb.co/87LmvT3/mdi.png"
                }
                ],
                "buttons": [{
                "type": "imBack",
                "title": "1 piece",
                "value": "tenpura,1"
                }, {
                "type": "imBack",
                "title": "2 piece",
                "value": "tenpura,2"
                }, {
                "type": "imBack",
                "title": "more",
                "value": "tenpura,3+"
                }
                ]
                }
                }
                ]
                }}


                I hope it helps!






                share|improve this answer













                i ran into the same problem with the java api. Only the basic rich messages (card, quick replies, ...) are working. BasicCard, Suggestions, Carousel, ... doesn't show up in any channel.



                I got it to work if i added some of the following custom payload to skype channel:



                {
                "skype": {
                "type": "message",
                "attachmentLayout": "carousel",
                "text": "Please select your food.",
                "attachments": [{
                "contentType": "application/vnd.microsoft.card.hero",
                "content": {
                "title": "Sushi",
                "subtitle": "Very fresh shrimp or tuna.",
                "images": [{
                "url": "https://i.ibb.co/87LmvT3/mdi.png"
                }
                ],
                "buttons": [{
                "type": "imBack",
                "title": "1 piece",
                "value": "sushi,1"
                }, {
                "type": "imBack",
                "title": "2 piece",
                "value": "sushi,2"
                }, {
                "type": "imBack",
                "title": "more",
                "value": "sushi,3+"
                }
                ]
                }
                }, {
                "contentType": "application/vnd.microsoft.card.hero",
                "content": {
                "title": "Tenpura",
                "subtitle": "Japanese first-class vegitables.",
                "images": [{
                "url": "https://i.ibb.co/87LmvT3/mdi.png"
                }
                ],
                "buttons": [{
                "type": "imBack",
                "title": "1 piece",
                "value": "tenpura,1"
                }, {
                "type": "imBack",
                "title": "2 piece",
                "value": "tenpura,2"
                }, {
                "type": "imBack",
                "title": "more",
                "value": "tenpura,3+"
                }
                ]
                }
                }
                ]
                }}


                I hope it helps!







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 6 '18 at 14:14









                SniffieSniffie

                11




                11
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53302595%2fhow-to-make-a-carousel-using-google-cloud-dialogflow-v2-carousel-for-dialogflow%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Xamarin.iOS Cant Deploy on Iphone

                    Glorious Revolution

                    Dulmage-Mendelsohn matrix decomposition in Python