I have to design a bot that can answer what my app users are asking about their project. Answers will be the implementations of certain APIs. These APIs that my bot will be using to give answers are secured by user-specific authentication tokens. As of now, I have written a bot using Microsoft bot framework and LUIS that understands certain utterances and can give answers with calling project APIS.I am confused about how to do these things :
How to pass user authentication token to bot? This toke is generated using user credentials (usename+password). Inside my bot code, I can't use username/password for generating the token.I need to pass them from client app only.
How to pass project Id to the bot about which user is asking the question? The user might be calling the name of the project, or will select the project from a list. The bot should be intelligent enough to change answers based on project Id.
As of now, I am handing second part using LUIS utterances + Entity combination. So my question(utterance is ): "tell me what's new in {projectid}" where projectid is my project entity.
But for the first question, I am still looking for the solution. Please suggest.
You will need few modification in your bot to use DirectLine API instead of webchat. Directline API gives you flexibility to send your own data to Bot. There are few reserved properties inside Activity.From from which you can read your data.
var userProperties = [];
userProperties.push({
projectId:
{Project_Id_Will_Be_Sent_Using_This},
UserToken:
{User_Generated_Token}
});
BotChat.App({
directLine: { secret: 'BOT-SECRET-KEY' },
user: { id: '', name:'', properties:userProperties },
bot: { id: 'YOUR-BOT-ID' },
resize: 'detect',
}, document.getElementById("bot"));
Please revert if you need any help around this.