2016-10-15 15 views
1

Microsoft Bot Frameworkを使用してボットを構築しようとしています。私は、エンドポイントとしてHttp Triggerを持つAzure関数を使用する予定です。 NodeJSは私が選んだ言語です。私はrestifyとnodejでbotframeworkの例を見ていますが、紺色の関数を使用しているものはありません。誰でも、ぼんやりした関数やnodejを使ってbotframeworkが開発された例を教えてもらえますか、それを行う方法の例を教えてください。クリス・アンダーソンからAzure関数を使用したMicrosoft BotフレームワークAppおよびNodeJS

答えて

1

...

https://github.com/christopheranderson/functions-bot-example

あなたはHTTPトリガーに接続する必要がありますし、次のコードは、統合を行います。

var listen = bot.listen(); 

var response = function (context) { 
    return { 
     send: function (status, message) { 
      var _msg = message ? message : (typeof status !== 'number' ? status : null) 
      var _status = typeof status === 'number' ? status : 200 
      var res = { 
       status: _status, 
       body: _msg 
      }; 

      context.res = res; 
      context.done(); 
     } 
    } 
} 



module.exports = function (context, req) { 
    listen(req, response(context)) 
} 
+0

上記の方法で試してみると、次のエラーが発生します。 –

+0

2016-10-15T21:57:30.527関数の実行中に例外が発生しました:Functions.spellcheck。 mscorlib:TypeError:res.statusがChatConnector.ispispatch(D:\ home \ site \ wwwroot \ spellcheck \ node_modules \ botbuilder \ lib \ bots \ ChatConnector.js:354:13)の 関数ではありません ChatConnector.verifyBotFramework D:\ home \ site \ wwwroot \ spellcheck \ node_modules \ botbuilder \ lib \ bots \ ChatConnector.js:106:18) D: js:36:23 –

1

あなたはここにhttps://github.com/vjrantal/bot-sample/commit/e80faefded1c9da9a8b0d69e36497bb221b54709 restifyで構築されたボットにAzureの機能の互換性をもたらすチェンジセットを見ることができます。

このアプローチは、Chris Andersonのプロジェクトhttps://github.com/christopheranderson/functions-bot-exampleから借用していますが、最新のbotbuilderで動作するように更新されています。

最新の機能ランタイムでは、ラッピングはもう必要ありません。詳細は、https://github.com/vjrantal/bot-sample/commit/fe56a16f6f0286bfe66095eefc417388c1bc1e1cを参照してください。

関連する問題