Email 当机器人说它没有答案时,我想触发邮件
当机器人说它没有答案时,我想触发邮件 我使用的是MS bot framework SDk4,还使用了LUIS和QnA maker,当bot达到无法回答的程度时,我们希望触发邮件或在sharepoint中添加新项目,但这对电子邮件不起作用(防止垃圾邮件),因此最好不要在电子邮件部分使用bot framework SDK@如果您使用的是C#SDK,那么Baruch的链接很好。这是给你的 你所要做的就是在QnA Maker没有返回任何结果时发送电子邮件。在中,您可以这样做:Email 当机器人说它没有答案时,我想触发邮件,email,botframework,Email,Botframework,当机器人说它没有答案时,我想触发邮件 我使用的是MS bot framework SDk4,还使用了LUIS和QnA maker,当bot达到无法回答的程度时,我们希望触发邮件或在sharepoint中添加新项目,但这对电子邮件不起作用(防止垃圾邮件),因此最好不要在电子邮件部分使用bot framework SDK@如果您使用的是C#SDK,那么Baruch的链接很好。这是给你的 你所要做的就是在QnA Maker没有返回任何结果时发送电子邮件。在中,您可以这样做: if(response!=
if(response!=null&&response.Length>0)
{
Wait turnContext.SendActivityAsync(MessageFactory.Text(响应[0]。应答),cancellationToken);
}
其他的
{
Wait turnContext.SendActivityAsync(MessageFactory.Text(“未找到QnA生成器答案”)、cancellationToken);
//添加发送通知电子邮件的代码
}
也就是说,如果您想尝试半主动路由,您可以在您的bot中启用电子邮件通道,然后使用以下方法:
if(response!=null&&response.Length>0)
{
Wait turnContext.SendActivityAsync(MessageFactory.Text(响应[0]。应答),cancellationToken);
}
其他的
{
Wait turnContext.SendActivityAsync(MessageFactory.Text(“未找到QnA生成器答案”)、cancellationToken);
MicrosoftAppCredentials.TrustServiceUrl(@)https://email.botframework.com/,DateTime.MaxValue);
var user=新的ChannelAccount(名称:“MyUser”,id:”);
var参数=新的ConversationParameters()
{
Members=newchannelaccount[]{user},
Bot=turnContext.Activity.Recipient
};
var连接器=新连接器客户端(新Uri(“https://email.botframework.com”):
private async Task ProcessSampleQnAAsync(iTurContext turnContext,CancellationToken CancellationToken)
{
_logger.LogInformation(“ProcessSampleQnAAsync”);
var results=await_botServices.SampleQnA.GetAnswersAsync(turnContext);
if(results.Any())
{
等待turnContext.SendActivityAsync(MessageFactory.Text(results.First().Answer),cancellationToken);
}
其他的
{
//把它放在这里
Wait turnContext.SendActivityAsync(MessageFactory.Text(“对不起,在Q和A系统中找不到答案”)、cancellationToken);
}
}
如果您想在SharePoint列表中添加否定答案,我使用csom节点包和Bot Framework v4/NodeJS成功地使其工作。诚然,这不是最优雅的解决方案,但它可以工作
Bot.JS
const csomapi = require('../node_modules/csom-node');
settings = require('../settings').settings;
// Set CSOM settings
csomapi.setLoaderOptions({url: settings.siteurl});
再往下一点
// If no answers were returned from QnA Maker, reply with help.
} else {
await context.sendActivity("Er sorry, I don't seem to have an answer.");
console.log(context.activity.text);
var response = context.activity.text;
var authCtx = new AuthenticationContext(settings.siteurl);
authCtx.acquireTokenForApp(settings.clientId, settings.clientSecret, function (err, data) {
var ctx = new SP.ClientContext("/sites/yoursite"); //set root web
authCtx.setAuthenticationCookie(ctx); //authenticate
var web = ctx.get_web();
var list = web.get_lists().getByTitle('YourList');
var creationInfo = new SP.ListItemCreationInformation();
var listItem = list.addItem(creationInfo);
listItem.set_item('Title', response);
listItem.update();
ctx.load(listItem);
ctx.executeQueryAsync();
});
}
可能与您使用的BotFramework SDK重复-NodeJs或C#?请提问并添加一个。我使用的是Dispatch model SDK(Luis和QnA的组合)template@jeganb我已经更新了我的答案,以反映派遣样本