@tiledesk/tiledesk-whatsapp-connector 0.1.49 → 0.1.50

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/index.js CHANGED
@@ -126,7 +126,7 @@ router.post('/install', async (req, res) => {
126
126
  winston.debug("(wab) installation response: ", installation);
127
127
 
128
128
  res.redirect(url.format({
129
- pathname: "/detail",
129
+ pathname: BASE_URL + "/detail",
130
130
  query: {
131
131
  "project_id": project_id,
132
132
  "app_id": app_id,
@@ -154,7 +154,7 @@ router.post('/uninstall', async (req, res) => {
154
154
  winston.debug("(wab) uninstallation response: ", response);
155
155
 
156
156
  res.redirect(url.format({
157
- pathname: "/detail",
157
+ pathname: BASE_URL + "/detail",
158
158
  query: {
159
159
  "project_id": project_id,
160
160
  "app_id": app_id,
@@ -477,7 +477,7 @@ router.post('/tiledesk/broadcast', async (req, res) => {
477
477
  let settings = await db.get(CONTENT_KEY);
478
478
 
479
479
  if (!settings) {
480
- return res.status(400).send({ success: false, error: "WhatsApp is not installed for the project_id: " + project_id});
480
+ return res.status(400).send({ success: false, error: "WhatsApp is not installed for the project_id: " + project_id });
481
481
  }
482
482
 
483
483
  let receiver_list = req.body.receiver_list;
@@ -487,7 +487,7 @@ router.post('/tiledesk/broadcast', async (req, res) => {
487
487
  console.log("phone_number_id: ", phone_number_id);
488
488
 
489
489
  if (!tiledeskChannelMessage.attributes.attachment.template) {
490
- return res.status(400).send({ success: false, error: "Message must contain a template."})
490
+ return res.status(400).send({ success: false, error: "Message must contain a template." })
491
491
  }
492
492
 
493
493
  const tlr = new TiledeskWhatsappTranslator();
@@ -514,32 +514,32 @@ router.post('/tiledesk/broadcast', async (req, res) => {
514
514
 
515
515
  await twClient.sendMessage(phone_number_id, whatsappJsonMessage).then((response) => {
516
516
  winston.verbose("(wab) Message sent to WhatsApp! " + response.status + " " + response.statusText);
517
- messages_sent += 1;
517
+ messages_sent += 1;
518
518
  i += 1;
519
519
  if (i < receiver_list.length) {
520
520
  execute(receiver_list[i])
521
521
  } else {
522
- return res.status(200).send({ success: true, message: "Broadcast terminated", messages_sent: messages_sent, errors: errors});
522
+ return res.status(200).send({ success: true, message: "Broadcast terminated", messages_sent: messages_sent, errors: errors });
523
523
  winston.debug("(wab) End of list")
524
524
  }
525
525
  }).catch((err) => {
526
526
  winston.error("(wab) error send message: " + err.response.data.error.message);
527
- errors.push({receiver: whatsapp_receiver.phone_number,error: err.response.data.error.message});
527
+ errors.push({ receiver: whatsapp_receiver.phone_number, error: err.response.data.error.message });
528
528
  i += 1;
529
529
  if (i < receiver_list.length) {
530
530
  execute(receiver_list[i])
531
531
  } else {
532
532
  winston.debug("(wab) End of list")
533
533
  console.log("errors: ", JSON.stringify(errors, null, 2))
534
- return res.status(200).send({ success: true, message: "Broadcast terminated", messages_sent: messages_sent, errors: errors});
534
+ return res.status(200).send({ success: true, message: "Broadcast terminated", messages_sent: messages_sent, errors: errors });
535
535
  }
536
536
  })
537
537
  }
538
538
  execute(receiver_list[0]);
539
539
  }
540
540
 
541
-
542
-
541
+
542
+
543
543
  })
544
544
 
545
545
  router.post('/tiledesk', async (req, res) => {
@@ -1059,9 +1059,9 @@ router.get("/ext/templates/:project_id", async (req, res) => {
1059
1059
  } else {
1060
1060
  res.status(500).send({ success: false, code: '02', message: "A problem occurred while getting templates from WhatsApp" })
1061
1061
  }
1062
-
1062
+
1063
1063
  } else {
1064
- res.status(500).send({ success: false, code: '03', message: "Missing parameter 'WhatsApp Business Account ID'. Please update your app."})
1064
+ res.status(500).send({ success: false, code: '03', message: "Missing parameter 'WhatsApp Business Account ID'. Please update your app." })
1065
1065
  }
1066
1066
 
1067
1067
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-whatsapp-connector",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "description": "Tiledesk Whatsapp connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -215,36 +215,35 @@
215
215
 
216
216
  <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
217
217
  <div>
218
- <p style="margin-bottom: 0px">Added support for WhatsApp voice messages</p>
219
- <p style="margin-bottom: 0px">Bug fixes and minor improvements</p>
218
+ <p style="margin-bottom: 0px">Bug fixes</p>
220
219
  <!--<p>Bug fixes and performance improvements</p>-->
221
220
  </div>
222
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.49</b></p>
221
+ <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.50</b></p>
223
222
  </div>
224
223
 
225
224
  <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
226
225
  <div>
227
- <p style="margin-bottom: 0px">Added support for WhatsApp templates</p>
226
+ <p style="margin-bottom: 0px">Added support for WhatsApp voice messages</p>
227
+ <p style="margin-bottom: 0px">Bug fixes and minor improvements</p>
228
228
  <!--<p>Bug fixes and performance improvements</p>-->
229
229
  </div>
230
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.48</b></p>
230
+ <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.49</b></p>
231
231
  </div>
232
232
 
233
233
  <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
234
234
  <div>
235
- <p style="margin-bottom: 0px">Bug fixes and minor improvements</p>
235
+ <p style="margin-bottom: 0px">Added support for WhatsApp templates</p>
236
236
  <!--<p>Bug fixes and performance improvements</p>-->
237
237
  </div>
238
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.45</b></p>
238
+ <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.48</b></p>
239
239
  </div>
240
240
 
241
241
  <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
242
242
  <div>
243
- <p style="margin-bottom: 0px">Added possibility to select a department for Whatsapp conversations.</p>
244
243
  <p style="margin-bottom: 0px">Bug fixes and minor improvements</p>
245
244
  <!--<p>Bug fixes and performance improvements</p>-->
246
245
  </div>
247
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.34</b></p>
246
+ <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.45</b></p>
248
247
  </div>
249
248
 
250
249
  <hr style="margin-top: 50px; margin-bottom: 20px">