Tag: botframework

如何使用CustomVision API与NodeJS进行POST请求

我试图附加一个图像使用机器人模拟器工具,并将此图像发送到microsofts customvision api,我遇到的问题是,我得到 { Code: 'BadRequestImageFormat', Message: '' } 自定义视觉API调用返回。 我使用npm的request模块来处理这些调用 // Receive messages from the user and respond by echoing each message back (prefixed with 'You said:') var bot = new builder.UniversalBot(connector, function (session) { session.send("Hello"); //session.message.text // If there is an attachment if (session.message.attachments.length > 0){ console.log(session.message.attachments[0]) request.post({ url: 'xxx', encoding: null, json: […]

用自适应卡节点打开新的自适应卡

我试图在bot框架中使用自适应卡。 我想知道是否可以使用另一个自适应卡中的button在对话中调用新的自适应卡? 所以不是内联自适应卡,而是一个新的自适应卡在对话中。 这怎么可能,也许是一些示例代码? 我似乎无法find解决scheme? 非常感谢!

如何通过Bot框架使用电报渠道发送回发button中的对象?

我正在用BotFramework(nodeJS)开发一个具有四个连接通道的bot,其中一个是Telegram。 似乎Bot框架将'value'属性字段转换为来自Telegram API'InlineKeyboardButton'方法( docs )的'callback_data'字段。 我试图发送一个大于64B的post-backbutton的有效载荷,导致如下错误: 'Bad request: BUTTON_DATA_INVALID' 看看下面的代码片段,在“button”数组中的“值”字段中,问题依然存在。 注意:其他通道使用下面的结构正确地发送这个对象作为有效载荷。 这是要发送的有效载荷: const foobar = { "d": { "a": { "b": "192.168.0.12", "c": "12345678", "d": "123123" }, "e": { "f": "1", "g": "Test User", "h": [ { "i": "1", "j": "Foobar" } ] } } } 这是Bot框架中使用的丰富的消息结构,通过任何支持它的通道发送轮播,包括电报: { type: `message`, attachmentLayout: `carousel`, text: “, attachments: […]

使用botbuilder越区切换时,从DirectLine获取401错误

我正在研究一个新的机器人,并试图实现人工切换。 我正在使用Directline 3.0在BotFramework-WebChat客户端和托pipe在Azure Bot Service上的我的机器人之间进行通信。 我的问题是,当我的机器人尝试从用户发送消息到代理或代理到用户时,我从Directline API中收到401错误。 为了进一步解释这个问题,我们只需要讨论观察状态。 在代码中,客户消息通过中间件被拦截。 如果状态被确定为正在观看 ,则将消息消息路由到机器人和观看代理。 从bot发送给用户的消息,使用session.send('foo')发送,但工作正常,但是从bot到agent的消息发送如下: address = conversation.agent; // the commented codes makes the whole thing work… // address.useAuth = true; agentMessage = new builder.Message() .address(address) .text(message.text); bot.send(agentMessage, (err) => { console.log(err); }); 不工作,除非我添加一个useAuth标志。 我在ChatConnector.js实现中find了这个标志,它似乎决定了(正如你猜测的那样)消息在发送时是否使用授权的请求。 你可以在我的上面的代码中看到我可以自己设置这个标志,但是这是一个冒险的解决scheme,它似乎是绕过了真正的应用程序逻辑。 这整个事情感觉不对,我觉得我错过了一些东西,但我不知道如何使这些请求工作,而无需直接设置useAuth 。 以下是我的切换客户端的相关代码。 我已经从下面删除了一些代码,只关注来自客户的消息,而对话处于等待状态。 /* this middleware is used by the bot […]

如何让机器人使用微软僵尸框架与Slack中的用户进行1:1对话?

我正在使用微软僵尸框架Nodejs。 我希望我的机器人能够和一个用户在一个组里面开始一个私人对话。 目前,我的机器人与任何回应的成员进行对话。 例如, 我:你好@bot Bot:嗨 我:我需要点比萨饼 博特:你想吃比萨饼什么? 部分团队成员:蘑菇和洋葱 Bot:订购比萨蘑菇和洋葱。 正如你所看到的,谈话被其他一些成员劫持,这是我面临的问题,我想避免这种情况发生。 我想让机器人一次只与一个成员进行交stream,当对话以用户结束时,就可以用与前一个用户相同的方式与任何人进行交stream。 任何build议将是伟大的!

使用微软BotFramework在电报中寻求显示videocard / youtubevideo的build议

我的目标是在电报中显示YouTubevideo(最好是以卡的forms),同时尽可能使用botbuilder模块将我的代码保持为“通道不可知”。 谁能告诉我为什么Telegram使用从官方示例回购 (createVideoCard()示例)采取的这个NodeJS示例将video显示为一个普通图像? (youtube链接的行为相同)。 var builder = require('botbuilder'); function (session, results, next) { const msg = new builder.Message(session) .addAttachment(new builder.VideoCard(session) .title('Big Buck Bunny') .subtitle('by the Blender Institute') .text('Big Buck Bunny (code-named Peach) is a short computer-animated comedy film by the Blender Institute, part of the Blender Foundation. Like the foundation\'s previous film Elephants Dream, the […]

DirectLine客户端从websocket获取来自bot的多个响应

我正在开发一个使用Swagger和直接在Node.js上跟随这个例子的聊天机器人:( https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-DirectLineWebSockets ) 每次我发送一条消息到机器人,我收到以前发送的每个消息的多个响应。 例: 消息发送1 回应1 消息发送2 回应2 回应2 消息发送3 回应3 回应3 回应3 用例与这个问题类似,但用websocket。 ( DirectLineJS接收Bot回复的副本 ) 发信息: // send message to bot function sendMessages(client, conversationId, utterance) { logger.debug("*** SEND A MESSAGE "); client.Conversations.Conversations_PostActivity( { conversationId: conversationId, activity: { textFormat: config.activity.textFrormat, text: utterance, type: config.activity.type, from: { id: callSid } } }).catch(function (err) { […]

如何在bot框架触发事件(主动模板)中获取会话?

这是具有主动模板的bot的触发事件。 bot.on('trigger', function (message) { // handle message from trigger function var queuedMessage = message.value; var reply = new builder.Message() .address(queuedMessage.address) .text('Your order is placed, ref: ' + queuedMessage.orderRef); bot.send(reply); //save this orderRef to session userData //session.userData.lastOrderRef = queuedMessage.orderRef; }); 在这里我需要保存orderRef到相应的用户session 。 如何在触发事件中获得session ?

Azure bot框架:显示欢迎消息

我试图创build一个bot,当我使用NodeJS刷新或启动机器人(注意:不用初始input任何东西)时,给我一个欢迎消息。 我使用了下面的代码 var bot = new builder.UniversalBot(connector, [ function (session) { builder.Prompts.text(session, 'Hi! What is your name?'); } ]); 但是这并不能帮助我,只有当我input一些东西的时候才会给我一个信息

Microsoft Bot框架 – 在对话框中发送消息

我正在使用微软的Bot Framework创build一个简单的高低聊天机器人,让你猜测一个随机数。 我决定使用recursion对话框; 然而,每当我使用session.send发送消息,它结束对话框。 我如何发送不会结束对话的消息? bot.add('/max-num', [ function (session) { builder.Prompts.number(session, "What's the max number?") }, function (session, results) { var max = results.response; session.userData.max = max; session.userData.num = Math.ceil(Math.random() * max) session.userData.round = 1; session.send("I choose a number between 1 and " + max + " inclusively!"); session.replaceDialog('/round'); } ]); bot.add('/round', [ function (session) […]