Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
320 views
in Technique[技术] by (71.8m points)

email - I want to trigger mail when the bot says that it has no answer

I want to trigger mail when the bot says that it has no answer.

I'm using MS bot framework SDk4, and using LUIS and QnA maker also, when the bot reached the to a point where it says that it has no answer , we want a mail to be triggered or add a new item in the sharepoint

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to add a no answer to a SharePoint List, I managed to get it working using the csom-node package and Bot Framework v4 / NodeJS. Granted, it's not the most elegant solution, but it works.

Bot.JS

const csomapi = require('../node_modules/csom-node');
settings = require('../settings').settings;

// Set CSOM settings
csomapi.setLoaderOptions({url: settings.siteurl});

Bit further down the page...

// 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();
                });
            }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...