Skip to content

Commit

Permalink
# 1.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele Panico committed Jan 28, 2025
1 parent f22cd5d commit e574658
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Tiledesk native chatbot

# 1.0.13
- bug-fixed: message.attributes.payload is not populated on first message
- bug-fixed: message.attributes.payload was overwritten by message.request.attributes.payload

# 1.0.12
- changed: repo links

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tiledesk/tiledesk-chatbot",
"version": "1.0.12",
"version": "1.0.13",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
20 changes: 10 additions & 10 deletions tybotRoute/models/TiledeskChatbotUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,15 @@ class TiledeskChatbotUtil {
await chatbot.addParameter(TiledeskChatbotConst.REQ_DEPARTMENT_ID_KEY, message.attributes.departmentId);
await chatbot.addParameter(TiledeskChatbotConst.REQ_DEPARTMENT_NAME_KEY, message.attributes.departmentName);
}

if (message && message.request && message.request.attributes && message.request.attributes.payload) {
if (!message.attributes) {
message.attributes = {}
}
message.attributes.payload = { ...message.attributes.payload, ...message.request.attributes.payload}
if (chatbot.log) {console.log("FORCED SET message.attributes.payload:", JSON.stringify(message.attributes.payload))}
// if (projectId === "641864da99c1fb00131ba495") {console.log("641864da99c1fb00131ba495 > FORCED SET message.attributes.payload:", JSON.stringify(message.attributes.payload))}
}
if (message.attributes) {
if (chatbot.log) {console.log("Ok message.attributes", JSON.stringify(message.attributes));}
// if (projectId === "641864da99c1fb00131ba495") {console.log("641864da99c1fb00131ba495 > Ok message.attributes", JSON.stringify(message.attributes));}
Expand Down Expand Up @@ -734,15 +743,7 @@ class TiledeskChatbotUtil {
}
}

/** DEPRECATED */
if (message && message.request && message.request.attributes && message.request.attributes.payload) {
if (!message.attributes) {
message.attributes = {}
}
message.attributes.payload = message.request.attributes.payload
if (chatbot.log) {console.log("FORCED SET message.attributes.payload:", JSON.stringify(message.attributes.payload))}
// if (projectId === "641864da99c1fb00131ba495") {console.log("641864da99c1fb00131ba495 > FORCED SET message.attributes.payload:", JSON.stringify(message.attributes.payload))}
}



const _bot = chatbot.bot; // aka FaqKB
Expand Down Expand Up @@ -919,7 +920,6 @@ class TiledeskChatbotUtil {
}

/**
* DEPRECATED
* A stub to get the request parameters, hosted by tilebot on:
* /${TILEBOT_ROUTE}/ext/parameters/requests/${requestId}?all
*
Expand Down

0 comments on commit e574658

Please sign in to comment.