wingbot 3.67.24 → 3.67.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/OrchestratorClient.js +127 -0
- package/plugins/ai.wingbot.clearMessageSequences/README.md +0 -1
- package/plugins/ai.wingbot.conditionIfGoBackPossible/README.md +0 -7
- package/plugins/ai.wingbot.disambiguation/README.md +0 -12
- package/plugins/ai.wingbot.goBack/README.md +0 -9
- package/plugins/ai.wingbot.goToLastBreadcrumb/README.md +0 -8
- package/plugins/ai.wingbot.ifImageDetected/README.md +0 -10
- package/plugins/ai.wingbot.ifStickerDetected/README.md +0 -10
- package/plugins/ai.wingbot.jumpBack/README.md +0 -9
- package/plugins/ai.wingbot.jumpTo/README.md +0 -9
- package/plugins/ai.wingbot.keepInInteraction/README.md +0 -12
- package/plugins/ai.wingbot.keepInInteractionJustOnce/README.md +0 -13
- package/plugins/ai.wingbot.keepPreviousHandlers/README.md +0 -17
- package/plugins/ai.wingbot.keepPreviousHandlersJustOnce/README.md +0 -15
- package/plugins/ai.wingbot.oneTimeNotificationRequest/README.md +0 -5
- package/plugins/ai.wingbot.openai/README.md +0 -1
- package/plugins/ai.wingbot.passThreadToBot/README.md +0 -19
- package/plugins/ai.wingbot.putABreadcrumb/README.md +0 -8
- package/plugins/ai.wingbot.regexp/README.md +0 -1
- package/plugins/ai.wingbot.setState/README.md +0 -1
- package/plugins/ai.wingbot.setStateFromInput/README.md +0 -1
- package/plugins/ai.wingbot.stopResponding/README.md +0 -7
- package/plugins/ai.wingbot.trackingEvent/README.md +0 -3
- package/plugins/ai.wingbot.waitASecond/README.md +0 -5
package/package.json
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
const { withParams } = require('webalize');
|
|
7
7
|
const { default: fetch, Headers } = require('node-fetch');
|
|
8
8
|
const BotAppSender = require('./BotAppSender');
|
|
9
|
+
const extractText = require('./transcript/extractText');
|
|
10
|
+
|
|
11
|
+
/** @typedef {import('./transcript/transcriptFromHistory').Transcript} Transcript */
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* @typedef OrchestratorClientOptions
|
|
@@ -60,7 +63,131 @@ class OrchestratorClient {
|
|
|
60
63
|
expirationInSeconds,
|
|
61
64
|
conversationToken
|
|
62
65
|
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @returns {Promise<Transcript[]>}
|
|
70
|
+
*/
|
|
71
|
+
async getTranscript () {
|
|
72
|
+
const events = await this.getChatHistory();
|
|
73
|
+
|
|
74
|
+
return events
|
|
75
|
+
.map((e) => {
|
|
76
|
+
const text = extractText(e);
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
fromBot: e.sender
|
|
80
|
+
? e.sender.id !== this._senderId
|
|
81
|
+
: e.recipient.id === this._senderId,
|
|
82
|
+
text
|
|
83
|
+
};
|
|
84
|
+
})
|
|
85
|
+
.filter((ret) => !!ret.text);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
*
|
|
90
|
+
* @returns {Promise<object[]>}
|
|
91
|
+
*/
|
|
92
|
+
async getChatHistory () {
|
|
93
|
+
const res = await this._send({
|
|
94
|
+
query: `query FetchHistory (
|
|
95
|
+
$pageId: String!
|
|
96
|
+
$senderId: String!
|
|
97
|
+
) {
|
|
98
|
+
chat {
|
|
99
|
+
history (
|
|
100
|
+
pageId: $pageId,
|
|
101
|
+
senderId: $senderId
|
|
102
|
+
) {
|
|
103
|
+
events {
|
|
104
|
+
sender {
|
|
105
|
+
id
|
|
106
|
+
}
|
|
107
|
+
recipient {
|
|
108
|
+
id
|
|
109
|
+
}
|
|
110
|
+
mid
|
|
111
|
+
timestamp
|
|
112
|
+
sender_action
|
|
113
|
+
set_context
|
|
114
|
+
postback {
|
|
115
|
+
payload
|
|
116
|
+
title
|
|
117
|
+
}
|
|
118
|
+
expected {
|
|
119
|
+
input {
|
|
120
|
+
type
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
persona {
|
|
124
|
+
name
|
|
125
|
+
profile_pic_url
|
|
126
|
+
}
|
|
127
|
+
message {
|
|
128
|
+
text
|
|
129
|
+
is_confident
|
|
130
|
+
attachments {
|
|
131
|
+
type
|
|
132
|
+
payload {
|
|
133
|
+
url
|
|
134
|
+
template_type
|
|
135
|
+
image_aspect_ratio
|
|
136
|
+
text
|
|
137
|
+
buttons {
|
|
138
|
+
type
|
|
139
|
+
title
|
|
140
|
+
payload
|
|
141
|
+
url
|
|
142
|
+
}
|
|
143
|
+
elements {
|
|
144
|
+
default_action {
|
|
145
|
+
type
|
|
146
|
+
title
|
|
147
|
+
payload
|
|
148
|
+
url
|
|
149
|
+
}
|
|
150
|
+
title
|
|
151
|
+
subtitle
|
|
152
|
+
image_url
|
|
153
|
+
buttons {
|
|
154
|
+
type
|
|
155
|
+
title
|
|
156
|
+
payload
|
|
157
|
+
url
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
quick_replies {
|
|
163
|
+
content_type
|
|
164
|
+
title
|
|
165
|
+
payload
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
nextStartAt
|
|
170
|
+
nextEndAt
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}`,
|
|
174
|
+
variables: {
|
|
175
|
+
senderId: this._senderId,
|
|
176
|
+
pageId: this._pageId
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
if (res.errors && res.errors[0]) {
|
|
181
|
+
throw new Error(res.errors[0].message);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const events = (res.data
|
|
185
|
+
&& res.data
|
|
186
|
+
&& res.data.chat
|
|
187
|
+
&& res.data.chat.history
|
|
188
|
+
&& res.data.chat.history.events) || [];
|
|
63
189
|
|
|
190
|
+
return events;
|
|
64
191
|
}
|
|
65
192
|
|
|
66
193
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
> This plugin erases state of conversational sequences
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
> This plugin helps you to hide "back" quick reply, when there is no interaction to go.
|
|
2
|
-
|
|
3
|
-
Put it as a condition to quick reply and it will be only visible, when there is an interaction to go back to.
|
|
4
|
-
|
|
5
|
-
Use it in combination with the **Go back to previous interaction** plugin.
|
|
6
|
-
|
|
7
|
-

|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
> Disambiguation is useful, when the bot has lot of very similar intents. When more than one intent is detected, users can decide, what was their intention.
|
|
2
|
-
|
|
3
|
-
How to set up the disambiguation.
|
|
4
|
-
|
|
5
|
-
1. Put this plugin into a fallback
|
|
6
|
-
2. Set up the disambiguation message (disambiguation options will be added to the message as quick replies)
|
|
7
|
-
3. Put a regular "fallback" message behind this plugin. If the disambiguation will not occur, your bot will answer with this fallback message
|
|
8
|
-
4. Add a disambiguation title to all interactions, which you want to disambiguate
|
|
9
|
-
|
|
10
|
-
To fine tune the disambiguation, you can also set up a custom `ai.threshold` on bot (there is `0.3` by default). Detected intent has to reach this minimum score, to be disambiguated.
|
|
11
|
-
|
|
12
|
-

|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
> This plugin helps you to drive user back to previous interaction.
|
|
2
|
-
|
|
3
|
-
If the previous interaction exists and it's not a fallback or the same interaction, where the plugin is, the bot will go back and stops executing this interaction.
|
|
4
|
-
|
|
5
|
-
If not, the bot will continue in execution of this interaction, so you can handle situation.
|
|
6
|
-
|
|
7
|
-
It's useful to it use **Show when there is a way back** condition, so you don't have to worry about handling the situation, when there's no way to go back.
|
|
8
|
-
|
|
9
|
-

|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
> Breadcrumbs allows you to track some particular flow and make user able to return to previous steps in the flow.
|
|
2
|
-
|
|
3
|
-
This is a example of using breadcrubms:
|
|
4
|
-
|
|
5
|
-
1. Put breadcrumbs at checkpoints - interaction, where each step begins
|
|
6
|
-
2. Allow user to get back to the previous step using a **Go to last breadcrumb** plugin.
|
|
7
|
-
|
|
8
|
-

|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
> This plugin helps you to react, when user randomly sends an image attachment to your bot.
|
|
2
|
-
|
|
3
|
-
How to set up this plugin:
|
|
4
|
-
|
|
5
|
-
1. create a new interaction in **Root dialogue** and place it before a first fallback
|
|
6
|
-
2. Put the plugin on top position in this interaction
|
|
7
|
-
3. Make the interaction to intercept all messages - the star icon should appear at it's top right corner
|
|
8
|
-
4. Insert your reactions under the plugin
|
|
9
|
-
|
|
10
|
-

|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
> This plugin helps you to react, when user randomly sends a sticker to your bot from Facebook Messenger.
|
|
2
|
-
|
|
3
|
-
How to set up this plugin:
|
|
4
|
-
|
|
5
|
-
1. create a new interaction in **Root dialogue** and place it before a first fallback
|
|
6
|
-
2. Put the plugin on top position in this interaction
|
|
7
|
-
3. Make the interaction to intercept all messages - the star icon should appear at it's top right corner
|
|
8
|
-
4. Insert your reactions under the plugin
|
|
9
|
-
|
|
10
|
-

|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
> This plugin helps you to drive user back to previous interaction.
|
|
2
|
-
|
|
3
|
-
If the previous interaction exists and it's not a fallback or the same interaction, where the plugin is, the bot will go back and stops executing this interaction.
|
|
4
|
-
|
|
5
|
-
If not, the bot will continue in execution of this interaction, so you can handle situation.
|
|
6
|
-
|
|
7
|
-
It's useful to it use **Show when there is a way back** condition, so you don't have to worry about handling the situation, when there's no way to go back.
|
|
8
|
-
|
|
9
|
-

|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
> This plugin helps you to drive user back to previous interaction.
|
|
2
|
-
|
|
3
|
-
If the previous interaction exists and it's not a fallback or the same interaction, where the plugin is, the bot will go back and stops executing this interaction.
|
|
4
|
-
|
|
5
|
-
If not, the bot will continue in execution of this interaction, so you can handle situation.
|
|
6
|
-
|
|
7
|
-
It's useful to it use **Show when there is a way back** condition, so you don't have to worry about handling the situation, when there's no way to go back.
|
|
8
|
-
|
|
9
|
-

|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
> Use this snippet for keeping fallback of this interaction (where the snippet is used). So the context stays in this interaction.
|
|
2
|
-
|
|
3
|
-
**Most used example: Get answer from users**
|
|
4
|
-
- At the interaction fallback to keep users at the interaction. Bot can give help to users and keep them in interaction.
|
|
5
|
-
|
|
6
|
-
**About the snippet:**
|
|
7
|
-
- The snippet is applied whenever the user gets to this point of conversation.
|
|
8
|
-
- Should be used in the fallback of the interaction to keep the interaction's context.
|
|
9
|
-
|
|
10
|
-
Check out the [tutorial here](http://docs.wingbot.ai/context/AnswerTheQuestion/AnswerTheQuestion.html).
|
|
11
|
-
|
|
12
|
-

|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
> Use this snippet for keeping fallback of this interaction (where the snippet is used). So the context stays in this interaction.
|
|
2
|
-
|
|
3
|
-
**Most used example: Get answer from users**
|
|
4
|
-
- At the interaction fallback to keep users at the interaction. Bot can give help to users and keep them in interaction.
|
|
5
|
-
|
|
6
|
-
**About the snippet:**
|
|
7
|
-
- The snippet is applied whenever the user gets to this point of conversation.
|
|
8
|
-
- Should be used in the fallback of the interaction to keep the interaction's context.
|
|
9
|
-
- This is done just once.
|
|
10
|
-
|
|
11
|
-
Check out the [tutorial here](http://docs.wingbot.ai/context/AnswerTheQuestion/AnswerTheQuestion.html).
|
|
12
|
-
|
|
13
|
-

|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
> Lock users in interaction, until they reply as you wish.
|
|
2
|
-
|
|
3
|
-
**Most used example: Get answer from users with the same options of answers**
|
|
4
|
-
- At the interaction fallback to keep users at the interaction. Bot can give help to users and keep them in interaction.
|
|
5
|
-
- This snippet keeps previous NLP handlers.
|
|
6
|
-
> This snippet is very similar to previous snippet Keep user in this interaction (use it as a fallback)]. The difference is you don't need to set NLP handlers.
|
|
7
|
-
|
|
8
|
-
**About the snippet:**
|
|
9
|
-
- Keeps previous NLP handlers and fallback.
|
|
10
|
-
- Where to use:
|
|
11
|
-
- At the dialogue or global fallbacks - keep NLP handlers and fallback from previous interactions.
|
|
12
|
-
- At the interaction fallback - keep NLP handlers and fallback from this interaction (they are used again)
|
|
13
|
-
- The snippet is applied whenever the user gets to this point of conversation.
|
|
14
|
-
|
|
15
|
-
**Take a look how to use this snippet:** [here](http://docs.wingbot.ai/context/AnswerTheQuestion/AnswerTheQuestion.html)
|
|
16
|
-
|
|
17
|
-

|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
> Give users a chance to correct their answers (at least just once)
|
|
2
|
-
|
|
3
|
-
**Most used example: Give user chance to correct answer in fallback**
|
|
4
|
-
- At the dialogue or global fallback to keep the context of previous interaction just once. So the users can correct their reaction to chatbot's utterance.
|
|
5
|
-
|
|
6
|
-
**About the snippet:**
|
|
7
|
-
- The snippet keeps previous NLP handlers and fallback.
|
|
8
|
-
- Where to use:
|
|
9
|
-
- At the dialogue or global fallbacks - keep NLP handlers and fallback from a previous interaction.
|
|
10
|
-
- At the interaction fallback - keep NLP handlers and fallback from this interaction (they are used again).
|
|
11
|
-
- This is done just once.
|
|
12
|
-
|
|
13
|
-
**Take a look how to use this snippet:** [here](http://docs.wingbot.ai/context/ChanceToCorrectAnswer/ChanceToCorrectAnswer.html)
|
|
14
|
-
|
|
15
|
-

|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
> To be able to use Facebook's one-time notification, user has to make opt-in using a one-time notification request.
|
|
2
|
-
|
|
3
|
-
More here, [at Facebook Messenger Docs](https://developers.facebook.com/docs/messenger-platform/send-messages/one-time-notification/)
|
|
4
|
-
|
|
5
|
-

|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
> This plugin allows you to use chatGPT
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
> One of base pillars of masterbot architecture
|
|
2
|
-
|
|
3
|
-
## Passing thread to another bot
|
|
4
|
-
|
|
5
|
-
The action is determined by metadata JSON string.
|
|
6
|
-
|
|
7
|
-
1. **Pass thread with text (leave action and intent fields empty)**
|
|
8
|
-
|
|
9
|
-
Let the target bot's NLP to decide.
|
|
10
|
-
|
|
11
|
-
2. **Pass thread to specific action**
|
|
12
|
-
|
|
13
|
-
Target bot will response with a predefined interaction
|
|
14
|
-
|
|
15
|
-
3. **Trigger a specific intent at a target bot**
|
|
16
|
-
|
|
17
|
-
Intent will be enforced at target bot
|
|
18
|
-
|
|
19
|
-

|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
> Breadcrumbs allows you to track some particular flow and make user able to return to previous steps in the flow.
|
|
2
|
-
|
|
3
|
-
This is a example of using breadcrubms:
|
|
4
|
-
|
|
5
|
-
1. Put breadcrumbs at checkpoints - interaction, where each step begins
|
|
6
|
-
2. Allow user to get back to the previous step using a **Go to last breadcrumb** plugin.
|
|
7
|
-
|
|
8
|
-

|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
> This plugin detects reqular expressions
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
> This plugin has been replaced with native UI.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
> This plugin has been replaced with native UI.
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
> This plugin allows bot to just **send no response**
|
|
2
|
-
|
|
3
|
-
This is useful, when you want to override the default behavior of wingbot - because **when there is no response message in an interaction, users request will fall into a fallback.
|
|
4
|
-
|
|
5
|
-
Following example shows, how to use this plugin to keep following users response without reaction. Second users attempt will be processed as usual.
|
|
6
|
-
|
|
7
|
-

|