Last active
January 16, 2020 22:26
-
-
Save dhinag/689e4f00e021c4ea81e1ef71b1ed5db3 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script> | |
<style> | |
html, | |
body { | |
height: 100%; | |
} | |
body { | |
margin: 0; | |
} | |
#webchat { | |
height: 100%; | |
width: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="webchat" role="main"></div> | |
<script> | |
const store = WebChat.createStore({}, ({ dispatch }) => next => action => { | |
const { type } = action; | |
if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') { | |
dispatch({ | |
type: 'WEB_CHAT/SEND_EVENT', | |
payload: { | |
name: 'startConversation', | |
type: 'event', | |
value: {text: "hello"} | |
} | |
}); | |
} | |
return next(action); | |
}); | |
window.WebChat.renderWebChat( | |
{ | |
directLine: window.WebChat.createDirectLine({ | |
token: 'YOUR DIRECT LINE TOKEN' | |
}), | |
store, | |
styleOptions: { | |
backgroundColor: 'rgba(255, 255, 255, .8)' | |
} | |
}, | |
document.getElementById('webchat') | |
); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment