@tiledesk/tiledesk-tybot-connector 0.2.131-rc3 → 0.2.131-rc4
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/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +0 -2
- package/tiledeskChatbotPlugs/directives/DirAddTags.js +9 -3
- package/tiledeskChatbotPlugs/directives/DirAssignFromFunction.js +9 -1
- package/tiledeskChatbotPlugs/directives/DirAssistant.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +1 -28
- package/tiledeskChatbotPlugs/directives/DirClearTranscript.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirClose.js +11 -1
- package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +11 -2
- package/tiledeskChatbotPlugs/directives/DirDeflectToHelpCenter.js +11 -1
- package/tiledeskChatbotPlugs/directives/DirDepartment.js +11 -2
- package/tiledeskChatbotPlugs/directives/DirFireTiledeskEvent.js +16 -5
- package/tiledeskChatbotPlugs/directives/DirForm.js +12 -2
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +12 -1
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +10 -1
- package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirIfOpenHours_OLD.js +12 -2
- package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +11 -1
- package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +10 -1
- package/tiledeskChatbotPlugs/directives/DirRandomReply.js +11 -1
- package/tiledeskChatbotPlugs/directives/DirRemoveCurrentBot.js +18 -7
- package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +10 -1
- package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +10 -1
- package/tiledeskChatbotPlugs/directives/DirReply.js +11 -1
- package/tiledeskChatbotPlugs/directives/DirReplyV2.js +11 -1
- package/tiledeskChatbotPlugs/directives/DirSendEmail.js +10 -1
- package/tiledeskChatbotPlugs/directives/DirSetConversationTags.js +10 -1
- package/tiledeskChatbotPlugs/directives/DirWait.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirWebRequest.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +0 -1
- /package/tiledeskChatbotPlugs/directives/{DirOfflineHours.js → DEPRECATED_DirOfflineHours.js} +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const { TiledeskChatbotUtil } = require('@tiledesk/tiledesk-chatbot-util');
|
|
2
2
|
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
3
3
|
const { DirDeflectToHelpCenter } = require('./directives/DirDeflectToHelpCenter');
|
|
4
|
-
// const { DirOfflineHours } = require('./directives/DirOfflineHours'); // DEPRECATED
|
|
5
4
|
const { DirMoveToAgent } = require('./directives/DirMoveToAgent');
|
|
6
5
|
const { DirMessage } = require('./directives/DirMessage');
|
|
7
6
|
const { DirWait } = require('./directives/DirWait');
|
|
@@ -163,7 +162,6 @@ class DirectivesChatbotPlug {
|
|
|
163
162
|
TILEBOT_ENDPOINT: TILEBOT_ENDPOINT,
|
|
164
163
|
departmentId: depId,
|
|
165
164
|
tdcache: tdcache,
|
|
166
|
-
tdclient: tdclient,
|
|
167
165
|
HELP_CENTER_API_ENDPOINT: this.HELP_CENTER_API_ENDPOINT,
|
|
168
166
|
log: this.log
|
|
169
167
|
}
|
|
@@ -8,6 +8,7 @@ const { TiledeskChatbotUtil } = require("../../models/TiledeskChatbotUtil");
|
|
|
8
8
|
const req = require("express/lib/request");
|
|
9
9
|
const { rejects } = require("assert");
|
|
10
10
|
const { update } = require("../../models/faq");
|
|
11
|
+
const { TiledeskClient } = require("@tiledesk/tiledesk-client");
|
|
11
12
|
require('dotenv').config();
|
|
12
13
|
|
|
13
14
|
class DirAddTags {
|
|
@@ -20,11 +21,16 @@ class DirAddTags {
|
|
|
20
21
|
this.chatbot = this.context.chatbot;
|
|
21
22
|
this.tdcache = this.context.tdcache;
|
|
22
23
|
this.requestId = this.context.requestId;
|
|
23
|
-
this.tdClient = this.context.tdclient;
|
|
24
24
|
this.API_ENDPOINT = this.context.API_ENDPOINT;
|
|
25
|
-
// this.intentDir = new DirIntent(context);
|
|
26
25
|
this.log = context.log;
|
|
27
|
-
|
|
26
|
+
|
|
27
|
+
this.tdClient = new TiledeskClient({
|
|
28
|
+
projectId: this.context.projectId,
|
|
29
|
+
token: this.context.token,
|
|
30
|
+
APIURL: this.API_ENDPOINT,
|
|
31
|
+
APIKEY: "___",
|
|
32
|
+
log: this.log
|
|
33
|
+
});
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
execute(directive, callback) {
|
|
@@ -9,9 +9,17 @@ class DirAssignFromFunction {
|
|
|
9
9
|
throw new Error('context object is mandatory.');
|
|
10
10
|
}
|
|
11
11
|
this.context = context;
|
|
12
|
-
this.tdclient = context.tdclient;
|
|
13
12
|
this.log = context.log;
|
|
14
13
|
this.tdcache = context.tdcache;
|
|
14
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
15
|
+
|
|
16
|
+
this.tdClient = new TiledeskClient({
|
|
17
|
+
projectId: this.context.projectId,
|
|
18
|
+
token: this.context.token,
|
|
19
|
+
APIURL: this.API_ENDPOINT,
|
|
20
|
+
APIKEY: "___",
|
|
21
|
+
log: this.log
|
|
22
|
+
});
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
async execute(directive, callback) {
|
|
@@ -7,37 +7,10 @@ class DirCaptureUserReply {
|
|
|
7
7
|
if (!context) {
|
|
8
8
|
throw new Error('context object is mandatory.');
|
|
9
9
|
}
|
|
10
|
+
|
|
10
11
|
this.context = context;
|
|
11
12
|
this.reply = context.reply;
|
|
12
|
-
// reply = {
|
|
13
|
-
// actions: [
|
|
14
|
-
// {
|
|
15
|
-
// _tdActionType: 'askgpt',
|
|
16
|
-
// _tdActionTitle: 'gpt action',
|
|
17
|
-
// assignReplyTo: 'gpt_reply',
|
|
18
|
-
// assignSourceTo: 'gpt_source',
|
|
19
|
-
// kbid: 'XXX',
|
|
20
|
-
// trueIntent: '#SUCCESS',
|
|
21
|
-
// falseIntent: '#FAILURE',
|
|
22
|
-
// question: 'this is the question: ${last_user_message}'
|
|
23
|
-
// }
|
|
24
|
-
// ],
|
|
25
|
-
// attributes: {
|
|
26
|
-
// clienttimestamp: 1695548792706,
|
|
27
|
-
// intent_info: {
|
|
28
|
-
// intent_name: 'gpt success',
|
|
29
|
-
// intent_id: '00f93b97-89ee-466d-a09c-e47a18943057',
|
|
30
|
-
// is_fallback: false,
|
|
31
|
-
// confidence: undefined,
|
|
32
|
-
// question_payload: [Object],
|
|
33
|
-
// botId: 'botID',
|
|
34
|
-
// bot: [Object]
|
|
35
|
-
// },
|
|
36
|
-
// webhook: false
|
|
37
|
-
// }
|
|
38
|
-
// }
|
|
39
13
|
this.message = context.message;
|
|
40
|
-
this.tdclient = context.tdclient;
|
|
41
14
|
this.chatbot = context.chatbot;
|
|
42
15
|
this.tdcache = context.tdcache;
|
|
43
16
|
this.requestId = context.requestId;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
|
|
2
|
+
const { TiledeskClient } = require("@tiledesk/tiledesk-client");
|
|
2
3
|
const { TiledeskChatbotConst } = require("../../models/TiledeskChatbotConst");
|
|
3
4
|
|
|
4
5
|
class DirClose {
|
|
@@ -8,9 +9,18 @@ class DirClose {
|
|
|
8
9
|
throw new Error('context object is mandatory.');
|
|
9
10
|
}
|
|
10
11
|
this.context = context;
|
|
11
|
-
this.tdclient = context.tdclient;
|
|
12
12
|
this.requestId = context.requestId;
|
|
13
13
|
this.chatbot = context.chatbot;
|
|
14
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
15
|
+
this.log = context.log;
|
|
16
|
+
|
|
17
|
+
this.tdClient = new TiledeskClient({
|
|
18
|
+
projectId: this.context.projectId,
|
|
19
|
+
token: this.context.token,
|
|
20
|
+
APIURL: this.API_ENDPOINT,
|
|
21
|
+
APIKEY: "___",
|
|
22
|
+
log: this.log
|
|
23
|
+
});
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
execute(directive, callback) {
|
|
@@ -3,6 +3,7 @@ const { TiledeskChatbot } = require('../../models/TiledeskChatbot');
|
|
|
3
3
|
const { TiledeskChatbotUtil } = require('../../models/TiledeskChatbotUtil');
|
|
4
4
|
let axios = require('axios');
|
|
5
5
|
const { TiledeskChatbotConst } = require('../../models/TiledeskChatbotConst');
|
|
6
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
6
7
|
|
|
7
8
|
class DirContactUpdate {
|
|
8
9
|
|
|
@@ -16,8 +17,16 @@ class DirContactUpdate {
|
|
|
16
17
|
this.supportRequest = context.supportRequest;
|
|
17
18
|
this.token = context.token;
|
|
18
19
|
this.tdcache = context.tdcache;
|
|
19
|
-
this.
|
|
20
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
20
21
|
this.log = context.log;
|
|
22
|
+
|
|
23
|
+
this.tdClient = new TiledeskClient({
|
|
24
|
+
projectId: this.context.projectId,
|
|
25
|
+
token: this.context.token,
|
|
26
|
+
APIURL: this.API_ENDPOINT,
|
|
27
|
+
APIKEY: "___",
|
|
28
|
+
log: this.log
|
|
29
|
+
});
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
execute(directive, callback) {
|
|
@@ -91,7 +100,7 @@ class DirContactUpdate {
|
|
|
91
100
|
// }
|
|
92
101
|
// };
|
|
93
102
|
// if (this.log) {console.log("(DirContactUpdate) sending updateLeadDataOnWidgetMessage:", updateLeadDataOnWidgetMessage); }
|
|
94
|
-
// this.
|
|
103
|
+
// this.tdclient.sendSupportMessage(
|
|
95
104
|
// this.requestId,
|
|
96
105
|
// updateLeadDataOnWidgetMessage,
|
|
97
106
|
// (err) => {
|
|
@@ -2,6 +2,7 @@ const { HelpCenterQuery } = require('@tiledesk/helpcenter-query-client');
|
|
|
2
2
|
const { TiledeskChatbot } = require('../../models/TiledeskChatbot.js');
|
|
3
3
|
const { TiledeskChatbotConst } = require('../../models/TiledeskChatbotConst');
|
|
4
4
|
const ms = require('minimist-string');
|
|
5
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
5
6
|
|
|
6
7
|
class DirDeflectToHelpCenter {
|
|
7
8
|
|
|
@@ -10,7 +11,16 @@ class DirDeflectToHelpCenter {
|
|
|
10
11
|
throw new Error('context object is mandatory.');
|
|
11
12
|
}
|
|
12
13
|
this.context = context;
|
|
14
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
13
15
|
this.log = context.log;
|
|
16
|
+
|
|
17
|
+
this.tdClient = new TiledeskClient({
|
|
18
|
+
projectId: this.context.projectId,
|
|
19
|
+
token: this.context.token,
|
|
20
|
+
APIURL: this.API_ENDPOINT,
|
|
21
|
+
APIKEY: "___",
|
|
22
|
+
log: this.log
|
|
23
|
+
});
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
async execute(directive, callback) {
|
|
@@ -132,7 +142,7 @@ class DirDeflectToHelpCenter {
|
|
|
132
142
|
}
|
|
133
143
|
|
|
134
144
|
if (this.log) {console.log("HC reply:", JSON.stringify(message))};
|
|
135
|
-
this.
|
|
145
|
+
this.tdclient.sendSupportMessage(
|
|
136
146
|
this.context.requestId,
|
|
137
147
|
message,
|
|
138
148
|
(err) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { TiledeskClient } = require("@tiledesk/tiledesk-client");
|
|
1
2
|
|
|
2
3
|
class DirDepartment {
|
|
3
4
|
|
|
@@ -6,9 +7,17 @@ class DirDepartment {
|
|
|
6
7
|
throw new Error('context object is mandatory.');
|
|
7
8
|
}
|
|
8
9
|
this.context = context;
|
|
9
|
-
this.log = context.log;
|
|
10
|
-
this.tdclient = context.tdclient;
|
|
11
10
|
this.requestId = context.requestId;
|
|
11
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
12
|
+
this.log = context.log;
|
|
13
|
+
|
|
14
|
+
this.tdClient = new TiledeskClient({
|
|
15
|
+
projectId: this.context.projectId,
|
|
16
|
+
token: this.context.token,
|
|
17
|
+
APIURL: this.API_ENDPOINT,
|
|
18
|
+
APIKEY: "___",
|
|
19
|
+
log: this.log
|
|
20
|
+
});
|
|
12
21
|
}
|
|
13
22
|
|
|
14
23
|
execute(directive, callback) {
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
1
2
|
const ms = require('minimist-string');
|
|
2
3
|
|
|
3
4
|
class DirFireTiledeskEvent {
|
|
4
5
|
|
|
5
|
-
constructor(
|
|
6
|
-
if (!
|
|
7
|
-
throw new Error('
|
|
6
|
+
constructor(context) {
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error('context object is mandatory.');
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
this.
|
|
10
|
+
|
|
11
|
+
this.context = context;
|
|
12
|
+
this.log = context.log;
|
|
13
|
+
|
|
14
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
15
|
+
this.tdClient = new TiledeskClient({
|
|
16
|
+
projectId: this.context.projectId,
|
|
17
|
+
token: this.context.token,
|
|
18
|
+
APIURL: this.API_ENDPOINT,
|
|
19
|
+
APIKEY: "___",
|
|
20
|
+
log: this.log
|
|
21
|
+
});
|
|
11
22
|
}
|
|
12
23
|
|
|
13
24
|
execute(directive, callback) {
|
|
@@ -2,6 +2,7 @@ const { Filler } = require('../Filler');
|
|
|
2
2
|
const { TiledeskChatbot } = require('../../models/TiledeskChatbot');
|
|
3
3
|
const { DirIntent } = require('./DirIntent');
|
|
4
4
|
const { IntentForm } = require('../../models/IntentForm.js');
|
|
5
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
5
6
|
|
|
6
7
|
class DirForm {
|
|
7
8
|
constructor(context) {
|
|
@@ -9,12 +10,21 @@ class DirForm {
|
|
|
9
10
|
throw new Error('context object is mandatory.');
|
|
10
11
|
}
|
|
11
12
|
this.context = context;
|
|
12
|
-
this.tdclient = context.tdclient;
|
|
13
13
|
this.chatbot = context.chatbot;
|
|
14
14
|
this.tdcache = context.tdcache;
|
|
15
15
|
this.requestId = context.requestId;
|
|
16
16
|
this.intentDir = new DirIntent(context);
|
|
17
17
|
this.log = context.log;
|
|
18
|
+
|
|
19
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
20
|
+
this.tdClient = new TiledeskClient({
|
|
21
|
+
projectId: this.context.projectId,
|
|
22
|
+
token: this.context.token,
|
|
23
|
+
APIURL: this.API_ENDPOINT,
|
|
24
|
+
APIKEY: "___",
|
|
25
|
+
log: this.log
|
|
26
|
+
});
|
|
27
|
+
|
|
18
28
|
}
|
|
19
29
|
|
|
20
30
|
execute(directive, callback) {
|
|
@@ -83,7 +93,7 @@ class DirForm {
|
|
|
83
93
|
form_reply.message.attributes.markbot = true;
|
|
84
94
|
// return form_reply.message;
|
|
85
95
|
|
|
86
|
-
this.
|
|
96
|
+
this.tdclient.sendSupportMessage(
|
|
87
97
|
this.requestId,
|
|
88
98
|
form_reply.message,
|
|
89
99
|
(err) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
2
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
2
3
|
const { DirIntent } = require('./DirIntent');
|
|
3
4
|
const ms = require('minimist-string');
|
|
4
5
|
|
|
@@ -8,9 +9,19 @@ class DirIfOnlineAgents {
|
|
|
8
9
|
if (!context) {
|
|
9
10
|
throw new Error('context object is mandatory.');
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
this.context = context;
|
|
12
14
|
this.intentDir = new DirIntent(context);
|
|
15
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
13
16
|
this.log = context.log;
|
|
17
|
+
|
|
18
|
+
this.tdClient = new TiledeskClient({
|
|
19
|
+
projectId: this.context.projectId,
|
|
20
|
+
token: this.context.token,
|
|
21
|
+
APIURL: this.API_ENDPOINT,
|
|
22
|
+
APIKEY: "___",
|
|
23
|
+
log: this.log
|
|
24
|
+
});
|
|
14
25
|
}
|
|
15
26
|
|
|
16
27
|
execute(directive, callback) {
|
|
@@ -4,6 +4,7 @@ const { DirIntent } = require('./DirIntent');
|
|
|
4
4
|
const axios = require("axios").default;
|
|
5
5
|
let https = require("https");
|
|
6
6
|
const { TiledeskChatbot } = require('../../models/TiledeskChatbot');
|
|
7
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
7
8
|
|
|
8
9
|
class DirIfOnlineAgentsV2 {
|
|
9
10
|
|
|
@@ -13,10 +14,18 @@ class DirIfOnlineAgentsV2 {
|
|
|
13
14
|
}
|
|
14
15
|
this.context = context;
|
|
15
16
|
this.chatbot = context.chatbot;
|
|
16
|
-
this.tdclient = context.tdclient;
|
|
17
17
|
this.intentDir = new DirIntent(context);
|
|
18
18
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
19
19
|
this.log = context.log;
|
|
20
|
+
|
|
21
|
+
this.tdClient = new TiledeskClient({
|
|
22
|
+
projectId: this.context.projectId,
|
|
23
|
+
token: this.context.token,
|
|
24
|
+
APIURL: this.API_ENDPOINT,
|
|
25
|
+
APIKEY: "___",
|
|
26
|
+
log: this.log
|
|
27
|
+
});
|
|
28
|
+
|
|
20
29
|
}
|
|
21
30
|
|
|
22
31
|
execute(directive, callback) {
|
|
@@ -10,10 +10,11 @@ class DirIfOpenHours {
|
|
|
10
10
|
if (!context) {
|
|
11
11
|
throw new Error('context object is mandatory.');
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
this.context = context;
|
|
15
15
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
16
16
|
this.intentDir = new DirIntent(context);
|
|
17
|
+
this.log = context.log;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
execute(directive, callback) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
2
2
|
const { DirIntent } = require('./DirIntent');
|
|
3
3
|
const ms = require('minimist-string');
|
|
4
4
|
|
|
@@ -8,9 +8,19 @@ class DirIfOpenHours {
|
|
|
8
8
|
if (!context) {
|
|
9
9
|
throw new Error('context object is mandatory.');
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
this.context = context;
|
|
12
13
|
this.intentDir = new DirIntent(context);
|
|
13
14
|
this.log = context.log;
|
|
15
|
+
|
|
16
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
17
|
+
this.tdClient = new TiledeskClient({
|
|
18
|
+
projectId: this.context.projectId,
|
|
19
|
+
token: this.context.token,
|
|
20
|
+
APIURL: this.API_ENDPOINT,
|
|
21
|
+
APIKEY: "___",
|
|
22
|
+
log: this.log
|
|
23
|
+
});
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
execute(directive, callback) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const { Directives } = require('./Directives');
|
|
3
3
|
const { TiledeskChatbot } = require('../../models/TiledeskChatbot');
|
|
4
4
|
const { TiledeskChatbotConst } = require('../../models/TiledeskChatbotConst');
|
|
5
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
5
6
|
|
|
6
7
|
class DirMoveToAgent {
|
|
7
8
|
|
|
@@ -10,10 +11,19 @@ class DirMoveToAgent {
|
|
|
10
11
|
throw new Error('context object is mandatory.');
|
|
11
12
|
}
|
|
12
13
|
this.context = context;
|
|
13
|
-
this.tdclient = context.tdclient;
|
|
14
14
|
this.tdcache = context.tdcache;
|
|
15
15
|
this.requestId = context.requestId;
|
|
16
16
|
this.log = context.log;
|
|
17
|
+
|
|
18
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
19
|
+
this.tdClient = new TiledeskClient({
|
|
20
|
+
projectId: this.context.projectId,
|
|
21
|
+
token: this.context.token,
|
|
22
|
+
APIURL: this.API_ENDPOINT,
|
|
23
|
+
APIKEY: "___",
|
|
24
|
+
log: this.log
|
|
25
|
+
});
|
|
26
|
+
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
execute(directive, callback) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const { Directives } = require('./Directives');
|
|
3
3
|
const { TiledeskChatbot } = require('../../models/TiledeskChatbot');
|
|
4
4
|
const { TiledeskChatbotConst } = require('../../models/TiledeskChatbotConst');
|
|
5
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
5
6
|
|
|
6
7
|
class DirMoveToUnassigned {
|
|
7
8
|
|
|
@@ -10,9 +11,17 @@ class DirMoveToUnassigned {
|
|
|
10
11
|
throw new Error('context object is mandatory.');
|
|
11
12
|
}
|
|
12
13
|
this.context = context;
|
|
13
|
-
this.tdclient = context.tdclient;
|
|
14
14
|
this.requestId = context.requestId;
|
|
15
15
|
this.log = context.log;
|
|
16
|
+
|
|
17
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
18
|
+
this.tdClient = new TiledeskClient({
|
|
19
|
+
projectId: this.context.projectId,
|
|
20
|
+
token: this.context.token,
|
|
21
|
+
APIURL: this.API_ENDPOINT,
|
|
22
|
+
APIKEY: "___",
|
|
23
|
+
log: this.log
|
|
24
|
+
});
|
|
16
25
|
}
|
|
17
26
|
|
|
18
27
|
execute(directive, callback) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { Filler } = require('../Filler');
|
|
2
2
|
const { TiledeskChatbot } = require('../../models/TiledeskChatbot');
|
|
3
3
|
const { TiledeskChatbotUtil } = require('../../models/TiledeskChatbotUtil');
|
|
4
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
4
5
|
|
|
5
6
|
class DirRandomReply {
|
|
6
7
|
|
|
@@ -14,6 +15,15 @@ class DirRandomReply {
|
|
|
14
15
|
this.token = context.token;
|
|
15
16
|
this.tdcache = context.tdcache;
|
|
16
17
|
this.log = context.log;
|
|
18
|
+
|
|
19
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
20
|
+
this.tdClient = new TiledeskClient({
|
|
21
|
+
projectId: this.context.projectId,
|
|
22
|
+
token: this.context.token,
|
|
23
|
+
APIURL: this.API_ENDPOINT,
|
|
24
|
+
APIKEY: "___",
|
|
25
|
+
log: this.log
|
|
26
|
+
});
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
execute(directive, callback) {
|
|
@@ -87,7 +97,7 @@ class DirRandomReply {
|
|
|
87
97
|
}
|
|
88
98
|
// send!
|
|
89
99
|
if (this.log) {console.log("Reply:", JSON.stringify(message))};
|
|
90
|
-
this.
|
|
100
|
+
this.tdclient.sendSupportMessage(
|
|
91
101
|
this.requestId,
|
|
92
102
|
message,
|
|
93
103
|
(err) => {
|
|
@@ -1,16 +1,27 @@
|
|
|
1
|
+
const { TiledeskClient } = require("@tiledesk/tiledesk-client");
|
|
1
2
|
|
|
2
3
|
class DirRemoveCurrentBot {
|
|
3
4
|
|
|
4
|
-
constructor(
|
|
5
|
-
if (!
|
|
6
|
-
throw new Error('
|
|
5
|
+
constructor(context) {
|
|
6
|
+
if (!context) {
|
|
7
|
+
throw new Error('context object is mandatory.');
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
this.
|
|
9
|
+
|
|
10
|
+
this.context = context;
|
|
11
|
+
this.tdclient = context.tdclient;
|
|
12
|
+
this.requestId = context.requestId;
|
|
13
|
+
|
|
14
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
15
|
+
this.tdClient = new TiledeskClient({
|
|
16
|
+
projectId: this.context.projectId,
|
|
17
|
+
token: this.context.token,
|
|
18
|
+
APIURL: this.API_ENDPOINT,
|
|
19
|
+
APIKEY: "___",
|
|
20
|
+
log: this.log
|
|
21
|
+
});
|
|
10
22
|
}
|
|
11
23
|
|
|
12
24
|
execute(directive, callback) {
|
|
13
|
-
console.log("Remove current bot");
|
|
14
25
|
let action;
|
|
15
26
|
if (directive.action) {
|
|
16
27
|
action = directive.action;
|
|
@@ -27,7 +38,7 @@ class DirRemoveCurrentBot {
|
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
go(action, callback) {
|
|
30
|
-
tdclient.removeCurrentBot(this.requestId, (err) => {
|
|
41
|
+
this.tdclient.removeCurrentBot(this.requestId, (err) => {
|
|
31
42
|
callback();
|
|
32
43
|
});
|
|
33
44
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
1
2
|
const { TiledeskChatbot } = require('../../models/TiledeskChatbot');
|
|
2
3
|
const { Filler } = require('../Filler');
|
|
3
4
|
|
|
@@ -8,9 +9,17 @@ class DirReplaceBot {
|
|
|
8
9
|
throw new Error('context object is mandatory.');
|
|
9
10
|
}
|
|
10
11
|
this.context = context;
|
|
11
|
-
this.tdclient = context.tdclient;
|
|
12
12
|
this.requestId = context.requestId;
|
|
13
13
|
this.log = context.log;
|
|
14
|
+
|
|
15
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
16
|
+
this.tdClient = new TiledeskClient({
|
|
17
|
+
projectId: this.context.projectId,
|
|
18
|
+
token: this.context.token,
|
|
19
|
+
APIURL: this.API_ENDPOINT,
|
|
20
|
+
APIKEY: "___",
|
|
21
|
+
log: this.log
|
|
22
|
+
});
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
execute(directive, callback) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
1
2
|
const { TiledeskChatbot } = require('../../models/TiledeskChatbot');
|
|
2
3
|
const { Filler } = require('../Filler');
|
|
3
4
|
|
|
@@ -8,9 +9,17 @@ class DirReplaceBotV2 {
|
|
|
8
9
|
throw new Error('context object is mandatory.');
|
|
9
10
|
}
|
|
10
11
|
this.context = context;
|
|
11
|
-
this.tdclient = context.tdclient;
|
|
12
12
|
this.requestId = context.requestId;
|
|
13
13
|
this.log = context.log;
|
|
14
|
+
|
|
15
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
16
|
+
this.tdClient = new TiledeskClient({
|
|
17
|
+
projectId: this.context.projectId,
|
|
18
|
+
token: this.context.token,
|
|
19
|
+
APIURL: this.API_ENDPOINT,
|
|
20
|
+
APIKEY: "___",
|
|
21
|
+
log: this.log
|
|
22
|
+
});
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
execute(directive, callback) {
|
|
@@ -2,6 +2,7 @@ const { Filler } = require('../Filler');
|
|
|
2
2
|
const { TiledeskChatbot } = require('../../models/TiledeskChatbot');
|
|
3
3
|
const { TiledeskChatbotUtil } = require('../../models/TiledeskChatbotUtil');
|
|
4
4
|
let axios = require('axios');
|
|
5
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
5
6
|
|
|
6
7
|
class DirReply {
|
|
7
8
|
|
|
@@ -15,6 +16,15 @@ class DirReply {
|
|
|
15
16
|
this.token = context.token;
|
|
16
17
|
this.tdcache = context.tdcache;
|
|
17
18
|
this.log = context.log;
|
|
19
|
+
|
|
20
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
21
|
+
this.tdClient = new TiledeskClient({
|
|
22
|
+
projectId: this.context.projectId,
|
|
23
|
+
token: this.context.token,
|
|
24
|
+
APIURL: this.API_ENDPOINT,
|
|
25
|
+
APIKEY: "___",
|
|
26
|
+
log: this.log
|
|
27
|
+
});
|
|
18
28
|
}
|
|
19
29
|
|
|
20
30
|
execute(directive, callback) {
|
|
@@ -130,7 +140,7 @@ class DirReply {
|
|
|
130
140
|
if (this.log) {console.log("Reply:", JSON.stringify(cleanMessage))};
|
|
131
141
|
await TiledeskChatbotUtil.updateConversationTranscript(this.context.chatbot, cleanMessage);
|
|
132
142
|
// console.log("sending message!", cleanMessage);
|
|
133
|
-
this.
|
|
143
|
+
this.tdclient.sendSupportMessage(
|
|
134
144
|
this.requestId,
|
|
135
145
|
cleanMessage,
|
|
136
146
|
(err) => {
|
|
@@ -6,6 +6,7 @@ const { DirIntent } = require("./DirIntent");
|
|
|
6
6
|
// const { defaultOptions } = require('liquidjs');
|
|
7
7
|
const { DirMessageToBot } = require('./DirMessageToBot');
|
|
8
8
|
const { v4: uuidv4 } = require('uuid');
|
|
9
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
9
10
|
|
|
10
11
|
class DirReplyV2 {
|
|
11
12
|
|
|
@@ -23,6 +24,15 @@ class DirReplyV2 {
|
|
|
23
24
|
this.chatbot = context.chatbot;
|
|
24
25
|
this.reply = context.reply;
|
|
25
26
|
this.originalMessage = context.message;
|
|
27
|
+
|
|
28
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
29
|
+
this.tdClient = new TiledeskClient({
|
|
30
|
+
projectId: this.context.projectId,
|
|
31
|
+
token: this.context.token,
|
|
32
|
+
APIURL: this.API_ENDPOINT,
|
|
33
|
+
APIKEY: "___",
|
|
34
|
+
log: this.log
|
|
35
|
+
});
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
execute(directive, callback) {
|
|
@@ -263,7 +273,7 @@ class DirReplyV2 {
|
|
|
263
273
|
cleanMessage.senderFullname = this.context.chatbot.bot.name;
|
|
264
274
|
if (this.log) {console.log("Reply:", JSON.stringify(cleanMessage))};
|
|
265
275
|
await TiledeskChatbotUtil.updateConversationTranscript(this.context.chatbot, cleanMessage);
|
|
266
|
-
this.
|
|
276
|
+
this.tdclient.sendSupportMessage(
|
|
267
277
|
this.requestId,
|
|
268
278
|
cleanMessage,
|
|
269
279
|
(err) => {
|
|
@@ -2,6 +2,7 @@ const { param } = require('express/lib/request');
|
|
|
2
2
|
const ms = require('minimist-string');
|
|
3
3
|
const { TiledeskChatbot } = require('../../models/TiledeskChatbot');
|
|
4
4
|
const { Filler } = require('../Filler');
|
|
5
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
5
6
|
// const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
6
7
|
|
|
7
8
|
class DirSendEmail {
|
|
@@ -11,10 +12,18 @@ class DirSendEmail {
|
|
|
11
12
|
throw new Error('context object is mandatory.');
|
|
12
13
|
}
|
|
13
14
|
this.context = context;
|
|
14
|
-
this.tdclient = context.tdclient;
|
|
15
15
|
this.tdcache = context.tdcache;
|
|
16
16
|
this.requestId = context.requestId;
|
|
17
17
|
this.log = context.log;
|
|
18
|
+
|
|
19
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
20
|
+
this.tdClient = new TiledeskClient({
|
|
21
|
+
projectId: this.context.projectId,
|
|
22
|
+
token: this.context.token,
|
|
23
|
+
APIURL: this.API_ENDPOINT,
|
|
24
|
+
APIKEY: "___",
|
|
25
|
+
log: this.log
|
|
26
|
+
});
|
|
18
27
|
}
|
|
19
28
|
|
|
20
29
|
execute(directive, callback) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
1
2
|
const { Filler } = require('../Filler');
|
|
2
3
|
|
|
3
4
|
class DirSetConversationTags {
|
|
@@ -8,8 +9,16 @@ class DirSetConversationTags {
|
|
|
8
9
|
}
|
|
9
10
|
this.context = context;
|
|
10
11
|
this.log = context.log;
|
|
11
|
-
this.tdclient = context.tdclient;
|
|
12
12
|
this.requestId = context.requestId;
|
|
13
|
+
|
|
14
|
+
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
15
|
+
this.tdClient = new TiledeskClient({
|
|
16
|
+
projectId: this.context.projectId,
|
|
17
|
+
token: this.context.token,
|
|
18
|
+
APIURL: this.API_ENDPOINT,
|
|
19
|
+
APIKEY: "___",
|
|
20
|
+
log: this.log
|
|
21
|
+
});
|
|
13
22
|
}
|
|
14
23
|
|
|
15
24
|
execute(directive, callback) {
|
|
@@ -10,7 +10,6 @@ class DirWebRequestV2 {
|
|
|
10
10
|
throw new Error('context object is mandatory.');
|
|
11
11
|
}
|
|
12
12
|
this.context = context;
|
|
13
|
-
this.tdclient = context.tdclient;
|
|
14
13
|
this.tdcache = context.tdcache;
|
|
15
14
|
this.requestId = context.requestId;
|
|
16
15
|
this.intentDir = new DirIntent(context);
|
/package/tiledeskChatbotPlugs/directives/{DirOfflineHours.js → DEPRECATED_DirOfflineHours.js}
RENAMED
|
File without changes
|