Bot Framework openUrl无法在Messenger上执行建议的操作 [英] Bot Framework openUrl not working for suggested action on messenger

查看:83
本文介绍了Bot Framework openUrl无法在Messenger上执行建议的操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Bot Builder Node.js sdk创建facebook机器人,并且尝试创建建议的操作,该操作会将用户导航到网页.我知道,facebook具有局限性,它只能重定向到https端点,但是由于我重定向到的页面是https,所以这显然不是问题.这是我的代码:

var msg = new builder.Message(session)
.text("User message here")
.suggestedActions(
    builder.SuggestedActions.create(
            session, [
                builder.CardAction.imBack(session, "command1", "Command1"),
                builder.CardAction.imBack(session, "command2", "Command2"),
                builder.CardAction.openUrl(session, "https url", "Go to web")
            ]
        )); 
session.send(msg);

问题是,当我单击Messenger上的openUrl操作时,什么都没有发生.它可以在模拟器上正常工作.请,有人可以帮我,如何解决这个问题?谢谢.

解决方案

Facebook Messenger的建议操作(快速回复)不支持"openURL". 快速答复仅支持以下:

  • 文本快速回复:文本将显示给用户,有效负载将发送回bot
  • 电话号码快速回复:

允许您向用户询问电话号码.发送电话号码快速回复后,Messenger平台将自动使用用户个人资料信息中的电话号码预先填写显示的快速回复.

  • 通过电子邮件快速回复:

允许您向用户询问电子邮件.发送电子邮件快速回复后,Messenger平台将自动使用用户个人资料信息中的电子邮件预填充显示的快速回复.

  • 位置快速回复(已弃用)

I am creating facebook bot using Bot Builder Node.js sdk and I am trying to create suggested action, which would navigate users to web page. I know, that facebook has limitation, that it redirects only to https endpoints, but as the the page I am redirecting to is https, this is clearly not a problem. Here is my code:

var msg = new builder.Message(session)
.text("User message here")
.suggestedActions(
    builder.SuggestedActions.create(
            session, [
                builder.CardAction.imBack(session, "command1", "Command1"),
                builder.CardAction.imBack(session, "command2", "Command2"),
                builder.CardAction.openUrl(session, "https url", "Go to web")
            ]
        )); 
session.send(msg);

Problem is, that when I click the openUrl action on messenger, nothing happens. It works properly on emulator. Please, can somebody help me, how to solve this issue? Thank you.

解决方案

Facebook messenger suggested actions (Quick Reply) do not support "openURL". Quick Replies only support the following:

  • Text Quick Reply: Text will be shown to user, payload will be send back to bot
  • Phone Number Quick Reply:

allows you to ask a user for the phone number. When the phone number quick reply is sent, the Messenger Platform will automatically pre-fill the displayed quick reply with the phone number from the user's profile information.

  • Email Quick Reply:

allows you to ask a user for the email. When the email quick reply is sent, the Messenger Platform will automatically pre-fill the displayed quick reply with the email from the user's profile information.

  • Location Quick Reply (Deprecated)

这篇关于Bot Framework openUrl无法在Messenger上执行建议的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆