小编Mic*_*den的帖子

Microsoft Bot Framework自定义Facebook消息

我已经开始在C#和Microsoft Bot Framework中使用Bot Builder SDK处理我的聊天机器人.我已经部署了我的机器人,可以与它进行交互.目前我专注于Facebook Messenger.我已经可以使用Microsoft.Bot.Connector.Attachment在Messenger上显示卡片和按钮.您可以在Bot Connector文档中找到它.现在我正在尝试实现自定义Facebook消息,但没有成功.这是我的代码:

public async Task<Message> Post([FromBody]Message message)
    {
        if (message.Type == "Message")
        {
            message.BotPerUserInConversationData = null;


            if (message.Text.Equals("test", StringComparison.InvariantCultureIgnoreCase))
            {
                var replyMessage = message.CreateReplyMessage();
                replyMessage.ChannelData = new
                {
                    notification_type = "NO_PUSH",
                    attachment = new
                    {
                        type = "template",
                        payload = new
                        {
                            template_type = "receipt",
                            recipient_name = "Stephane Crozatier",
                            order_number = "12345678902",
                            currency = "USD",
                            payment_method = "Visa 2345",
                            order_url = "http://petersapparel.parseapp.com/order?order_id=123456",
                            timestamp = "1428444852",
                            elements = new[]
                            {
                                new {
                                    title = …
Run Code Online (Sandbox Code Playgroud)

c# chatbot facebook-messenger botframework

9
推荐指数
1
解决办法
2077
查看次数

标签 统计

botframework ×1

c# ×1

chatbot ×1

facebook-messenger ×1