@tiledesk/tiledesk-tybot-connector 2.0.12-rc4 → 2.0.12-rc6
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/ExtApi.js +1 -8
- package/ExtUtil.js +5 -6
- package/engine/IntentForm.js +0 -1
- package/engine/IntentsMachineFactory.js +4 -4
- package/engine/MongodbBotsDataSource.js +0 -1
- package/engine/MongodbIntentsMachine.js +0 -1
- package/engine/TiledeskChatbot.js +11 -16
- package/engine/TiledeskIntentsMachine.js +1 -2
- package/index.js +11 -23
- package/logs/app.log +573 -0
- package/package.json +1 -1
- package/services/AIService.js +1 -1
- package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +10 -10
- package/tiledeskChatbotPlugs/FillParamsChatbotPlug.js +1 -2
- package/tiledeskChatbotPlugs/MarkbotChatbotPlug.js +1 -3
- package/tiledeskChatbotPlugs/SplitsChatbotPlug.js +1 -3
- package/tiledeskChatbotPlugs/WebhookChatbotPlug.js +7 -9
- package/tiledeskChatbotPlugs/directives/DEPRECATED_DirIfNotOpenHours.js +3 -10
- package/tiledeskChatbotPlugs/directives/DEPRECATED_DirIfOpenHours.js +2 -9
- package/tiledeskChatbotPlugs/directives/DirAddKbContent.js +333 -0
- package/tiledeskChatbotPlugs/directives/DirConnectBlock.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirDeflectToHelpCenter.js +1 -3
- package/tiledeskChatbotPlugs/directives/DirFlowLog.js +1 -1
- package/tiledeskChatbotPlugs/directives/DirGptTask_OLD.js +36 -54
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +1 -2
- package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirIfOpenHours_OLD.js +7 -9
- package/tiledeskChatbotPlugs/directives/DirIntent.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirLockIntent.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirMake.js +1 -15
- package/tiledeskChatbotPlugs/directives/DirMessage.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirMessageToBot.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirReply.js +1 -1
- package/tiledeskChatbotPlugs/directives/DirReplyV2.js +8 -10
- package/tiledeskChatbotPlugs/directives/DirSetAttribute.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +1 -3
- package/tiledeskChatbotPlugs/directives/DirSetConversationTags.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirUnlockIntent.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirWebRequest.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +1 -15
- package/tiledeskChatbotPlugs/directives/Directives.js +1 -0
- package/utils/TiledeskChatbotUtil.js +15 -29
|
@@ -252,24 +252,24 @@ class TiledeskChatbotUtil {
|
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
static fillCommandAttachments(command, variables
|
|
256
|
-
|
|
255
|
+
static fillCommandAttachments(command, variables) {
|
|
256
|
+
winston.debug("(TiledeskChatbotUtils) Filling command button: ", command)
|
|
257
257
|
if (command.message && command.message.attributes && command.message.attributes.attachment && command.message.attributes.attachment.buttons && command.message.attributes.attachment.buttons.length > 0) {
|
|
258
258
|
let buttons = command.message.attributes.attachment.buttons;
|
|
259
259
|
const filler = new Filler();
|
|
260
260
|
buttons.forEach(button => {
|
|
261
261
|
if (button.link) {
|
|
262
262
|
button.link = filler.fill(button.link, variables);
|
|
263
|
-
|
|
263
|
+
winston.debug("(TiledeskChatbotUtils) button.link filled: " + button.link)
|
|
264
264
|
}
|
|
265
265
|
if (button.value) {
|
|
266
266
|
button.value = filler.fill(button.value, variables);
|
|
267
|
-
|
|
267
|
+
winston.debug("(TiledeskChatbotUtils) button.value filled: " + button.value)
|
|
268
268
|
}
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
else {
|
|
272
|
-
|
|
272
|
+
winston.debug("(TiledeskChatbotUtils) No attachments to fill in command")
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
|
|
@@ -520,7 +520,7 @@ class TiledeskChatbotUtil {
|
|
|
520
520
|
static async updateRequestAttributes(chatbot, chatbotToken, message, projectId, requestId) {
|
|
521
521
|
// update request context
|
|
522
522
|
try {
|
|
523
|
-
|
|
523
|
+
winston.debug("Updating request variables. Message:", message);
|
|
524
524
|
const messageId = message._id;
|
|
525
525
|
const chat_url = `https://panel.tiledesk.com/v3/dashboard/#/project/${projectId}/wsrequest/${requestId}/messages`
|
|
526
526
|
|
|
@@ -591,12 +591,12 @@ class TiledeskChatbotUtil {
|
|
|
591
591
|
}
|
|
592
592
|
|
|
593
593
|
if (message && message.request && message.request.lead) {
|
|
594
|
-
|
|
594
|
+
winston.debug("(TiledeskChatbotUtil) Lead found with email: " + message.request.lead.email + " and lead.fullname " + message.request.lead.fullname);
|
|
595
595
|
let currentLeadEmail = await chatbot.getParameter(TiledeskChatbotConst.REQ_LEAD_EMAIL_KEY);
|
|
596
|
-
|
|
596
|
+
winston.debug("(TiledeskChatbotUtil) You lead email from attributes: " + currentLeadEmail);
|
|
597
597
|
if (message.request.lead.email && !currentLeadEmail) {
|
|
598
598
|
// worth saving
|
|
599
|
-
|
|
599
|
+
winston.debug("(TiledeskChatbotUtil) worth saving email");
|
|
600
600
|
try {
|
|
601
601
|
await chatbot.addParameter(TiledeskChatbotConst.REQ_LEAD_EMAIL_KEY, message.request.lead.email);
|
|
602
602
|
}
|
|
@@ -685,10 +685,10 @@ class TiledeskChatbotUtil {
|
|
|
685
685
|
message.attributes = {}
|
|
686
686
|
}
|
|
687
687
|
message.attributes.payload = { ...message.attributes.payload, ...message.request.attributes.payload }
|
|
688
|
-
|
|
688
|
+
winston.debug("(TiledeskChatbotUtil) Forced Set message.attributes.payload ", message.attributes.payload);
|
|
689
689
|
}
|
|
690
690
|
if (message.attributes) {
|
|
691
|
-
|
|
691
|
+
winston.debug("(TiledeskChatbotUtil) Ok message.attributes ", message.attributes);
|
|
692
692
|
|
|
693
693
|
await chatbot.addParameter(TiledeskChatbotConst.REQ_END_USER_ID_KEY, message.attributes.requester_id);
|
|
694
694
|
await chatbot.addParameter(TiledeskChatbotConst.REQ_END_USER_IP_ADDRESS_KEY, message.attributes.ipAddress);
|
|
@@ -722,12 +722,12 @@ class TiledeskChatbotUtil {
|
|
|
722
722
|
|
|
723
723
|
|
|
724
724
|
const _bot = chatbot.bot; // aka FaqKB
|
|
725
|
-
|
|
725
|
+
winston.debug("(TiledeskChatbotUtil) Adding Globals to context: ", _bot);
|
|
726
726
|
|
|
727
727
|
if (_bot.attributes && _bot.attributes.globals) {
|
|
728
|
-
|
|
728
|
+
winston.error("(TiledeskChatbotUtil) Got Globals: ", _bot.attributes.globals);
|
|
729
729
|
_bot.attributes.globals.forEach(async (global_var) => {
|
|
730
|
-
|
|
730
|
+
winston.error("(TiledeskChatbotUtil) Adding global: " + global_var.key + " value: " + global_var.value);
|
|
731
731
|
await chatbot.addParameter(global_var.key, global_var.value);
|
|
732
732
|
});
|
|
733
733
|
}
|
|
@@ -740,20 +740,6 @@ class TiledeskChatbotUtil {
|
|
|
740
740
|
// }
|
|
741
741
|
// );
|
|
742
742
|
|
|
743
|
-
if (chatbot.log) {
|
|
744
|
-
if (chatbot.log) { winston.debug("(TiledeskChatbotUtil) requestId: " + requestId); }
|
|
745
|
-
if (chatbot.log) { winston.debug("(TiledeskChatbotUtil) Key: " + TiledeskChatbotConst.REQ_PROJECT_ID_KEY); }
|
|
746
|
-
|
|
747
|
-
let proj_ = await chatbot.getParameter(TiledeskChatbotConst.REQ_PROJECT_ID_KEY);
|
|
748
|
-
if (chatbot.log) { winston.debug("(TiledeskChatbotUtil) request parameter proj_: " + proj_); }
|
|
749
|
-
|
|
750
|
-
const all_parameters = await chatbot.allParameters();
|
|
751
|
-
for (const [key, value] of Object.entries(all_parameters)) {
|
|
752
|
-
const value_type = typeof value;
|
|
753
|
-
if (chatbot.log) { winston.debug("(TiledeskChatbotUtil) Request Attribute: " + key + " value: " + value + " type: " + value_type); }
|
|
754
|
-
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
743
|
} catch(error) {
|
|
758
744
|
winston.error("(TiledeskChatbotUtil) updateRequestAttributes Error: ", error);
|
|
759
745
|
process.exit(1)
|
|
@@ -793,7 +779,7 @@ class TiledeskChatbotUtil {
|
|
|
793
779
|
}
|
|
794
780
|
} else if (requestId.startsWith("automation-request-")) {
|
|
795
781
|
const parts = requestId.split("-");
|
|
796
|
-
if (parts.length === 4) {
|
|
782
|
+
if (parts.length === 4 || parts.length === 5) {
|
|
797
783
|
isValid = (parts[0] === "automation" && parts[1] === "request" && parts[2] === projectId && parts[3].length > 0);
|
|
798
784
|
}
|
|
799
785
|
else {
|