@tiledesk/tiledesk-server 2.10.86 → 2.10.88
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/CHANGELOG.md +15 -0
- package/app.js +4 -0
- package/errorCodes.js +6 -0
- package/event/botEvent.js +89 -42
- package/jobsManager.js +4 -1
- package/models/chatbotTemplates.js +22 -0
- package/models/faq.js +14 -1
- package/models/faq_kb.js +64 -2
- package/models/flowLogs.js +64 -0
- package/models/user.js +7 -0
- package/models/webhook.js +30 -0
- package/package.json +4 -4
- package/routes/auth.js +1 -1
- package/routes/faq.js +6 -0
- package/routes/faq_kb.js +123 -85
- package/routes/logs.js +80 -3
- package/routes/request.js +2 -2
- package/routes/users.js +3 -0
- package/routes/webhook.js +54 -25
- package/routes/webhooks.js +119 -2
- package/services/chatbotService.js +24 -18
- package/services/faqService.js +35 -331
- package/services/logsService.js +59 -0
- package/services/userService.js +3 -2
- package/services/webhookService.js +21 -2
- package/template/chatbot/blank.js +79 -0
- package/template/chatbot/blank_copilot.js +43 -0
- package/template/chatbot/blank_voice.js +108 -0
- package/template/chatbot/blank_voice_twilio.js +115 -0
- package/template/chatbot/blank_webhook.js +43 -0
- package/template/chatbot/empty.js +3 -0
- package/template/chatbot/example.js +88 -0
- package/template/chatbot/handoff.js +25 -0
- package/template/chatbot/index.js +12 -0
- package/template/chatbot/official_copilot.js +717 -0
- package/test/faqkbRoute.js +165 -23
- package/test/webhookRoute.js +247 -2
- package/utils/TdCache.js +3 -3
@@ -0,0 +1,108 @@
|
|
1
|
+
const uuidv4 = require('uuid/v4');
|
2
|
+
|
3
|
+
module.exports = function generateTemplate(options) {
|
4
|
+
|
5
|
+
const custom_intent_id = uuidv4();
|
6
|
+
|
7
|
+
return [
|
8
|
+
{
|
9
|
+
"webhook_enabled": false,
|
10
|
+
"enabled": true,
|
11
|
+
"actions": [{
|
12
|
+
"_tdActionType": "intent",
|
13
|
+
"intentName": "#" + custom_intent_id
|
14
|
+
}],
|
15
|
+
"question": "\\start",
|
16
|
+
"intent_display_name": "start",
|
17
|
+
"agents_available": false,
|
18
|
+
"attributes": {
|
19
|
+
"readonly": true,
|
20
|
+
"position": {
|
21
|
+
"x": 172,
|
22
|
+
"y": 384
|
23
|
+
}
|
24
|
+
}
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"webhook_enabled": false,
|
28
|
+
"enabled": true,
|
29
|
+
"actions": [{
|
30
|
+
"_tdActionType": "reply",
|
31
|
+
"text": "I didn't understand. Can you rephrase your question?",
|
32
|
+
"attributes": {
|
33
|
+
"commands": [{
|
34
|
+
"type": "wait",
|
35
|
+
"time": 500
|
36
|
+
}, {
|
37
|
+
"type": "message",
|
38
|
+
"message": {
|
39
|
+
"type": "text",
|
40
|
+
"text": "I didn't understand. Can you rephrase your question?"
|
41
|
+
}
|
42
|
+
}]
|
43
|
+
},
|
44
|
+
}],
|
45
|
+
"intent_display_name": "defaultFallback",
|
46
|
+
"attributes": {
|
47
|
+
"readonly": true,
|
48
|
+
"position": {
|
49
|
+
"x": 714,
|
50
|
+
"y": 528
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}, {
|
54
|
+
"webhook_enabled": false,
|
55
|
+
"enabled": true,
|
56
|
+
"actions": [
|
57
|
+
{
|
58
|
+
"_tdActionType": "play_prompt",
|
59
|
+
"attributes": {
|
60
|
+
"disableInputMessage": false,
|
61
|
+
"commands": [{
|
62
|
+
"type": "wait",
|
63
|
+
"time": 0
|
64
|
+
}, {
|
65
|
+
"type": "message",
|
66
|
+
"message": {
|
67
|
+
"type": "text",
|
68
|
+
"text": "Hi, how can I help you?"
|
69
|
+
}
|
70
|
+
}, {
|
71
|
+
"type": "wait",
|
72
|
+
"time": 0
|
73
|
+
}, {
|
74
|
+
"type": "settings",
|
75
|
+
"settings": {
|
76
|
+
"bargein": true
|
77
|
+
},
|
78
|
+
"subType": "play_prompt"
|
79
|
+
}]
|
80
|
+
}
|
81
|
+
}
|
82
|
+
],
|
83
|
+
"intent_display_name": "welcome",
|
84
|
+
"intent_id": custom_intent_id,
|
85
|
+
"attributes": {
|
86
|
+
"position": {
|
87
|
+
"x": 714,
|
88
|
+
"y": 113
|
89
|
+
},
|
90
|
+
}
|
91
|
+
}, {
|
92
|
+
"webhook_enabled": false,
|
93
|
+
"enabled": true,
|
94
|
+
"actions": [{
|
95
|
+
"_tdActionType": "close"
|
96
|
+
}],
|
97
|
+
"intent_display_name": "close",
|
98
|
+
"attributes": {
|
99
|
+
"readonly": true,
|
100
|
+
"color": "204,68,75",
|
101
|
+
"position": {
|
102
|
+
"x": 399,
|
103
|
+
"y": 531
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
]
|
108
|
+
}
|
@@ -0,0 +1,115 @@
|
|
1
|
+
const uuidv4 = require('uuid/v4');
|
2
|
+
|
3
|
+
module.exports = function generateTemplate(options) {
|
4
|
+
|
5
|
+
const custom_intent_id = uuidv4();
|
6
|
+
|
7
|
+
return [
|
8
|
+
{
|
9
|
+
"webhook_enabled": false,
|
10
|
+
"enabled": true,
|
11
|
+
"actions": [
|
12
|
+
{
|
13
|
+
"_tdActionType": "intent",
|
14
|
+
"intentName": "#" + custom_intent_id
|
15
|
+
}
|
16
|
+
],
|
17
|
+
"question": "\\start",
|
18
|
+
"intent_display_name": "start",
|
19
|
+
"agents_available": false,
|
20
|
+
"attributes": {
|
21
|
+
"readonly": true,
|
22
|
+
"position": {
|
23
|
+
"x": 172,
|
24
|
+
"y": 384
|
25
|
+
}
|
26
|
+
}
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"webhook_enabled": false,
|
30
|
+
"enabled": true,
|
31
|
+
"actions": [{
|
32
|
+
"_tdActionType": "reply",
|
33
|
+
"text": "I didn't understand. Can you rephrase your question?",
|
34
|
+
"attributes": {
|
35
|
+
"commands": [{
|
36
|
+
"type": "wait",
|
37
|
+
"time": 500
|
38
|
+
}, {
|
39
|
+
"type": "message",
|
40
|
+
"message": {
|
41
|
+
"type": "text",
|
42
|
+
"text": "I didn't understand. Can you rephrase your question?",
|
43
|
+
}
|
44
|
+
}]
|
45
|
+
}
|
46
|
+
}],
|
47
|
+
"intent_display_name": "defaultFallback",
|
48
|
+
"agents_available": false,
|
49
|
+
"attributes": {
|
50
|
+
"readonly": true,
|
51
|
+
"position": {
|
52
|
+
"x": 714,
|
53
|
+
"y": 528
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"webhook_enabled": false,
|
59
|
+
"enabled": true,
|
60
|
+
"actions": [
|
61
|
+
{
|
62
|
+
"_tdActionType": "play_prompt",
|
63
|
+
"attributes": {
|
64
|
+
"disableInputMessage": false,
|
65
|
+
"commands": [{
|
66
|
+
"type": "wait",
|
67
|
+
"time": 0
|
68
|
+
}, {
|
69
|
+
"type": "message",
|
70
|
+
"message": {
|
71
|
+
"type": "text",
|
72
|
+
"text": "Hi, how can I help you?",
|
73
|
+
}
|
74
|
+
}, {
|
75
|
+
"type": "wait",
|
76
|
+
"time": 0
|
77
|
+
}, {
|
78
|
+
"type": "settings",
|
79
|
+
"settings": {
|
80
|
+
"bargein": true
|
81
|
+
},
|
82
|
+
"subType": "play_prompt"
|
83
|
+
}]
|
84
|
+
}
|
85
|
+
}
|
86
|
+
],
|
87
|
+
"intent_id": custom_intent_id,
|
88
|
+
"intent_display_name": "welcome",
|
89
|
+
"agents_available": false,
|
90
|
+
"attributes": {
|
91
|
+
"position": {
|
92
|
+
"x": 714,
|
93
|
+
"y": 113
|
94
|
+
}
|
95
|
+
},
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"webhook_enabled": false,
|
99
|
+
"enabled": true,
|
100
|
+
"actions": [{
|
101
|
+
"_tdActionType": "close"
|
102
|
+
}],
|
103
|
+
"intent_display_name": "close",
|
104
|
+
"agents_available": false,
|
105
|
+
"attributes": {
|
106
|
+
"readonly": true,
|
107
|
+
"color": "204,68,75",
|
108
|
+
"position": {
|
109
|
+
"x": 399,
|
110
|
+
"y": 531
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
]
|
115
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
const uuidv4 = require('uuid/v4');
|
2
|
+
|
3
|
+
module.exports = function generateTemplate(options) {
|
4
|
+
|
5
|
+
const custom_intent_id = uuidv4();
|
6
|
+
|
7
|
+
return [
|
8
|
+
{
|
9
|
+
"webhook_enabled": false,
|
10
|
+
"enabled": true,
|
11
|
+
"actions": [{
|
12
|
+
"_tdActionType": "intent",
|
13
|
+
"intentName": "#" + custom_intent_id
|
14
|
+
}],
|
15
|
+
"question": "",
|
16
|
+
"intent_display_name": "webhook",
|
17
|
+
"attributes": {
|
18
|
+
"position": {
|
19
|
+
"x": 172,
|
20
|
+
"y": 384
|
21
|
+
}
|
22
|
+
}
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"webhook_enabled": false,
|
26
|
+
"enabled": true,
|
27
|
+
"actions": [{
|
28
|
+
"_tdActionType": "web_response",
|
29
|
+
"status": 200,
|
30
|
+
"bodyType": "json",
|
31
|
+
"payload": '{"success": true , "message": "Your webhook is online!"}'
|
32
|
+
}],
|
33
|
+
"intent_display_name": "response",
|
34
|
+
"intent_id": custom_intent_id,
|
35
|
+
"attributes": {
|
36
|
+
"position": {
|
37
|
+
"x": 714,
|
38
|
+
"y": 113
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
const ActionsConstants = require('../../models/actionsConstants');
|
2
|
+
|
3
|
+
module.exports = function generateTemplate(options) {
|
4
|
+
|
5
|
+
return [
|
6
|
+
{
|
7
|
+
'question': 'Hi',
|
8
|
+
'answer': 'Hi',
|
9
|
+
'topic': 'greetings'
|
10
|
+
},
|
11
|
+
{
|
12
|
+
'question': 'Hello',
|
13
|
+
'answer': 'Hello',
|
14
|
+
'topic': 'greetings'
|
15
|
+
},
|
16
|
+
{
|
17
|
+
'question': 'Who are you?',
|
18
|
+
'answer': 'Hi, I\'m a bot 🤖. You can find more about me [here](https://tiledesk.com/chatbot-for-customer-service).\ntdImage:https://console.tiledesk.com/assets/images/tily-welcomebot.gif\n* See the website https://tiledesk.com/\n* Back to start tdAction:start',
|
19
|
+
'topic': 'greetings'
|
20
|
+
},
|
21
|
+
{
|
22
|
+
'question': '👨🏻🦰 I want an agent',
|
23
|
+
'answer': 'We are looking for an operator.. ' + ActionsConstants.CHAT_ACTION_MESSAGE.AGENT,
|
24
|
+
'intent_display_name': 'agent_handoff',
|
25
|
+
'topic': 'internal'
|
26
|
+
},
|
27
|
+
{
|
28
|
+
'question': 'Close\nResolved',
|
29
|
+
'answer': ActionsConstants.CHAT_ACTION_MESSAGE.CLOSE,
|
30
|
+
'topic': 'internal'
|
31
|
+
},
|
32
|
+
{
|
33
|
+
'question': '\\start',
|
34
|
+
'answer': 'Hello 👋. I\'m a bot 🤖.\n\nChoose one of the options below or write a message to reach our staff.\n* Who are you?\n* Where are you?\n* What can you do?\n* 👨🏻🦰 I want an agent',
|
35
|
+
'intent_display_name': 'start',
|
36
|
+
'topic': 'internal'
|
37
|
+
},
|
38
|
+
{
|
39
|
+
'question': 'defaultFallback',
|
40
|
+
'answer': 'I can not provide an adequate answer. Write a new question or talk to a human agent.\n* Back to start tdAction:start\n* See the docs https://docs.tiledesk.com/\n* 👨🏻🦰 I want an agent',
|
41
|
+
'intent_display_name': 'defaultFallback',
|
42
|
+
'topic': 'internal'
|
43
|
+
},
|
44
|
+
{
|
45
|
+
'question': 'What can you do?',
|
46
|
+
'answer': 'Using natural language processing, I\'m able to find the best answer for your users. I also support images, videos etc.. Let\'s try:\n* Sample Image\n* Sample Video\n* Sample Action tdAction:action1\n* Sample Frame\n* Back to start tdAction:start',
|
47
|
+
'topic': 'sample'
|
48
|
+
},
|
49
|
+
{
|
50
|
+
'question': 'Sample Image',
|
51
|
+
'answer': 'tdImage:https://tiledesk.com/wp-content/uploads/2022/07/tiledesk_v2.png\n* What can you do?\n* Back to start tdAction:start',
|
52
|
+
'topic': 'sample'
|
53
|
+
},
|
54
|
+
{
|
55
|
+
'question': 'Sample Frame',
|
56
|
+
'answer': 'tdFrame:https://www.emanueleferonato.com/wp-content/uploads/2019/02/runner/\n* What can you do?\n* Back to start tdAction:start',
|
57
|
+
'topic': 'sample'
|
58
|
+
},
|
59
|
+
{
|
60
|
+
'question': 'Sample Video',
|
61
|
+
'answer': 'tdVideo:https://www.youtube.com/embed/EngW7tLk6R8\n* What can you do?\n* Back to start tdAction:start',
|
62
|
+
'topic': 'sample'
|
63
|
+
},
|
64
|
+
{
|
65
|
+
'question': 'Where are you?',
|
66
|
+
'answer': 'We are here ❤️\ntdFrame:https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6087916.923447935!2d8.234804542117423!3d41.836572992140624!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x12d4fe82448dd203%3A0xe22cf55c24635e6f!2sItaly!5e0!3m2!1sen!2sit!4v1613657475377!5m2!1sen!2sit\n* Back to start tdAction:start',
|
67
|
+
'topic': 'sample'
|
68
|
+
},
|
69
|
+
{
|
70
|
+
'question': 'Sample Action',
|
71
|
+
'answer': 'Hello 👋 Would you like to take a closer look at our offer?\n* Yes, please tdAction:yes_action\n* No tdAction:no_action',
|
72
|
+
'intent_display_name': 'action1',
|
73
|
+
'topic': 'sample'
|
74
|
+
},
|
75
|
+
{
|
76
|
+
'question': 'Yes Action',
|
77
|
+
'answer': 'Great! Take a look here:\n* Tiledesk Pricing https://tiledesk.com/pricing-cloud/',
|
78
|
+
'intent_display_name': 'yes_action',
|
79
|
+
'topic': 'sample'
|
80
|
+
},
|
81
|
+
{
|
82
|
+
'question': 'No Action',
|
83
|
+
'answer': 'All right! If you need anything, let us know.',
|
84
|
+
'intent_display_name': 'no_action',
|
85
|
+
'topic': 'sample'
|
86
|
+
}
|
87
|
+
]
|
88
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
const ActionsConstants = require('../../models/actionsConstants');
|
2
|
+
|
3
|
+
module.exports = function generateTemplate(options) {
|
4
|
+
|
5
|
+
return [
|
6
|
+
{
|
7
|
+
'question': '\\start',
|
8
|
+
'answer': 'Hello',
|
9
|
+
'intent_display_name': 'start',
|
10
|
+
'topic': 'internal'
|
11
|
+
},
|
12
|
+
{
|
13
|
+
'question': '👨🏻🦰 I want an agent',
|
14
|
+
'answer': 'We are looking for an operator.. ' + ActionsConstants.CHAT_ACTION_MESSAGE.AGENT,
|
15
|
+
'intent_display_name': 'agent_handoff',
|
16
|
+
'topic': 'internal'
|
17
|
+
},
|
18
|
+
{
|
19
|
+
'question': 'defaultFallback',
|
20
|
+
'answer': 'I can not provide an adequate answer. Write a new question or talk to a human agent.\n* Back to start tdAction:start\n* See the docs https://docs.tiledesk.com/\n* 👨🏻🦰 I want an agent',
|
21
|
+
'intent_display_name': 'defaultFallback',
|
22
|
+
'topic': 'internal'
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
|
2
|
+
module.exports = {
|
3
|
+
blank: require('./blank'),
|
4
|
+
blank_webhook: require('./blank_webhook'),
|
5
|
+
blank_copilot: require('./blank_copilot'),
|
6
|
+
official_copilot: require('./official_copilot'),
|
7
|
+
blank_voice: require('./blank_voice'),
|
8
|
+
blank_voice_twilio: require('./blank_voice_twilio'),
|
9
|
+
empty: require('./empty'),
|
10
|
+
example: require('./example'),
|
11
|
+
handoff: require('./handoff')
|
12
|
+
}
|