diff --git a/samples/react-bot-framework/.vscode/settings.json b/samples/react-bot-framework/.vscode/settings.json index ab46aaa4f..e948448d9 100644 --- a/samples/react-bot-framework/.vscode/settings.json +++ b/samples/react-bot-framework/.vscode/settings.json @@ -18,4 +18,6 @@ "lib": true, "temp": true } +, +"typescript.check.workspaceVersion": false } diff --git a/samples/react-bot-framework/README.md b/samples/react-bot-framework/README.md index 70a7bf252..89d9877c0 100644 --- a/samples/react-bot-framework/README.md +++ b/samples/react-bot-framework/README.md @@ -1,9 +1,10 @@ # Microsoft Bot Framework Web Chat ## Summary -Short summary on functionality and used technologies. +A web part that acts as a web chat component for bot's built on the Microsoft Bot Framework using the Direct Line API. When sending messages +the web part uses the username of the currently logged in user. The web part has settings for color for branding purposes. -[picture of the web part in action] +![bot framework client web part](screenshot.png) ## Applies to @@ -12,10 +13,10 @@ Short summary on functionality and used technologies. * [Microsoft Bot Framework](http://dev.botframework.com) ## Prerequisites - -> You need to have a bot created and registered using the Microsoft Bot Framework and registered to use the Direct Line Channel, -which will give you the secret needed when adding this web part to the page. For more information on creating a bot and registering -the channel you can see the official web site at [dev.botframework.com](http://dev.botframework.com), as well as various tutorials + +> You need to have a bot created and registered using the Microsoft Bot Framework and registered to use the Direct Line Channel, +which will give you the secret needed when adding this web part to the page. For more information on creating a bot and registering +the channel you can see the official web site at [dev.botframework.com](http://dev.botframework.com), as well as various tutorials over at [www.garypretty.co.uk/category/microsoft-bot-framework/](http://www.garypretty.co.uk/category/microsoft-bot-framework/) ## Solution @@ -45,7 +46,7 @@ Version|Date|Comments - Register your bot in the Microsoft Bot Framework Portal, configure the Direct Line channel on the bot and obtain your Direct Line secret. -## Features +## Features This Web Part illustrates the following concepts on top of the SharePoint Framework: - Connecting and communicating with a bot built on the Microsoft Bot Framework using the Direct Line Channel @@ -54,7 +55,7 @@ This Web Part illustrates the following concepts on top of the SharePoint Framew - React When adding the web part to a page you need to obtain your Bot Direct Line Channel secret via the [Bot Framework Portal](http://dev.botframework.com). -You then add this secret via the Property Pane of the web part. If there is an error initializing the Direct Line Client with the bot then they will +You then add this secret via the Property Pane of the web part. If there is an error initializing the Direct Line Client with the bot then they will be shown in the console within the browser. Additional settings can be set to style the web part, including; @@ -64,7 +65,7 @@ Additional settings can be set to style the web part, including; - Placeholder text - Foreground / background colors for messages, both from the user and from the bot -Currently this web part only supports plain text conversations with a bot. Other message types, +Currently this web part only supports plain text conversations with a bot. Other message types, such as Rich Cards and Attachments are not supported, but are on the roadmap for a future update. \ No newline at end of file diff --git a/samples/react-bot-framework/screenshot.png b/samples/react-bot-framework/screenshot.png new file mode 100644 index 000000000..d1c55bd76 Binary files /dev/null and b/samples/react-bot-framework/screenshot.png differ diff --git a/samples/react-bot-framework/src/webparts/botFrameworkChat/BotFrameworkChatWebPart.manifest.json b/samples/react-bot-framework/src/webparts/botFrameworkChat/BotFrameworkChatWebPart.manifest.json index 22121b912..c6589a046 100644 --- a/samples/react-bot-framework/src/webparts/botFrameworkChat/BotFrameworkChatWebPart.manifest.json +++ b/samples/react-bot-framework/src/webparts/botFrameworkChat/BotFrameworkChatWebPart.manifest.json @@ -21,8 +21,7 @@ "botMessagesBackgroundColor": "c8c8c8", "botMessagesForegroundColor": "000000", "userMessagesBackgroundColor": "c7e0f4", - "userMessagesForegroundColor": "000000", - "directLineClientName": "DirectLineClient" + "userMessagesForegroundColor": "000000" } }] } diff --git a/samples/react-bot-framework/src/webparts/botFrameworkChat/BotFrameworkChatWebPart.ts b/samples/react-bot-framework/src/webparts/botFrameworkChat/BotFrameworkChatWebPart.ts index b1e5d6ed3..a14ce4d5b 100644 --- a/samples/react-bot-framework/src/webparts/botFrameworkChat/BotFrameworkChatWebPart.ts +++ b/samples/react-bot-framework/src/webparts/botFrameworkChat/BotFrameworkChatWebPart.ts @@ -7,7 +7,6 @@ import { PropertyPaneTextField } from '@microsoft/sp-client-preview'; -import * as strings from 'botFrameworkChatStrings'; import BotFrameworkChat, { IBotFrameworkChatProps } from './components/BotFrameworkChat'; import { IBotFrameworkChatWebPartProps } from './IBotFrameworkChatWebPartProps'; @@ -29,7 +28,7 @@ export default class BotFrameworkChatWebPart extends BaseClientSideWebPart console.error('Error sending message:', err)); @@ -114,17 +117,17 @@ export default class BotFrameworkChat extends React.Component this.printMessages(messages)) + .then((messages) => this.printMessages(messages)); }, this.pollInterval); } protected printMessages(messages) { if (messages && messages.length) { - messages = messages.filter((m) => m.from !== this.props.directLineClientName); + messages = messages.filter((m) => m.from !== this.sendAsUserName); if (messages.length) { messages.forEach(this.printMessage); } - }; + } } protected printMessage(message) {