【发布时间】:2019-03-29 21:25:01
【问题描述】:
我需要通过一个简单的 Microsoft Bot Framework 机器人和一个 Web 客户端(HTML、CSS 和 JavaScript、jQuery)建立通信
我看到有一些方法可以使用 WebChat、DirectLine API 来做到这一点,但我不想使用任何 Azure 服务,如 Bot Registrations Service 或 App Service 来获取频道,而是我想使用纯 JavaScript 来调用bot 因为它只是一个 Web API 应用程序,所以必须有办法。
我尝试了一个简单的 jQuery ajax 调用,它调用了服务器,但很快就失败了
$(document).ready(function() {
$.post('http://localhost:3979/api/messages', {
"type": "message",
"from": {
"id": "user1"
},
"text": "hello"
}).fail(function(error) {
debugger;
}).done(function(response) {
debugger;
});
});
看来我需要完全形成活动对象https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference?view=azure-bot-service-4.0#activity-object 但是我怎样才能获得所有属性值
谁能告诉我这是否可能以及如何实现它
【问题讨论】:
标签: c# azure asp.net-web-api botframework direct-line-botframework