@tiledesk/tiledesk-tybot-connector 0.2.131-rc1 → 0.2.131-rc3

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/index.js +11 -11
  3. package/models/TiledeskChatbotUtil.js +7 -4
  4. package/package.json +1 -1
  5. package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +6 -8
  6. package/tiledeskChatbotPlugs/directives/DirAddTags.js +11 -17
  7. package/tiledeskChatbotPlugs/directives/DirAskGPT.js +10 -13
  8. package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +18 -57
  9. package/tiledeskChatbotPlugs/directives/DirAssign.js +0 -11
  10. package/tiledeskChatbotPlugs/directives/DirAssignFromFunction.js +0 -18
  11. package/tiledeskChatbotPlugs/directives/DirAssistant.js +4 -4
  12. package/tiledeskChatbotPlugs/directives/DirBrevo.js +5 -8
  13. package/tiledeskChatbotPlugs/directives/DirCondition.js +0 -26
  14. package/tiledeskChatbotPlugs/directives/DirConnectBlock.js +1 -13
  15. package/tiledeskChatbotPlugs/directives/DirCustomerio.js +5 -8
  16. package/tiledeskChatbotPlugs/directives/DirGptTask.js +14 -18
  17. package/tiledeskChatbotPlugs/directives/DirGptTask_OLD.js +4 -7
  18. package/tiledeskChatbotPlugs/directives/DirHubspot.js +5 -8
  19. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +0 -24
  20. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +2 -1
  21. package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +2 -29
  22. package/tiledeskChatbotPlugs/directives/DirIfOpenHours_OLD.js +0 -24
  23. package/tiledeskChatbotPlugs/directives/DirIntent.js +1 -23
  24. package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +0 -26
  25. package/tiledeskChatbotPlugs/directives/DirMessage.js +1 -1
  26. package/tiledeskChatbotPlugs/directives/DirMessageToBot.js +1 -13
  27. package/tiledeskChatbotPlugs/directives/DirQapla.js +5 -8
  28. package/tiledeskChatbotPlugs/directives/DirSendEmail.js +1 -20
  29. package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +2 -2
  30. package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +2 -60
@@ -10,6 +10,7 @@ class DirWhatsappByAttribute {
10
10
  throw new Error('context object is mandatory');
11
11
  }
12
12
  this.context = context;
13
+ this.API_ENDPOINT = context.API_ENDPOINT;
13
14
  this.log = context.log;
14
15
  }
15
16
 
@@ -35,15 +36,12 @@ class DirWhatsappByAttribute {
35
36
  console.log("whatsapp by attributes action: ", JSON.stringify(action))
36
37
  }
37
38
 
38
- ///////////
39
-
40
39
  const whatsapp_api_url_pre = process.env.WHATSAPP_ENDPOINT;
41
- const server_base_url = process.env.API_URL || process.env.API_ENDPOINT;
42
40
 
43
41
  if (whatsapp_api_url_pre) {
44
42
  whatsapp_api_url = whatsapp_api_url_pre;
45
43
  } else {
46
- whatsapp_api_url = server_base_url + "/modules/whatsapp/api"
44
+ whatsapp_api_url = this.API_ENDPOINT + "/modules/whatsapp/api"
47
45
  }
48
46
  console.log("DirWhatsappByAttribute whatsapp_api_url: ", whatsapp_api_url);
49
47
 
@@ -94,62 +92,6 @@ class DirWhatsappByAttribute {
94
92
  }, true);
95
93
  })
96
94
 
97
-
98
- // if (process.env.API_URL) {
99
- // whatsapp_api_url = "https://tiledesk-whatsapp-connector.giovannitroisi3.repl.co/api";
100
- // // whatsapp_api_url = process.env.API_URL + "/modules/whatsapp";
101
- // console.log("(Tilebot) DirWhatsappByAttribute whatsapp_api_url: ", whatsapp_api_url);
102
- // } else {
103
- // console.error("(Tilebot) ERROR Missing whatsapp_api_url. Unable to use action WhatsApp By Attributes");
104
- // callback();
105
- // return;
106
- // }
107
- // if (action.attributeName) {
108
- // if (this.log) { console.log("whatsapp attributeName:", action.attributeName); }
109
- // let attribute_value = null;
110
- // if (this.context.tdcache) {
111
-
112
- // const attribute_value = await TiledeskChatbot.getParameterStatic(this.context.tdcache, this.context.requestId, action.attributeName)
113
- // if (this.log) { console.log("attribute_value:", JSON.stringify(attribute_value)); }
114
-
115
- // if (attribute_value == null) {
116
- // console.error("(Tilebot) attribute_value is undefined");
117
- // callback();
118
- // return;
119
- // }
120
-
121
- // const URL = whatsapp_api_url + '/tiledesk/broadcast';
122
- // const HTTPREQUEST = {
123
- // url: URL,
124
- // headers: {
125
- // 'Content-Type': 'application/json',
126
-
127
- // },
128
- // json: attribute_value,
129
- // method: 'POST'
130
- // };
131
- // let promise = new Promise((resolve, reject) => {
132
- // DirWhatsappByAttribute.myrequest(
133
- // HTTPREQUEST,
134
- // function (err, resbody) {
135
- // if (err) {
136
- // if (callback) {
137
- // callback(err);
138
- // }
139
- // reject(err);
140
- // }
141
- // else {
142
- // if (callback) {
143
- // callback(null, resbody);
144
- // }
145
- // console.log("(tybot) broadcast sent: ", resbody);
146
- // resolve(resbody);
147
- // }
148
- // }, true);
149
- // })
150
- // return promise;
151
- // }
152
- // }
153
95
  }
154
96
 
155
97
  // HTTP REQUEST