@tiledesk/tiledesk-whatsapp-connector 0.1.65 → 0.1.67

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
@@ -66,6 +66,7 @@ let REDIS_PASSWORD = null;
66
66
  let BASE_FILE_URL = null;
67
67
  let AMQP_MANAGER_URL = null;
68
68
  let JOB_TOPIC_EXCHANGE = null;
69
+ let BRAND_NAME = null;
69
70
 
70
71
  // Handlebars register helpers
71
72
  handlebars.registerHelper("isEqual", (a, b) => {
@@ -249,6 +250,7 @@ router.get("/configure", async (req, res) => {
249
250
  subscription_id: settings.subscriptionId,
250
251
  department_id: settings.department_id,
251
252
  departments: departments,
253
+ brand_name: BRAND_NAME
252
254
  };
253
255
  var html = template(replacements);
254
256
  res.send(html);
@@ -267,6 +269,7 @@ router.get("/configure", async (req, res) => {
267
269
  proxy_url: proxy_url,
268
270
  departments: departments,
269
271
  popup_view: popup_view,
272
+ brand_name: BRAND_NAME
270
273
  };
271
274
  var html = template(replacements);
272
275
  res.send(html);
@@ -319,6 +322,7 @@ router.post("/update", async (req, res) => {
319
322
  subscription_id: settings.subscriptionId,
320
323
  department_id: settings.department_id,
321
324
  departments: departments,
325
+ brand_name: BRAND_NAME
322
326
  };
323
327
  var html = template(replacements);
324
328
  res.send(html);
@@ -378,6 +382,7 @@ router.post("/update", async (req, res) => {
378
382
  subscription_id: settings.subscriptionId,
379
383
  department_id: settings.department_id,
380
384
  departments: departments,
385
+ brand_name: BRAND_NAME
381
386
  };
382
387
  var html = template(replacements);
383
388
  res.send(html);
@@ -393,6 +398,7 @@ router.post("/update", async (req, res) => {
393
398
  proxy_url: proxy_url,
394
399
  departments: departments,
395
400
  show_error_modal: true,
401
+ brand_name: BRAND_NAME
396
402
  };
397
403
  var html = template(replacements);
398
404
  res.send(html);
@@ -444,6 +450,7 @@ router.post("/disconnect", async (req, res) => {
444
450
  token: token,
445
451
  proxy_url: proxy_url,
446
452
  departments: departments,
453
+ brand_name: BRAND_NAME
447
454
  };
448
455
  var html = template(replacements);
449
456
  res.send(html);
@@ -1616,22 +1623,42 @@ async function startApp(settings, callback) {
1616
1623
  JOB_TOPIC_EXCHANGE = settings.JOB_TOPIC_EXCHANGE;
1617
1624
  winston.info("(wab) JOB_TOPIC_EXCHANGE is present");
1618
1625
  }
1619
-
1620
- // For test only
1621
- if (settings.LOG_MONGODB_URL) {
1622
- /**
1623
- * Connect with a different Database
1624
- */
1625
- // mongoose
1626
- // .connect(settings.LOG_MONGODB_URL)
1627
- // .then(() => {
1628
- // winston.info("Mongoose DB Connected");
1629
- // })
1630
- // .catch((err) => {
1631
- // winston.error("(Mongoose) Unable to connect with MongoDB ", err);
1632
- // });
1626
+
1627
+ if (settings.BRAND_NAME) {
1628
+ BRAND_NAME = settings.BRAND_NAME
1629
+ }
1630
+
1631
+ // // For test only
1632
+ // if (settings.LOG_MONGODB_URL) {
1633
+ // /**
1634
+ // * Connect with a different Database
1635
+ // */
1636
+ // mongoose
1637
+ // .connect(settings.LOG_MONGODB_URL)
1638
+ // .then(() => {
1639
+ // winston.info("Mongoose DB Connected");
1640
+ // })
1641
+ // .catch((err) => {
1642
+ // winston.error("(Mongoose) Unable to connect with MongoDB ", err);
1643
+ // });
1644
+ // }
1645
+
1646
+ let LOG_MONGODB_URL;
1647
+ if (!settings.LOG_MONGODB_URL) {
1648
+ LOG_MONGODB_URL = settings.MONGODB_URL;
1649
+ } else {
1650
+ LOG_MONGODB_URL = settings.LOG_MONGODB_URL;
1633
1651
  }
1634
1652
 
1653
+ mongoose
1654
+ .connect(LOG_MONGODB_URL)
1655
+ .then(() => {
1656
+ winston.info("Mongoose DB Connected");
1657
+ })
1658
+ .catch((err) => {
1659
+ winston.error("(Mongoose) Unable to connect with MongoDB ", err);
1660
+ });
1661
+
1635
1662
  if (settings.dbconnection) {
1636
1663
  db.reuseConnection(settings.dbconnection, () => {
1637
1664
  winston.info("(wab) KVBaseMongo reused exsisting db connection");
package/logs/app.log CHANGED
@@ -566,3 +566,40 @@ info: (wab api) AMQP_MANAGER_URL is present
566
566
  info: (wab api) JOB_TOPIC_EXCHANGE is present
567
567
  info: (wab) Redis ready!
568
568
  info: (wab) KVBaseMongo successfully connected.
569
+ debug: KV_COLLECTION: kvstore
570
+ info: (wab) Starting Whatsapp App
571
+ info: (wab) API_URL: https://tiledesk-server-pre.herokuapp.com
572
+ info: (wab) BASE_FILE_URL: https://tiledesk-server-pre.herokuapp.com
573
+ info: (wab) BASE_URL: https://tiledesk-whatsapp-connector-dev.glitch.me
574
+ info: (wab) GRAPH_URL: https://graph.facebook.com/v14.0/
575
+ info: (wab) APPS_API_URL: https://tiledesk-apps.herokuapp.com
576
+ info: (wab) AMQP_MANAGER_URL is present
577
+ info: (wab) JOB_TOPIC_EXCHANGE is present
578
+ info: (wab api) Starting api route
579
+ info: (wab api) GRAPH_URL: https://graph.facebook.com/v14.0/
580
+ info: (wab api) API_URL: https://tiledesk-server-pre.herokuapp.com
581
+ info: (wab api) BASE_FILE_URL: https://tiledesk-server-pre.herokuapp.com
582
+ info: (wab api) AMQP_MANAGER_URL is present
583
+ info: (wab api) JOB_TOPIC_EXCHANGE is present
584
+ info: (wab) Redis ready!
585
+ info: (wab) KVBaseMongo successfully connected.
586
+ verbose: (wab) Action received from Tiledesk (Broadcast)
587
+ debug: Body (broadcast):
588
+ debug: Searching on [object Object]
589
+ debug: Searching on Collection kvstore
590
+ verbose: Doc found with key: whatsapp-62c3f10152dc7400352bab0d
591
+ debug: (wab) data_To_scheduler: {"phone_number_id":"109639215462567","project_id":"62c3f10152dc7400352bab0d","receiver_list":[{"phone_number":"+393484506627"}],"settings":{"business_account_id":"107050042390257","department_id":"6408617fffe5e5002c284dbc","project_id":"62c3f10152dc7400352bab0d","proxy_url":"https://tiledesk-whatsapp-connector-dev.glitch.me/webhook/62c3f10152dc7400352bab0d","secret":"89aaa5f9-cebb-4bde-8901-090248d57c0a","subscriptionId":"659bba8f8baa4c002c0821e1","token":"JWT eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZmFiYTIyNTRlM2UwZTAwMzQ3MGE4YjkiLCJlbWFpbCI6Imdpb3Zhbm5pLnRyb2lzaXViQGdtYWlsLmNvbSIsImZpcnN0bmFtZSI6Ikdpb3Zhbm5pIiwibGFzdG5hbWUiOiJUcm9pc2kiLCJlbWFpbHZlcmlmaWVkIjp0cnVlLCJpYXQiOjE3MDM2ODc2ODAsImF1ZCI6Imh0dHBzOi8vdGlsZWRlc2suY29tIiwiaXNzIjoiaHR0cHM6Ly90aWxlZGVzay5jb20iLCJzdWIiOiJ1c2VyIiwianRpIjoiMzM2NTU5MjAtYjA2NS00YzRhLWIxNjctODZjZTU1ODg3NjZmIn0.aYi-BV-4lZ8fQuJuicKJcSE8qmKImDIohxwDEu-vHZpuS9P617E9GFSWT-srDZuzzhQeffiENHzMCFGofJvvaaulpAHwOpAqqhbu6IjICv_QzjACgAZ5vmC_7meMvhyAm3TexP6dMsJhZ2Ker5w9nkHvS2ZCpgRQf5cLvVy3IkA","verify_token":"tiledesk-verify-token","wab_token":"EAAF6CBX7UvEBACx4bQ3ZBFPqsSyQCdwvfOJpj4jFt7hzW5kC8Unx2EUGF8LPWsbNmcbdZCE2hmOFMmANXfIDytjqmd9O2qdoqubV8rkM5LdVtEbLdlrfbZCZB3C31oaTuZBtFbSPLIVhMogXX65Py2AImZAuHsBCsfnaNPWnRMsV1ILqjV05cQiOMmSZCgwMD1TZCItqswAvewZDZD"},"template":{"language":"en_US","name":"hello_world"},"transaction_id":"tiledesk-broadcast-1713886126422"}
592
+ debug: (wab) Data arrived to scheduler: {"date":"2024-04-23T15:28:46.469Z","phone_number_id":"109639215462567","project_id":"62c3f10152dc7400352bab0d","receiver_list":[{"phone_number":"+393484506627"}],"settings":{"business_account_id":"107050042390257","department_id":"6408617fffe5e5002c284dbc","project_id":"62c3f10152dc7400352bab0d","proxy_url":"https://tiledesk-whatsapp-connector-dev.glitch.me/webhook/62c3f10152dc7400352bab0d","secret":"89aaa5f9-cebb-4bde-8901-090248d57c0a","subscriptionId":"659bba8f8baa4c002c0821e1","token":"JWT eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZmFiYTIyNTRlM2UwZTAwMzQ3MGE4YjkiLCJlbWFpbCI6Imdpb3Zhbm5pLnRyb2lzaXViQGdtYWlsLmNvbSIsImZpcnN0bmFtZSI6Ikdpb3Zhbm5pIiwibGFzdG5hbWUiOiJUcm9pc2kiLCJlbWFpbHZlcmlmaWVkIjp0cnVlLCJpYXQiOjE3MDM2ODc2ODAsImF1ZCI6Imh0dHBzOi8vdGlsZWRlc2suY29tIiwiaXNzIjoiaHR0cHM6Ly90aWxlZGVzay5jb20iLCJzdWIiOiJ1c2VyIiwianRpIjoiMzM2NTU5MjAtYjA2NS00YzRhLWIxNjctODZjZTU1ODg3NjZmIn0.aYi-BV-4lZ8fQuJuicKJcSE8qmKImDIohxwDEu-vHZpuS9P617E9GFSWT-srDZuzzhQeffiENHzMCFGofJvvaaulpAHwOpAqqhbu6IjICv_QzjACgAZ5vmC_7meMvhyAm3TexP6dMsJhZ2Ker5w9nkHvS2ZCpgRQf5cLvVy3IkA","verify_token":"tiledesk-verify-token","wab_token":"EAAF6CBX7UvEBACx4bQ3ZBFPqsSyQCdwvfOJpj4jFt7hzW5kC8Unx2EUGF8LPWsbNmcbdZCE2hmOFMmANXfIDytjqmd9O2qdoqubV8rkM5LdVtEbLdlrfbZCZB3C31oaTuZBtFbSPLIVhMogXX65Py2AImZAuHsBCsfnaNPWnRMsV1ILqjV05cQiOMmSZCgwMD1TZCItqswAvewZDZD"},"template":{"language":"en_US","name":"hello_world"},"transaction_id":"tiledesk-broadcast-1713886126422"}
593
+ verbose: (wab) schedulerResult: {"msg":"scheduling success!","success":true}
594
+ verbose: (wab) Action received from Tiledesk (Broadcast)
595
+ debug: Body (broadcast):
596
+ debug: Searching on [object Object]
597
+ debug: Searching on Collection kvstore
598
+ verbose: Doc found with key: whatsapp-62c3f10152dc7400352bab0d
599
+ debug: (wab) data_To_scheduler: {"phone_number_id":"109639215462567","project_id":"62c3f10152dc7400352bab0d","receiver_list":[{"phone_number":"+393484506627"}],"settings":{"business_account_id":"107050042390257","department_id":"6408617fffe5e5002c284dbc","project_id":"62c3f10152dc7400352bab0d","proxy_url":"https://tiledesk-whatsapp-connector-dev.glitch.me/webhook/62c3f10152dc7400352bab0d","secret":"89aaa5f9-cebb-4bde-8901-090248d57c0a","subscriptionId":"659bba8f8baa4c002c0821e1","token":"JWT eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZmFiYTIyNTRlM2UwZTAwMzQ3MGE4YjkiLCJlbWFpbCI6Imdpb3Zhbm5pLnRyb2lzaXViQGdtYWlsLmNvbSIsImZpcnN0bmFtZSI6Ikdpb3Zhbm5pIiwibGFzdG5hbWUiOiJUcm9pc2kiLCJlbWFpbHZlcmlmaWVkIjp0cnVlLCJpYXQiOjE3MDM2ODc2ODAsImF1ZCI6Imh0dHBzOi8vdGlsZWRlc2suY29tIiwiaXNzIjoiaHR0cHM6Ly90aWxlZGVzay5jb20iLCJzdWIiOiJ1c2VyIiwianRpIjoiMzM2NTU5MjAtYjA2NS00YzRhLWIxNjctODZjZTU1ODg3NjZmIn0.aYi-BV-4lZ8fQuJuicKJcSE8qmKImDIohxwDEu-vHZpuS9P617E9GFSWT-srDZuzzhQeffiENHzMCFGofJvvaaulpAHwOpAqqhbu6IjICv_QzjACgAZ5vmC_7meMvhyAm3TexP6dMsJhZ2Ker5w9nkHvS2ZCpgRQf5cLvVy3IkA","verify_token":"tiledesk-verify-token","wab_token":"EAAF6CBX7UvEBACx4bQ3ZBFPqsSyQCdwvfOJpj4jFt7hzW5kC8Unx2EUGF8LPWsbNmcbdZCE2hmOFMmANXfIDytjqmd9O2qdoqubV8rkM5LdVtEbLdlrfbZCZB3C31oaTuZBtFbSPLIVhMogXX65Py2AImZAuHsBCsfnaNPWnRMsV1ILqjV05cQiOMmSZCgwMD1TZCItqswAvewZDZD"},"template":{"language":"en_US","name":"hello_world"},"transaction_id":"tiledesk-broadcast-1713886550339"}
600
+ debug: (wab) Data arrived to scheduler: {"date":"2024-04-23T15:35:50.389Z","phone_number_id":"109639215462567","project_id":"62c3f10152dc7400352bab0d","receiver_list":[{"phone_number":"+393484506627"}],"settings":{"business_account_id":"107050042390257","department_id":"6408617fffe5e5002c284dbc","project_id":"62c3f10152dc7400352bab0d","proxy_url":"https://tiledesk-whatsapp-connector-dev.glitch.me/webhook/62c3f10152dc7400352bab0d","secret":"89aaa5f9-cebb-4bde-8901-090248d57c0a","subscriptionId":"659bba8f8baa4c002c0821e1","token":"JWT eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1ZmFiYTIyNTRlM2UwZTAwMzQ3MGE4YjkiLCJlbWFpbCI6Imdpb3Zhbm5pLnRyb2lzaXViQGdtYWlsLmNvbSIsImZpcnN0bmFtZSI6Ikdpb3Zhbm5pIiwibGFzdG5hbWUiOiJUcm9pc2kiLCJlbWFpbHZlcmlmaWVkIjp0cnVlLCJpYXQiOjE3MDM2ODc2ODAsImF1ZCI6Imh0dHBzOi8vdGlsZWRlc2suY29tIiwiaXNzIjoiaHR0cHM6Ly90aWxlZGVzay5jb20iLCJzdWIiOiJ1c2VyIiwianRpIjoiMzM2NTU5MjAtYjA2NS00YzRhLWIxNjctODZjZTU1ODg3NjZmIn0.aYi-BV-4lZ8fQuJuicKJcSE8qmKImDIohxwDEu-vHZpuS9P617E9GFSWT-srDZuzzhQeffiENHzMCFGofJvvaaulpAHwOpAqqhbu6IjICv_QzjACgAZ5vmC_7meMvhyAm3TexP6dMsJhZ2Ker5w9nkHvS2ZCpgRQf5cLvVy3IkA","verify_token":"tiledesk-verify-token","wab_token":"EAAF6CBX7UvEBACx4bQ3ZBFPqsSyQCdwvfOJpj4jFt7hzW5kC8Unx2EUGF8LPWsbNmcbdZCE2hmOFMmANXfIDytjqmd9O2qdoqubV8rkM5LdVtEbLdlrfbZCZB3C31oaTuZBtFbSPLIVhMogXX65Py2AImZAuHsBCsfnaNPWnRMsV1ILqjV05cQiOMmSZCgwMD1TZCItqswAvewZDZD"},"template":{"language":"en_US","name":"hello_world"},"transaction_id":"tiledesk-broadcast-1713886550339"}
601
+ verbose: (wab) schedulerResult: {"msg":"scheduling success!","success":true}
602
+ info: (wab) Connect Redis Error Error: Redis connection to redis-19030.c226.eu-west-1-3.ec2.cloud.redislabs.com:19030 failed - read ETIMEDOUT
603
+ info: (wab) Redis ready!
604
+ info: (wab) Connect Redis Error Error: Redis connection to redis-19030.c226.eu-west-1-3.ec2.cloud.redislabs.com:19030 failed - read ETIMEDOUT
605
+ info: (wab) Redis ready!
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-whatsapp-connector",
3
- "version": "0.1.65",
3
+ "version": "0.1.67",
4
4
  "description": "Tiledesk Whatsapp connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "mocha",
8
8
  "start": "node index.js"
9
9
  },
10
+ "engines": {
11
+ "node": "16.17.0",
12
+ "npm": "8.15.0"
13
+ },
10
14
  "keywords": [],
11
15
  "author": "Giovanni Troisi",
12
16
  "license": "MIT",
@@ -94,7 +94,7 @@
94
94
  <!-- INFO BOX -->
95
95
  {{#unless popup_view}}
96
96
  <div class="info-box">
97
-
97
+ {{#unless brand_name}}
98
98
  <div class="info-list">
99
99
  <!--
100
100
  <div style="margin-bottom:20px;">
@@ -111,53 +111,55 @@
111
111
 
112
112
  <ul>
113
113
  <div class="list-element">
114
- <img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width=20 height=20 style="margin-right: 10px;"/>
114
+ <img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width="20" height="20" style="margin-right: 10px;"/>
115
115
  <h7>Integrate your Whatsapp number with Tiledesk</h7>
116
116
  </div>
117
117
  <div class="list-element">
118
- <img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width=20 height=20 style="margin-right: 10px;"/>
118
+ <img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width="20" height="20" style="margin-right: 10px;"/>
119
119
  <h7>Once a chat is initiated on your Whatsapp number, receive an alert on your Tiledesk account</h7>
120
120
  </div>
121
121
  <div class="list-element">
122
- <img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width=20 height=20 style="margin-right: 10px;"/>
122
+ <img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width="20" height="20" style="margin-right: 10px;"/>
123
123
  <h7>Enable instant messaging and answer multiple conversations, everything from Tiledesk account</h7>
124
124
  </div>
125
125
  </ul>
126
126
  </div>
127
+ {{/unless}}
127
128
  </div>
128
129
  {{/unless}}
129
130
 
130
131
  <!-- Docs Section -->
131
132
  {{#unless popup_view}}
132
133
  <div class="docs-box">
133
-
134
- <div class="docs-section">
135
- <p style="margin-top: 20px; font-size: 18px; font-weight: 600;">Before you start</p>
136
- <div style="padding: 20px; background-color: #2fa2dc24; border-radius: 8px; width: 600px; margin-bottom: 5px;">
137
- <div style="display: flex; flex-direction: row; align-items: baseline;">
138
- <div>
139
- <img src="https://freeiconshop.com/wp-content/uploads/edd/arrow-flat.png" width="20px" height="auto" style="margin-right: 10px;">
140
- </div>
141
- <div>
142
- <a href="https://gethelp.tiledesk.com/articles/connect-tiledesk-with-whatsapp-business/" target="_blank">Connect Tiledesk with WhatsApp Business</a>
143
- <p style="color: grey; margin-bottom: 0px;">A small but very useful guide on how to connect your WhatsApp Business number with Tiledesk</p>
134
+ {{#unless brand_name}}
135
+ <div class="docs-section">
136
+ <p style="margin-top: 20px; font-size: 18px; font-weight: 600;">Before you start</p>
137
+ <div style="padding: 20px; background-color: #2fa2dc24; border-radius: 8px; width: 600px; margin-bottom: 5px;">
138
+ <div style="display: flex; flex-direction: row; align-items: baseline;">
139
+ <div>
140
+ <img src="https://freeiconshop.com/wp-content/uploads/edd/arrow-flat.png" width="20px" height="auto" style="margin-right: 10px;">
141
+ </div>
142
+ <div>
143
+ <a href="https://gethelp.tiledesk.com/articles/connect-tiledesk-with-whatsapp-business/" target="_blank">Connect Tiledesk with WhatsApp Business</a>
144
+ <p style="color: grey; margin-bottom: 0px;">A small but very useful guide on how to connect your WhatsApp Business number with Tiledesk</p>
145
+ </div>
144
146
  </div>
145
147
  </div>
146
- </div>
147
148
 
148
- <div style="padding: 20px; background-color: #2fa2dc24; border-radius: 8px; width: 600px; margin-bottom: 5px;">
149
- <div style="display: flex; flex-direction: row; align-items: baseline;">
150
- <div>
151
- <img src="https://freeiconshop.com/wp-content/uploads/edd/arrow-flat.png" width="20px" height="auto" style="margin-right: 10px;">
152
- </div>
153
- <div>
154
- <a href="https://gethelp.tiledesk.com/articles/configure-a-whatsapp-business-account/" target="_blank">Configure a WhatsApp Business account</a>
155
- <p style="color: grey; margin-bottom: 0px;">Not sure how to set up a business account? Take a look here.</p>
149
+ <div style="padding: 20px; background-color: #2fa2dc24; border-radius: 8px; width: 600px; margin-bottom: 5px;">
150
+ <div style="display: flex; flex-direction: row; align-items: baseline;">
151
+ <div>
152
+ <img src="https://freeiconshop.com/wp-content/uploads/edd/arrow-flat.png" width="20px" height="auto" style="margin-right: 10px;">
153
+ </div>
154
+ <div>
155
+ <a href="https://gethelp.tiledesk.com/articles/configure-a-whatsapp-business-account/" target="_blank">Configure a WhatsApp Business account</a>
156
+ <p style="color: grey; margin-bottom: 0px;">Not sure how to set up a business account? Take a look here.</p>
157
+ </div>
156
158
  </div>
157
159
  </div>
158
- </div>
159
160
 
160
- </div>
161
+ </div>
162
+ {{/unless}}
161
163
  </div>
162
164
  {{/unless}}
163
165
 
@@ -238,7 +240,7 @@
238
240
  <div class="form-group" style="width: 522px;">
239
241
  <label class="input-label" for="department">Department <span style="font-weight: normal;">(Optional)</span></label>
240
242
  <div style="display: flex; flex-direction: row; align-items: center;">
241
- <select class="custom-select" name="department" class="form-control">
243
+ <select class="custom-select form-control" name="department">
242
244
  {{#each departments}}
243
245
  {{#if (isEqual _id ../department_id)}}
244
246
  <option value="{{ _id }}" selected>{{ name }}</option>
@@ -284,7 +286,13 @@
284
286
  <!-- Disconnect Button -->
285
287
  {{#if wab_token}}
286
288
  <div>
287
- <p style="color: rgb(140, 140, 140);">The WhatsApp Business App is configured on your Tildesk project.</p>
289
+ {{#if brand_name}}
290
+ <p style="color: rgb(140, 140, 140);">The WhatsApp Business App is configured on your {{ brand_name }} project.</p>
291
+ {{else}}
292
+ <p style="color: rgb(140, 140, 140);">The WhatsApp Business App is configured on your Tiledesk project.</p>
293
+ {{/if}}
294
+
295
+
288
296
  <p>By clicking on disconnect you will no longer be able to receive messages from the WhatsApp channel</p>
289
297
  <form action="./disconnect" method="post">
290
298
  <input type="hidden" name="project_id" value="{{ project_id }}">
@@ -294,8 +302,13 @@
294
302
  </form>
295
303
  </div>
296
304
  {{else}}
297
- <!-- App not configured -->
298
- <p style="color: rgb(140, 140, 140);">The WhatsApp Business App is not yet configured on your Tildesk project.</p>
305
+ <!-- App not configured -->
306
+ {{#if brand_name}}
307
+ <p style="color: rgb(140, 140, 140);">The WhatsApp Business App is not yet configured on your {{ brand_name }} project.</p>
308
+ {{else}}
309
+ <p style="color: rgb(140, 140, 140);">The WhatsApp Business App is not yet configured on your Tiledesk project.</p>
310
+ {{/if}}
311
+
299
312
  {{/if}}
300
313
  </div>
301
314
  </div>
@@ -348,4 +361,5 @@
348
361
  </script>
349
362
 
350
363
 
351
- </body>
364
+ </body>
365
+ </html>
@@ -12,6 +12,8 @@ class WhatsappLogger {
12
12
  async updateMessageStatus(message_id, status, error) {
13
13
  let status_code = this.getCodeFromStatus(status);
14
14
  winston.debug("(wab) getCodeFromStatus result " + status_code);
15
+
16
+ console.log("message_id: ", message_id)
15
17
 
16
18
  MessageLog.findOneAndUpdate({ message_id: message_id }, { $set: {status: status, status_code: status_code, error: error }}, { new: true }).then((messageLog) => {
17
19
 
@@ -1,278 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
- <meta name="viewport" content="width=device-width, initial-scale=1">
8
-
9
- <!-- Latest compiled and minified CSS -->
10
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
11
- integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
12
-
13
- <!-- Optional theme -->
14
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css"
15
- integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">
16
-
17
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
18
-
19
- <script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
20
- <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
21
-
22
- <!-- Latest compiled and minified JavaScript -->
23
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
24
- integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous">
25
- </script>
26
-
27
- <link rel="stylesheet" href="./css/detail.css">
28
-
29
- <style>
30
- body {
31
- font-family: 'Poppins';
32
- }
33
- </style>
34
- </head>
35
-
36
- <body style="display: flex; justify-content: center;">
37
- <div class="content">
38
- <div style="margin-top: 10px;">
39
- <p style="font-size: 20px;">Tiledesk <b>App Store</b></p>
40
- </div>
41
-
42
- <hr style="margin-top: 10px; margin-bottom: 10px">
43
-
44
- <div class="installation-info-box">
45
- {{#if isAvailable}}
46
- <p style="margin: 0px; color: #676767; font-size: 13px;">You can install this application for free.</p>
47
- {{else}}
48
- <p style="margin: 0px; color: #676767; font-size: 13px;">This app is available for Scale and Plus plans</p>
49
- {{/if}}
50
- </div>
51
-
52
-
53
- <div class="icon-and-title" style="margin-top: 20px;">
54
- <div>
55
- <img src="https://user-images.githubusercontent.com/45603238/200829081-e6a9c7a0-9d8c-431c-a477-4880a8fd752f.png" width="180" height="auto" />
56
- </div>
57
-
58
- <div style="display: flex; flex-direction: row; justify-content: space-between; margin-left: 40px; width: 100%;">
59
- <div>
60
- <p style="font-size: 26px; font-weight: 500; margin-bottom: 0px;">WhatsApp Business</p>
61
- <p style="color: #676767; font-size: 16px; margin-bottom: 5px;">Connect your WhatsApp number with Tiledesk</p>
62
- <a style="font-size: 18px;" href="https://tiledesk.com/" target="_blank">Tiledesk</a>
63
- {{#if isAvailable}}
64
- <p style="font-size: 15px; color: #676767; font-style: italic; margin-bottom: 0px; margin-top: 20px;">Free</p>
65
- {{else}}
66
- <p style="font-size: 15px; color: #676767; font-style: italic; margin-bottom: 0px; margin-top: 20px;">Free for</p>
67
- <div class="plans-div">
68
- <div class="plan scale-plan">Premium Plan</div>
69
- <div class="plan plus-plan">Custom Plan</div>
70
- </div>
71
- {{/if}}
72
- </div>
73
-
74
- <div style="display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end;">
75
-
76
- {{#if installed}}
77
-
78
- <!-- Open button -->
79
- {{#if isAvailable}}
80
- <form action="./configure" method="get">
81
- <input type="hidden" name="project_id" value="{{ project_id }}" />
82
- <input type="hidden" name="app_id" value="{{ app_id }}" />
83
- <input type="hidden" name="token" value="{{ token }}" />
84
- <input type="submit" class="btn install-button" value="Open">
85
- </form>
86
- {{else}}
87
- <button class="btn install-button" disabled>Open</button>
88
- {{/if}}
89
-
90
- <!-- Uninstall button -->
91
- <button class="btn uninstall-button" onclick="document.getElementById('uninstall-modal').style.display='flex'">Uninstall</button>
92
-
93
- <!-- Uninstall modal -->
94
- <div id="uninstall-modal" class="modal">
95
- <div class="modal-content">
96
- <!--<span class="close">×</span-->
97
- <h2>WhatsApp Business</h2>
98
- <div style="margin-top: 20px;">
99
- <img src="https://user-images.githubusercontent.com/45603238/200829081-e6a9c7a0-9d8c-431c-a477-4880a8fd752f.png" width="70" height="auto" />
100
- </div>
101
- <p style="margin-top: 20px; margin-bottom: 20px;">Are you sure you want to uninstall this app?</p>
102
-
103
- <div style="display: flex; flex-direction: row; width: 100%; justify-content: center;">
104
- <button class="btn cancel-btn" onclick="document.getElementById('uninstall-modal').style.display='none'">Cancel</button>
105
-
106
- <form action="./uninstall" method="post">
107
- <input type="hidden" name="project_id" value="{{ project_id }}" />
108
- <input type="hidden" name="app_id" value="{{ app_id }}" />
109
- <input type="hidden" name="token" value="{{ token }}" />
110
- <input type="submit" class="btn uninstall-button" value="Yes, uninstall" onclick="postMessage('uninstallWhatsapp')">
111
- </form>
112
- </div>
113
- </div>
114
- </div>
115
-
116
- {{else}}
117
-
118
- {{#if isAvailable}}
119
- <button class="btn install-button" onclick="document.getElementById('install-modal').style.display='flex'">Install</button>
120
- {{else}}
121
- <button class="btn install-button" disabled>Install</button>
122
- {{/if}}
123
-
124
- <!-- Install modal -->
125
- <div id="install-modal" class="modal">
126
- <div class="modal-content">
127
- <!--<span class="close">×</span-->
128
- <h2>WhatsApp Business</h2>
129
- <div style="margin-top: 20px;">
130
- <img src="https://user-images.githubusercontent.com/45603238/200829081-e6a9c7a0-9d8c-431c-a477-4880a8fd752f.png" width="70" height="auto" />
131
- </div>
132
- <p style="margin-top: 20px; margin-bottom: 20px;">Are you sure you want to install this app?</p>
133
-
134
- <div style="display: flex; flex-direction: row; width: 100%; justify-content: center;">
135
- <button class="btn cancel-btn" onclick="document.getElementById('install-modal').style.display='none'">Cancel</button>
136
-
137
- <form action="./install" method="post">
138
- <input type="hidden" name="project_id" value="{{ project_id }}" />
139
- <input type="hidden" name="app_id" value="{{ app_id }}" />
140
- <input type="hidden" name="token" value="{{ token }}" />
141
- <input type="submit" class="btn install-button" value="Install" onclick="postMessage('installWhatsapp')">
142
- <!--<input type="submit" class="btn install-button" value="Install" onclick="postMessage('installWhatsapp')">-->
143
- </form>
144
- </div>
145
- </div>
146
- </div>
147
- {{/if}}
148
- </div>
149
- </div>
150
- </div>
151
-
152
- <hr style="margin-top: 20px; margin-bottom: 20px">
153
-
154
- <p style="font-size: 18px;"><b>Screenshot from the application</b></p>
155
-
156
- <div class="scrollmenu">
157
-
158
- <img src="https://user-images.githubusercontent.com/45603238/195042381-995ff805-359d-4d97-af67-f86f937c175a.jpg" class="screenshot" />
159
-
160
- <img src="https://user-images.githubusercontent.com/45603238/195042391-6560424b-6a20-48ef-a5b3-981f9cbda5db.jpg" class="screenshot" />
161
-
162
- <img src=" https://user-images.githubusercontent.com/45603238/195042354-e8ce2b8b-4a82-45b6-8ac1-c1d1bcf77e40.jpg" class="screenshot"/>
163
-
164
- <img src="https://user-images.githubusercontent.com/45603238/196982373-6b17cf76-6608-45bf-86da-551c14c46e0f.png" class="screenshot" />
165
-
166
- </div>
167
-
168
- <hr style="margin-top: 20px; margin-bottom: 20px">
169
-
170
- <div>
171
- <h7>Receive Whatsapp conversations in your Tiledesk dashboard. Seamlessly Chat with your targeted audience on Whatsapp right from the Tiledesk dashboard.</h7>
172
-
173
- <ul style="margin-top: 10px; padding: 0px;">
174
- <div class="list-element">
175
- <img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width=16 height=16 style="margin-right: 10px;"/>
176
- <h7>Integrate your Whatsapp number with Tiledesk</h7>
177
- </div>
178
- <div class="list-element">
179
- <img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width=16 height=16 style="margin-right: 10px;"/>
180
- <h7>Once a chat is initiated on your Whatsapp number, receive an alert on your Tiledesk account</h7>
181
- </div>
182
- <div class="list-element">
183
- <img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width=16 height=16 style="margin-right: 10px;"/>
184
- <h7>Enable instant messaging and answer multiple conversations - everything from Tiledesk account</h7>
185
- </div>
186
- </ul>
187
-
188
- <div style="padding: 20px; background-color: aliceblue; border-radius: 8px;">
189
- <div style="display: flex; flex-direction: row; align-items: baseline;">
190
- <div>
191
- <img src="https://freeiconshop.com/wp-content/uploads/edd/arrow-flat.png" width="20px" height="auto" style="margin-right: 10px;">
192
- </div>
193
- <div>
194
- <a href="https://gethelp.tiledesk.com/articles/connect-tiledesk-with-whatsapp-business/" target="_blank">Connect Tiledesk with WhatsApp Business</a>
195
- <p style="color: grey; margin-bottom: 0px;">A small but very useful guide on how to connect your WhatsApp Business number with Tiledesk</p>
196
- </div>
197
- </div>
198
-
199
- <hr style="margin-top: 10px; margin-bottom: 10px;">
200
-
201
- <div style="display: flex; flex-direction: row; align-items: baseline;">
202
- <div>
203
- <img src="https://freeiconshop.com/wp-content/uploads/edd/arrow-flat.png" width="20px" height="auto" style="margin-right: 10px;">
204
- </div>
205
- <div>
206
- <a href="https://gethelp.tiledesk.com/articles/configure-a-whatsapp-business-account/" target="_blank">Configure a WhatsApp Business account</a>
207
- <p style="color: grey; margin-bottom: 0px;">Not sure how to set up a business account? Take a look here.</p>
208
- </div>
209
- </div>
210
- </div>
211
- </div>
212
-
213
- <hr style="margin-top: 20px; margin-bottom: 20px">
214
-
215
- <p style="font-size: 18px;"><b>What's new?</b></p>
216
-
217
- <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
218
- <div>
219
- <p>Bug fix and minor improvements</p>
220
- </div>
221
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.64</b></p>
222
- </div>
223
-
224
- <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
225
- <div>
226
- <p>Plans upgrade</p>
227
- </div>
228
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.63</b></p>
229
- </div>
230
-
231
- <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
232
- <div>
233
- <p>Fixed bug: custom authentication error</p>
234
- </div>
235
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.62</b></p>
236
- </div>
237
-
238
- <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
239
- <div>
240
- <p>Bug fixes and performance improvements</p>
241
- </div>
242
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.61</b></p>
243
- </div>
244
-
245
- <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
246
- <div>
247
- <p>Bug fixes and performance improvements</p>
248
- </div>
249
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.60</b></p>
250
- </div>
251
-
252
- <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
253
- <div>
254
- <p style="margin-bottom: 0px">Added Meta message forwarding</p>
255
- </div>
256
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.59</b></p>
257
- </div>
258
-
259
-
260
- <div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
261
- <div>
262
- <p>Added Messages Logs for WhatsApp broadcast</p>
263
- <p>Added Queue Manager for Whatsapp broadcast</p>
264
- <p>Bug fixes and performance improvements</p>
265
- </div>
266
- <p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.55</b></p>
267
- </div>
268
-
269
- <hr style="margin-top: 50px; margin-bottom: 20px">
270
-
271
- <script>
272
- function postMessage(action) {
273
- const msg = { action: action, calledBy: 'whatsapp_proxy' }
274
- window.parent.postMessage(msg, '*');
275
- }
276
- </script>
277
-
278
- </body>