Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bot Framework: How to make an OpenUrl button on a herocard in Kik

I am trying to use the ActionTypes.OpenUrl type on a CardAction in a hero card on kik. all it does is echo back the message. It does not actually open a URL. I have the same code working on multiple channels, but cannot get it working on kik. Has anyone been able to find a work around for this?

Here is the code I am using:

Activity reply = activity.CreateReply();
var card = new HeroCard
{
    Title = "title",
    Text = "text",
    Buttons = new List<CardAction> {new CardAction(ActionTypes.OpenUrl,"url 1", text: "open url 1", value:@"https://www.google.com/"),
        new CardAction(ActionTypes.OpenUrl,title:"url 2", text: "open url 2", value:@"https://www.google.com/"),
        new CardAction(ActionTypes.OpenUrl,title:"url 3", text: "open url 3", value:@"https://www.google.com/")
    }
};
reply.Attachments.Add(card.ToAttachment());
await context.PostAsync(reply);
like image 470
botsbotsbotsbots Avatar asked Jun 12 '18 21:06

botsbotsbotsbots


1 Answers

This is unfortunately not going to work for you. In order to display "Hero Cards" in kik Bot Framework has to use keyboards specifically, the Suggested Response Keyboard which does not support an open url type. According to their documentation: "The type of response to send. Must be one of: text, friend-picker, picture". So there is no way to actually open a URL from a button in a herocard on kik.

like image 174
D4RKCIDE Avatar answered Oct 23 '22 13:10

D4RKCIDE