如果我发送普通消息,我可以将ChannalData添加到消息中:
IMessageActivity message = Activity.CreateMessageActivity();
message.ChannelData = JObject.Parse("{'messaging_type':'RESPONSE'}");但如果我用的是FormBuilder
return new FormBuilder<SandwichOrder>()
.Message("Welcome to the sandwich order bot!")
.
...
.Build();我不知道如何添加ChannelData。
下面的信息是在Facebook文档中找到的,也是我问这个问题的原因。
打破变更通知从2018年5月7日开始,messaging_type属性将是必需的,所有没有它的消息都不会被传递。
发布于 2018-01-08 19:46:24
您可以通过在OnCompletion委托中实现它来实现它。它在表单完成时触发。
return new FormBuilder<SandwichOrder>()
.Message("Welcome to the simple sandwich order bot!")
.OnCompletion((context, state) => context.Activity.ChannelData = JObject.Parse("{'messaging_type':'RESPONSE'}"))
.Build();https://stackoverflow.com/questions/48154033
复制相似问题