You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-29Lines changed: 47 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -1,45 +1,47 @@
1
1
# Feedyou fork of Microsoft Bot Framework WebChat
2
2
3
3
Embeddable web chat control for the [Microsoft Bot Framework](http://www.botframework.com) using the [DirectLine](https://docs.botframework.com/en-us/restapi/directline3/) API. This repo is customized fork of [BotBuilder-WebChat](https://github.com/Microsoft/BotFramework-WebChat) by [Feedyou](https://feedyou.agency). This features were added by Feedyou in comparsion with `BotBuilder-WebChat`:
4
-
* show typing indicator on startup until the first message is recieved
5
-
* increase typing indicator timeout from 3 to 20 seconds
6
-
* show `imBack` buttons only for the last activity
7
-
* send backchannel event on startup which could be used instead of `conversationUpdate` event
8
-
* ability to pass some `userData` to bot using backchannel mechanism's `channelData` prop
9
-
* preset some default values in `<App>` component - for example generate `user.id` if not set
10
-
* support custom button click trigger for restarting conversation (`startOverTrigger` prop)
11
-
* make emoticons compatible using [Twemoji](https://github.com/twitter/twemoji)
12
-
* configurable style themes (currently only `theme.mainColor` prop)
13
-
* auto show upload button when `inputHint` property of last incoming activity was `expectingUpload`
14
-
* force intro dialog ID using `introDialog.id` property
15
-
* option `disableInputWhenNotNeeded` to disable input after messages with `inputHint==='ignoringInput`
4
+
5
+
- show typing indicator on startup until the first message is recieved
6
+
- increase typing indicator timeout from 3 to 20 seconds
7
+
- show `imBack` buttons only for the last activity
8
+
- send backchannel event on startup which could be used instead of `conversationUpdate` event
9
+
- ability to pass some `userData` to bot using backchannel mechanism's `channelData` prop
10
+
- preset some default values in `<App>` component - for example generate `user.id` if not set
11
+
- support custom button click trigger for restarting conversation (`startOverTrigger` prop)
12
+
- make emoticons compatible using [Twemoji](https://github.com/twitter/twemoji)
13
+
- configurable style themes (currently only `theme.mainColor` prop)
14
+
- auto show upload button when `inputHint` property of last incoming activity was `expectingUpload`
15
+
- force intro dialog ID using `introDialog.id` property
16
+
- option `disableInputWhenNotNeeded` to disable input after messages with `inputHint==='ignoringInput`
16
17
17
18
## How to add Web Chat to your website
18
19
19
20
### What you will get from Feedyou
21
+
20
22
These are configuration values you will get from Feedyou during WebChat implemenation phase.
21
23
22
-
*`DirectLine secret` is used for authentication
23
-
*`Bot ID` is string in format `feedbot-*`
24
-
*`Bot name` will be shown as author name of messages from bot
24
+
-`DirectLine secret` is used for authentication
25
+
-`Bot ID` is string in format `feedbot-*`
26
+
-`Bot name` will be shown as author name of messages from bot
25
27
26
28
Please paste these values to places marked by `...` in examples.
27
29
28
30
### What you will need to do on your website
29
31
30
-
Include `botchat.css`, `botchat-es5.js` (from our https://feedyou.azureedge.net/webchat/latest/... CDN) and following code into your website and paste required values you got from Feedyou. It will create expandable webchat in bottom right corner for you.
32
+
Include `botchat.css`, `botchat-es5.js` (from our https://cdn.feedyou.ai/webchat/latest/... CDN) and following code into your website and paste required values you got from Feedyou. It will create expandable webchat in bottom right corner for you.
header: { text:"Chatbot", textWhenCollapsed:"Click for chatbot!" }
@@ -53,13 +55,15 @@ Include `botchat.css`, `botchat-es5.js` (from our https://feedyou.azureedge.net/
53
55
> If you don't want to use polyfills for older browsers, you can use `botchat.js` instead of default `botchat-es5.js`.
54
56
55
57
If you want to make the expansion logic by yourself or you want to put bot directly into some existing element on your page, you can check out our examples:
56
-
-[/samples/feedyou/code.html](https://github.com/wearefeedyou/feedbot-webchat/blob/master/samples/feedyou/code.html) show the most simple way how to inject webchat into your page which you can also use with GTM or some other tag manager
57
-
-[/samples/feedyou/embed.html](https://github.com/wearefeedyou/feedbot-webchat/blob/master/samples/feedyou/embed.html) when you want to embed bot into given element of your page
58
-
-[/samples/feedyou/expandable.html](https://github.com/wearefeedyou/feedbot-webchat/blob/master/samples/feedyou/expandable.html) when you want to make expansion logic by yourself (note that `BotChat` component is initialized only after chat window is expanded, so bot is not triggered for users who not open chat)
59
-
-[/samples/feedyou/full.html](https://github.com/wearefeedyou/feedbot-webchat/blob/master/samples/feedyou/full.html) when webchat should be the main element on the page
60
-
-[/samples/feedyou/persistent.html](https://github.com/wearefeedyou/feedbot-webchat/blob/master/samples/feedyou/persistent.html) special configuration which allows to persist bot history between page reloads (by disabling WebSocket and using HTTP pooling instead)
61
-
58
+
59
+
-[/samples/feedyou/code.html](https://github.com/wearefeedyou/feedbot-webchat/blob/master/samples/feedyou/code.html) show the most simple way how to inject webchat into your page which you can also use with GTM or some other tag manager
60
+
-[/samples/feedyou/embed.html](https://github.com/wearefeedyou/feedbot-webchat/blob/master/samples/feedyou/embed.html) when you want to embed bot into given element of your page
61
+
-[/samples/feedyou/expandable.html](https://github.com/wearefeedyou/feedbot-webchat/blob/master/samples/feedyou/expandable.html) when you want to make expansion logic by yourself (note that `BotChat` component is initialized only after chat window is expanded, so bot is not triggered for users who not open chat)
62
+
-[/samples/feedyou/full.html](https://github.com/wearefeedyou/feedbot-webchat/blob/master/samples/feedyou/full.html) when webchat should be the main element on the page
63
+
-[/samples/feedyou/persistent.html](https://github.com/wearefeedyou/feedbot-webchat/blob/master/samples/feedyou/persistent.html) special configuration which allows to persist bot history between page reloads (by disabling WebSocket and using HTTP pooling instead)
64
+
62
65
#### Advanced configuration
66
+
63
67
You can use following optional settings during `BotChat.App` call:
64
68
65
69
```javascript
@@ -77,7 +81,8 @@ directLine: {
77
81
webSocket?: boolean =true
78
82
},
79
83
theme?: {
80
-
mainColor?: string
84
+
mainColor?: string,
85
+
enableScreenshotUpload?: boolean
81
86
},
82
87
header?: {
83
88
text?: string,
@@ -86,12 +91,13 @@ header?: {
86
91
introDialog?: {
87
92
id?: string // overrides default bot dialog which is started when user opens webchat
88
93
},
89
-
locale?:'cs'|'en'|'sk'|'sr'|'hu'='cs',
94
+
locale?:'cs'|'en'|'sk'|'sr'|'hu'='cs',
90
95
userData?: object, // allows to preset some data we already know about user (email, phone, etc.)
91
96
startOverTrigger?: (trigger: () =>void) =>void, // can be used to binding onclick event on element which can be used to restart conversation
92
97
onConversationStarted?: (callback: (conversationId:string) =>void) =>void, // can be used to store conversationId for new conversations (useful for history persistence)
93
98
disableInputWhenNotNeeded?: boolean =false, // disables input after messages with `inputHint==='ignoringInput`
94
99
autoExpandTimeout?: number =null// auto expand in milliseconds (only in case when no element specified as second argument of BotChat.App())
100
+
openUrlTarget?:'new'|'same'|'same-domain'// allows to change target of opening URLs from bot
95
101
```
96
102
97
103
<!---
@@ -106,11 +112,23 @@ autoExpandTimeout?: number = null // auto expand in milliseconds (only in case w
106
112
-->
107
113
108
114
### URL parameters
115
+
109
116
WebChat looks for following parameters in the URL when implemented on any page:
110
-
*`#feedbot-test-mode` sets `testMode: true` into the `userData` object enables test mode in the chatbot for given user
111
-
*`#feedbot-intro-dialog` overrides default bot dialog which is started when user opens webchat and also value set by `introDialog.id` in the webchat settings
117
+
118
+
-`#feedbot-test-mode` sets `testMode: true` into the `userData` object enables test mode in the chatbot for given user
119
+
-`#feedbot-intro-dialog` overrides default bot dialog which is started when user opens webchat and also value set by `introDialog.id` in the webchat settings
120
+
121
+
### Window events
122
+
123
+
WebChat is listening for following custom events on global `window` object:
124
+
125
+
-`feedbot:trigger-dialog` starts selected dialog specified in `dialog` property of `CustomEvent` (for example `window.dispatchEvent(new CustomEvent('feedbot:trigger-dialog', { detail: 'package-status' }))`)
126
+
-`feedbot:start-over` restarts conversation, which is the same behavior as `startOverTrigger` callback in config above (for example `window.dispatchEvent(new CustomEvent('feedbot:start-over'))`)
127
+
128
+
If support of Internet Explorer is required, please provide use [fallback](https://gomakethings.com/custom-events-in-internet-explorer-with-vanilla-js/) to support custom event creation there.
112
129
113
130
### Advanced customization
131
+
114
132
If you want to use WebChat directly as the component in your React app or you just want to customize it more than described above, check out the [advanced README](https://github.com/wearefeedyou/feedbot-webchat/blob/master/README-ADVANCED.md) or contact [Feedyou](mailto:[email protected]) directly.
115
133
116
134
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
0 commit comments