-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.Required for internal Azure reporting. Do not delete. Do not change color.customer-replied-toRequired for internal reporting. Do not delete.Required for internal reporting. Do not delete.customer-reportedRequired for internal Azure reporting. Do not delete.Required for internal Azure reporting. Do not delete.questionFurther information is requested. Stack Overflow candidateFurther information is requested. Stack Overflow candidate
Description
Flow
ASP.NET Core MVC View [loads webchat] -> Controller gets token generated -> Bot Channels Registration -> Bot service
Though followed backchannel sample, it does not get the welcome message. The same backchannel works for simple html page, but not Razor based view page.
Any thoughts what could be missing here?
View page (token is generated on server side)
@model EchoAuthBot.ClientApp.ChatConfig;
@{
ViewData["Title"] = "Index";
}
<!DOCTYPE html>
<html>
<body>
<h1>Index</h1>
<div id="webchat" role="main"></div>
@*<script src="https://cdn.botframework.com/botframework-webchat/master/webchat-es5.js"></script>*@
<script src="https://cdn.botframework.com/botframework-webchat/master/webchat.js"></script>
<script>
// Get welcome message
// We are using a customized store to add hooks to connect event
const store = window.WebChat.createStore({}, ({ dispatch }) => next => action => {
//console.log(action);
if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
dispatch({
type: 'WEB_CHAT/SEND_EVENT',
payload: {
name: 'webchat/join',
value: { language: window.navigator.language }
}
});
}
return next(action);
});
// Set the StyleOptions for avatar
const styleOptions = {
botAvatarInitials: 'WC',
userAvatarInitials: 'WW'
};
// Render the webchat control
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({ token: `@Model.Token.ToString()` }),
store,
userID: `@Model.UserId.ToString()`,
username: 'Web Chat User',
locale: 'en-US',
styleOptions
}, document.getElementById('webchat'));
document.querySelector('#webchat > *').focus();
</script>
</body>
</html>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bot ServicesRequired for internal Azure reporting. Do not delete. Do not change color.Required for internal Azure reporting. Do not delete. Do not change color.customer-replied-toRequired for internal reporting. Do not delete.Required for internal reporting. Do not delete.customer-reportedRequired for internal Azure reporting. Do not delete.Required for internal Azure reporting. Do not delete.questionFurther information is requested. Stack Overflow candidateFurther information is requested. Stack Overflow candidate