Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
renderWebchat();
async function renderWebchat()
{
const store = window.WebChat.createStore({}, ({ dispatch }) => next => action => {
if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
dispatch({
type: 'WEB_CHAT/SEND_EVENT',
payload: {
name: 'webchat/join',
value: { accessToken }
}
});
}
return next(action);
});
await window.WebChat.renderWebChat({
//You must not directly using the Direct line secret. This is just for proof of concept only.
directLine: await window.WebChat.createDirectLine({ token: 'JVGX1eOfFYhBxi-zPpMNk' }), //Direct line secret obtained from the Azure -> Web App Bot -> Channels -> Direct Line -> Secret Key.
userID: 'dhina', //random guid is acceptable
username: 'Web Chat User', //random guid is acceptable
locale: 'en-US',
store
}, document.getElementById('webchat'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment