是否有消息“抱歉,似乎出了点问题。” 当我使用收据卡时在 Line 和 Messengers

我创建了一个机器人并使用收据代码来显示我的摘要结果。在测试和部署到网络聊天频道时没有出现问题,但是当我将机器人添加到 Line 频道和 Messenger 频道时,我收到此消息“抱歉,看起来出了问题。” 我检查了我的代码,发现问题发生在我使用收据卡时。


我的代码(在ConfirmBookingStepAsync处发出)


namespace Microsoft.BotBuilderSamples

{

    public class BookingDataDialog : ComponentDialog

    {

        private readonly IStatePropertyAccessor<BookingData> _userProfileAccessor;


        public BookingDataDialog(UserState userState)

            : base(nameof(BookingDataDialog))

        {

            _userProfileAccessor = userState.CreateProperty<BookingData>("BookingData");


            // This array defines how the Waterfall will execute.

            var waterfallSteps = new WaterfallStep[]

            {

                AllowBookingStepAsync,

                SelectRoomStepAsync,

                EmployeeIdStepAsync,

                BookingDateStepAsync,

                TimeFromStepAsync,

                TimeToStepAsync,

                ConfirmBookingStepAsync,

                FinalStepAsync

            };


            // Add named dialogs to the DialogSet. These names are saved in the dialog state.

            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps));

            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));

            AddDialog(new TextPrompt(nameof(TextPrompt)));

            AddDialog(new DateTimePrompt(nameof(DateTimePrompt)));

            AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt)));


            // The initial child Dialog to run.

            InitialDialogId = nameof(WaterfallDialog);

        }


ibeautiful
浏览 50回答 1
1回答

慕沐林林

收据卡在 Messenger 中得到正式支持,但由于通道连接器错误而无法工作。我已在内部提交了该错误的申请。同时,解决方法是使用 Facebook Messenger 的收据模板并将 Messenger 平台模板作为渠道数据发送。在 Node.js 中发送收据卡的简单示例:this.onMessage(async context => {  await context.sendActivity({    channelData: {      'attachment': {        'type': 'template',        'payload': {          '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',                   'address': {            'street_1': '1 Hacker Way',            'street_2': '',            'city': 'Menlo Park',            'postal_code': '94025',            'state': 'CA',            'country': 'US'          },          'summary': {            'subtotal': 75.00,            'shipping_cost': 4.95,            'total_tax': 6.19,            'total_cost': 56.14          },          'adjustments': [            {              'name': 'New Customer Discount',              'amount': 20            },            {              'name': '$10 Off Coupon',              'amount': 10            }          ],          'elements': [            {              'title': 'Classic White T-Shirt',              'subtitle': '100% Soft and Luxurious Cotton',              'quantity': 2,              'price': 50,              'currency': 'USD',              'image_url': 'http://petersapparel.parseapp.com/img/whiteshirt.png'            },            {              'title': 'Classic Gray T-Shirt',              'subtitle': '100% Soft and Luxurious Cotton',              'quantity': 1,              'price': 25,              'currency': 'USD',              'image_url': 'http://petersapparel.parseapp.com/img/grayshirt.png'            }          ]        }      }    }  });});要创建实现 LINE 特定消息类型的消息,请将活动对象的通道数据属性设置为指定 LINE 消息类型和操作类型的 JSON 对象。这将指导您了解如何使用 LINE 特定消息的 channelData 属性。希望这可以帮助。
打开App,查看更多内容
随时随地看视频慕课网APP