在用于Microsoft Botframework的Python webapp中,我希望reply to a message使用REST API call到{
当我在本地机器上试用模拟器时,我发现REST调用的最小有效负载如下所示:
{
"text": "Hello, Hello!",
"from": {
"address": "MyBot"
},
"channelConversationId": "ConvId"
}
其中"ConvId"
是本地仿真器在原始消息中给出的id(注意,我必须发送channelConversationId
而不是conversationId
)。在
显然,这对于live bot连接器站点是不够的。但是,使用restapi调用/bot/v1.0/messages
回复消息的(最小)示例是什么?在
我测试了不同的有效负载数据,例如文档中所示的属性from
、to
、channelConversationId
、text
和{500
错误:
当我试图发回原始消息时,刚好to
和from
交换,我得到了一个不同的500
错误:
{
"error": {
"code": "ServiceError",
"message": "*Sorry, Web Chat is having a problem responding right now.*",
"statusCode": 500
}
}
同时,答案已经发布到a GitHub issue,引用了wiltodelta
尤其是,属性
replyToMessageId
和channelConversationId
(前面提到的)是不必要的:它们指的是会话中最后看到的消息,因此在会话期间会发生变化。在内联回复(作为响应返回)的最小有效负载为:
如果您使用POST to
^{pr2}$/bot/v1.0/messages
向带外发布回复,那么您是正确的,您需要更多。以下是我在Bot Builder SDK的节点版本中的操作:向现有会话发送回复有点复杂,因为您必须包含将其返回到源会话所需的所有路由位。开始一个新的对话要容易得多:
^{3}$两个示例都假定
reply.text
&;reply.language
已经设置。在相关问题 更多 >
编程相关推荐