Sample chat app for the Microsoft Bot Framework using the DirectLine API.
You can easily play with a recent build using botchattest
Rapidly-evolving proof of concept. Not currently supported or in any way production-ready. Questions and comments to [email protected]. Please don't submit pull requests unless we have previously discussed it.
- Clone this repo
npm install
npm run build
(to build on every changenpm run watch
, to build minifiednpm run minify
)
- If you haven't already, register your bot
- Add a DirectLine channel, and generate a Direct Line Secret
- For testing you can use your Secret as a security token but for production you will likely want to exchange that secret for a Token as detailed in the Direct Line documentation.
- Include public/botchat.js and you will get a React component called BotChat.App
- For TypeScript users there is a definition file called public/botchat.d.ts
- Pass in the appropriate properties (listed in botchat.d.ts)
- This method requires passing your Secret in the querystring, and as such should only be used for local testing
- Start a local web server (I use http-server) and aim your browser at
http://localhost:{port}?s={Secret}
- Follow the above instructions to serve the botchat in its own web page
- In your web server, inject the appropriate properties (listed in botchat.d.ts) by replacing the line labelled
// ADD MORE CONFIG HERE
in index.html - In your web server, exchange the Secret for a Token as detailed in the Direct Line documentation.
- In a second web page, embed the botchat via
<iframe src="http://{host}:{port}?t={Token}" width="400" height="500"/>
(An example of this approach is botchattest)
© 2016 Microsoft Corporation