Microsoft Bot无法从Firebase云功能回复 [英] Microsoft bot does not respond back from firebase cloud function

查看:105
本文介绍了Microsoft Bot无法从Firebase云功能回复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ms bot框架并创建了一个新的bot.并在Google Firebase功能上部署了机器人连接器部分.但是下面的代码没有响应.下面是代码:

I am using ms bot framework and created a new bot. and deployed the bot connector part on the google firebase functions. But below code does not respond. Below is the code:

const builder = require('botbuilder');
const teams = require('botbuilder-teams');


import * as util from 'util';
const restify = require('restify');


let connector = new teams.TeamsChatConnector({
    appId: 'my app id',
    appPassword: 'my app secret'
});

var server = restify.createServer(); 
server.listen(80, function () {    
  console.log('%s listening to %s', server.name, util.inspect(server.address())); 
});   

server.post('/api/messages', connector.listen());


new builder.UniversalBot(connector, function (session:any) {
    console.log("inside bot got something dude:::::" + session.message.text);

});

漫游器设置的终点配置为:

the end point in bot settings is configured as:


https://us-central1-xxxx.cloudfunctions.net/api/messages

预期的行为:当我使用Bot Tester向Bot发送消息时,我应该能够在Firebase功能日志中看到控制台消息"Bot里面有东西dude :::::".

Expected Behavior: when i send a message to the bot using bot tester then i should be able to see console message "inside bot got something dude:::::" in the firebase functions log.

但是,它永远不会被调用,所以我不确定这里缺少什么.

however, it is never invoked so i am not sure what is missing here.

如果您想知道为什么我们使用google firebase函数而不是天蓝色,那么答案是我们使用firebase DB,并且我们的漫游器响应需要进入相同的firedb.同样,我们不必为运行简单的节点基本代码而支付/订阅更多的云.

If you are wondering why we are using google firebase functions rather azure then the answer is we use firebase DB and our bot response need to go into the same firedb. Also we dont have to pay/subscribe for one more cloud just to run a simple node base code.

推荐答案

不确定是否是问题所在,但是我所有的Firebase函数都使用以下格式调用

Not sure if this is the issue, but all my Firebase Functions are called using the format

https://us-central1-name_of_app.cloudfunctions.net/name_of_function

使用格式调用它

https://us-central1-name_of_app.cloudfunctions.net/api/name_of_function

(添加了/api/),这似乎使您好像在呼叫另一个网站,而不是实际的功能.

(with the added /api/) which makes it seem like you're calling another website and not the actual function.

您可以在Firebase功能主页面上找到托管功能的URL.

You can find the URL your function is hosted at in the main Firebase Functions page by the way.

希望有帮助!

这篇关于Microsoft Bot无法从Firebase云功能回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆