So, I'm currently using this:
<!DOCTYPE html>
<html>
<body>
<div id="webchat"></div>
<script src="https://cdn.botframework.com/botframework-webchat/preview/botchat.js"></script>
<script>
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ secret: 'YOUR_BOT_SECRET_FROM_AZURE_PORTAL' })
}, document.getElementById('webchat'));
</script>
</body>
</html>
and it works fine, however I have multiple QnA Knowledge base for different client applications. SO I would like to pass custom parameter for 'applicationname' to decide the QNA KB in my BOT frame work(V4) in OnTurnAsync method.
I tried
var d1 = window.WebChat.createDirectLine({ token })
window.WebChat.renderWebChat({
directLine: d1,
styleSet,
postActivity: activity => {
var newActivity = Object.assign({}, activity, {channelData: { "userparam": "test" } });
return dl.postActivity(newActivity);
}
}, document.getElementById('webchat'));
})();
but Context.Activity.ChannelData in bot returning Null
and also tried
var d1 = window.WebChat.createDirectLine({ token })
window.WebChat.renderWebChat({
directLine: d1,
user: { id: 'userid', userparam:'test'},
styleSet
}, document.getElementById('webchat'));
})();
still Context.Activity.From.Properties["userparam"] returns Null
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…