type=call 的 CardAction 按钮不起作用
CardAction button with type=call doesn't work
我正在使用 MS 机器人框架创建一个机器人,但我无法创建一个可以调用 phone 号码的按钮。这应该可以根据这个 - http://docs.botframework.com/en-us/csharp/builder/sdkreference/attachments.html - 在 "action types" 下搜索(调用)。
这是应该在 HeroCard / ThumbnailCard 中创建按钮的代码,但它不起作用。整张卡片不会出现在回复中。如果我注释掉该代码,则 HeroCard / ThumbnailCard 会正常显示。 (我有另一个类型为 openUrl 的按钮,效果很好)。
在下面的代码中,如果我注释掉button1的代码,button1不工作而button2正常出现。
更新:事实证明,当我通过 Telegram 与机器人交谈时代码工作正常,但当我通过 Facebook Messenger 与机器人交谈时代码不起作用。
List<CardAction> buttons = new List<CardAction>();
CardAction button1 = new CardAction()
{
Value = "tel:123123123123",
Type = "Call",
Title = "Call us"
};
buttons.Add(button1);
if (button2Text != null)
{
CardAction button2 = new CardAction()
{
Value = button2Value,
Type = button2ActionType,
Title = button2Text
};
buttons.Add(button2);
}
if (cardClassName == "HeroCard")
{
HeroCard card = new HeroCard()
{
Title = cardTitle,
Subtitle = cardSubtitle,
Images = images,
Buttons = buttons
};
Attachment a = card.ToAttachment();
msg.Attachments.Add(a);
}
else if (cardClassName == "ThumbnailCard")
{
ThumbnailCard card = new ThumbnailCard()
{
Title = cardTitle,
Subtitle = cardSubtitle,
Images = images,
Buttons = buttons
};
Attachment a = card.ToAttachment();
msg.Attachments.Add(a);
}
Facebook 目前不支持机器人升级为 phone 调用
只需将类型更改为 openUrl,它将使用以下类型的值:"tel: +xx xxx xxx xxxx"
我正在使用 MS 机器人框架创建一个机器人,但我无法创建一个可以调用 phone 号码的按钮。这应该可以根据这个 - http://docs.botframework.com/en-us/csharp/builder/sdkreference/attachments.html - 在 "action types" 下搜索(调用)。
这是应该在 HeroCard / ThumbnailCard 中创建按钮的代码,但它不起作用。整张卡片不会出现在回复中。如果我注释掉该代码,则 HeroCard / ThumbnailCard 会正常显示。 (我有另一个类型为 openUrl 的按钮,效果很好)。
在下面的代码中,如果我注释掉button1的代码,button1不工作而button2正常出现。
更新:事实证明,当我通过 Telegram 与机器人交谈时代码工作正常,但当我通过 Facebook Messenger 与机器人交谈时代码不起作用。
List<CardAction> buttons = new List<CardAction>();
CardAction button1 = new CardAction()
{
Value = "tel:123123123123",
Type = "Call",
Title = "Call us"
};
buttons.Add(button1);
if (button2Text != null)
{
CardAction button2 = new CardAction()
{
Value = button2Value,
Type = button2ActionType,
Title = button2Text
};
buttons.Add(button2);
}
if (cardClassName == "HeroCard")
{
HeroCard card = new HeroCard()
{
Title = cardTitle,
Subtitle = cardSubtitle,
Images = images,
Buttons = buttons
};
Attachment a = card.ToAttachment();
msg.Attachments.Add(a);
}
else if (cardClassName == "ThumbnailCard")
{
ThumbnailCard card = new ThumbnailCard()
{
Title = cardTitle,
Subtitle = cardSubtitle,
Images = images,
Buttons = buttons
};
Attachment a = card.ToAttachment();
msg.Attachments.Add(a);
}
Facebook 目前不支持机器人升级为 phone 调用
只需将类型更改为 openUrl,它将使用以下类型的值:"tel: +xx xxx xxx xxxx"