Created
May 6, 2019 20:26
-
-
Save dhinag/3f9c14237570cc17278e489bcf0c4905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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