recime-bot-runtime
Version:
This runtime is intended to run inside a micro-service container with platform specific integration and module interpreter.
29 lines (28 loc) • 907 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var request = require("request");
var Wit = /** @class */ (function () {
function Wit(bot) {
this.bot = bot;
}
Wit.prototype.process = function (payload) {
var _this = this;
return new Promise(function (resolve, reject) {
request({
uri: 'https://api.wit.ai/message',
headers: {
authorization: "Bearer " + _this.bot.config['SYSTEM_RECIME_WITAI_ACCESS_KEY']
},
qs: {
q: payload.text.length > 280 ? payload.text.substring(0, 280) : payload.text,
v: '20170307'
},
json: true
}, function (err, response, body) {
resolve(body);
});
});
};
return Wit;
}());
exports.Wit = Wit;