我正在关注这个:https ://developers.facebook.com/docs/messenger-platform/webview/sharing
我创建了自定义类:
[JsonObject(MemberSerialization.OptIn)]
public class elements
{
[JsonProperty]
public string title { get; set; }
[JsonProperty]
public string image_url { get; set; }
[JsonProperty]
public string subtitle { get; set; }
[JsonProperty]
public default_action default_action { get; set; }
[JsonProperty]
public buttons[] buttons { get; set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class default_action
{
[JsonProperty]
public string type { get; set; }
[JsonProperty]
public string url { get; set; }
}
[JsonObject(MemberSerialization.OptIn)]
public class buttons
{
[JsonProperty]
public string type { get; set; }
[JsonProperty]
public string url { get; set; }
[JsonProperty]
public string title { get; set; }
}
然后,在方法中:
elements e = new elements();
e.default_action.type = "web_url";
e.default_action.type = "https://www.youtube.com/watch?v=kOkQ4T5WO9E";
e.title = "title";
List<buttons> list = new List<buttons>();
buttons b = new buttons();
b.title = "button title";
b.type = "web_url";
b.url = "https://www.youtube.com/watch?v=kOkQ4T5WO9E";
list.Add(b);
e.buttons = list.ToArray();
msg.ChannelData = e;
msg.Text = "test";
但它会引发错误。在 bot 框架仪表板中看不到问题。如何调试这个?