I am deploying my Botframework v4 code to AZure using the continous deployment option via Bitbucket. I am using hero cards to diplay a set of carousel with buttons. The images and button redirect are dynamically generated based on the results from an API call.
The carousels are getting perfectly displayed on both Web Chat on Azure and Botframework Emulator (locally). But when using the messenger channel on azure I am not able to display the carousels. The server returns an error -
Sorry, it looks like something went wrong. Microsoft.Bot.Schema.ErrorResponseException: Operation returned an invalid status code 'BadRequest' at Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync(String conversationId, String activityId, Activity activity, Dictionary2 customHeaders, CancellationToken cancellationToken) at Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync(IConversations operations, String conversationId, String activityId, Activity activity, CancellationToken cancellationToken) at Microsoft.Bot.Builder.BotFrameworkAdapter.SendActivitiesAsync(ITurnContext turnContext, Activity[] activities, CancellationToken cancellationToken) at Microsoft.Bot.Builder.TurnContext.
Although I must report that I am easily able to display single images as attachments. These images have hard-coded url links, and they are getting displayed. But when i am using hero cards with dynamic buttons and links I am getting the above error. I am putting in the sample code I am using for displaying the carousels.
var client = new RestClient("https://XXXXXXXXXXXXXXXXXX/");
var request = new RestRequest($"api/Flights/carousel/summary?to={state.Destination}&from={state.Origin}&departDate={state.FlyDate}&returnDate=&adult=1&child=0&infant=0&queryType=1&roundTrip=FALSE&classOfTravel=Y&userName=Satadal", Method.GET);
var queryResult = client.Execute(request).Content;
CarouselMap CarouselResult = JsonConvert.DeserializeObject<CarouselMap>(queryResult);
if (CarouselResult.Status)
{
// Create an attachment. Add the carousels to it.
var activity1 = MessageFactory.Carousel(new Attachment[]
{
new HeroCard(
title: "We are a travel agency trusted over 30 years, with 95 % positive customer reviews and A+ rating from BBB",
images: new CardImage[] { new CardImage(url: CarouselResult.Data[0].ImageUrl.ToString())},
buttons: new CardAction[]
{
new CardAction(title: "???? Chat with Bot ", type: ActionTypes.ImBack, value: "Book some flight tickets"),
new CardAction(title: "☎️ Call Us 24/7", type: ActionTypes.Call, value: "+18888898005"),
new CardAction(title: "✈️ Search Results ", type: ActionTypes.OpenUrl, value: CarouselResult.Data[0].ApiUrl.ToString())
})
.ToAttachment(),
new HeroCard(
title: "We are a travel agency trusted over 30 years, with 95 % positive customer reviews and A+ rating from BBB",
images: new CardImage[] { new CardImage(url: CarouselResult.Data[1].ImageUrl.ToString()) },
buttons: new CardAction[]
{
new CardAction(title: "???? Chat with Bot ", type: ActionTypes.ImBack, value: "Book some flight tickets"),
new CardAction(title: "☎️ Call Us 24/7", type: ActionTypes.Call, value: "+18888898005"),
new CardAction(title: "✈️ Search Results ", type: ActionTypes.OpenUrl, value: CarouselResult.Data[1].ApiUrl.ToString())
})
.ToAttachment(),
new HeroCard(
title: "We are a travel agency trusted over 30 years, with 95 % positive customer reviews and A+ rating from BBB",
images: new CardImage[] { new CardImage(url: CarouselResult.Data[2].ImageUrl.ToString()) },
buttons: new CardAction[]
{
new CardAction(title: "???? Chat with Bot ", type: ActionTypes.ImBack, value: "Book some flight tickets"),
new CardAction(title: "☎️ Call Us 24/7", type: ActionTypes.Call, value: "+18888898005"),
new CardAction(title: "✈️ Search Results ", type: ActionTypes.OpenUrl, value: CarouselResult.Data[2].ApiUrl.ToString())
})
.ToAttachment()
});
/////Printing carousels for One way trips here.
await stepContext.Context.SendActivityAsync(activity1, cancellationToken: cancellationToken);
What am I doing wrong? Or whether these are issues regarding Fb messenger support?