对于网址类型按钮,网址不能为空

时间:2017-04-05 07:16:23

标签: botframework

 var msg = context.MakeMessage();


            msg.Attachments = new List<Attachment>();

            SigninCard card = new SigninCard()
            {
                 Text= "link it",

                Buttons = new List<CardAction>
                         {
                             new CardAction
                            {

                                Value = "account linking url https",
                                Type = "account_link",
                                Title = "Link"

                            },

                        }
            };

            msg.Attachments.Add(card.ToAttachment());


 await context.PostAsync(msg);

我正在尝试使用SignInCard链接Facebook帐户。 出现此错误:

  

{“error”:{“message”:“(#100)网址对于网址类型不能为空   按钮”, “类型”: “OAuthException”, “代码”:100, “error_subcode”:2018041, “fbtrace_id”: “GclYUUuTL2D”}}

但是url字段中有一个字符串https url。

有什么想法吗?

2 个答案:

答案 0 :(得分:1)

我想出来了。

var msg = context.MakeMessage();


            dynamic messageData = new JObject();
            messageData.attachment = new JObject();
            messageData.attachment.type = "template";
            messageData.attachment.payload = new JObject();
            messageData.attachment.payload.template_type = "generic";


            messageData.attachment.payload.elements
                = new JArray(
                    new JObject(
                        new JProperty("title", "title"),
                        new JProperty("subtitle", "Link your account"),
                        new JProperty("buttons",
                            new JArray(
                                new JObject(
                                    new JProperty("type", "account_link"),
                                    new JProperty("url", "yourUrl")
                                )
                            )
                        )
                    )
                );


            msg.ChannelData = messageData;


                await context.PostAsync(msg);

答案 1 :(得分:0)

您无需进入特定频道ChannelData。在SigninCard的按钮初始值设定项中,而不是

Type = "account_link",

使用

Type = ActionTypes.Signin,

在我的Facebook Messenger频道上工作。