@tiledesk/tiledesk-whatsapp-connector 0.1.15 → 0.1.17
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 +62 -28
- package/package.json +1 -1
- package/template/configure.html +218 -145
- package/template/css/configure.css +362 -0
- package/template/css/detail.css +213 -0
- package/template/css/style.css +206 -110
- package/template/detail.html +107 -32
- package/template/old_configure.html +206 -0
- package/tiledesk/TiledeskWhatsappTranslator.js +16 -15
- /package/tmp/{media-1wy7l3.jpeg → media-1z2nit.jpeg} +0 -0
- package/tmp/media-1z2nkr.mp4 +0 -0
- package/tmp/media-1wy8f7.mp4 +0 -0
- package/tmp/media-1wy8mz.jpeg +0 -0
- package/tmp/media-1wyb62.jpeg +0 -0
- package/tmp/media-1wyb7k.mp4 +0 -0
- package/tmp/media-1wyb98.pdf +0 -0
- package/tmp/media-1wybp7.pdf +0 -0
- package/tmp/media-1y8xpl.jpeg +0 -0
- package/tmp/media-1y8xpv.jpeg +0 -0
- package/tmp/media-1y8xqd.jpeg +0 -0
- package/tmp/media-1y8xr4.jpeg +0 -0
- package/tmp/media-1y8xty.jpeg +0 -0
- package/tmp/media-1y8xvp.jpeg +0 -0
- package/tmp/media-1y8xx5.jpeg +0 -0
- package/tmp/media-1y8y0g.jpeg +0 -0
- package/tmp/media-1y8y4x.jpeg +0 -0
- package/tmp/media-1y8y5k.jpeg +0 -0
- package/tmp/media-1y8ya4.jpeg +0 -0
- package/tmp/media-1y8ya7.jpeg +0 -0
- package/tmp/media-1y8yek.jpeg +0 -0
- package/tmp/media-1y8yfg.jpeg +0 -0
- package/tmp/media-1y8ygr.jpeg +0 -0
- package/tmp/media-1y8yh4.jpeg +0 -0
- package/tmp/media-1y8yi1.jpeg +0 -0
- package/tmp/media-1y8yid.jpeg +0 -0
- package/tmp/media-1y8yks.jpeg +0 -0
- package/tmp/media-1y8ym4.mp4 +0 -0
- package/tmp/media-1y8yqe.jpeg +0 -0
- package/tmp/media-1y8yuv.jpeg +0 -0
- package/tmp/media-1y8yv9.jpeg +0 -0
- package/tmp/media-1y8yy2.jpeg +0 -0
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const appRoot = require('app-root-path');
|
|
|
7
7
|
const handlebars = require('handlebars');
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
const path = require('path');
|
|
10
|
+
const pjson = require('./package.json');
|
|
10
11
|
|
|
11
12
|
// tiledesk clients
|
|
12
13
|
const { TiledeskClient } = require('@tiledesk/tiledesk-client');
|
|
@@ -57,6 +58,7 @@ router.get('/detail', async (req, res) => {
|
|
|
57
58
|
|
|
58
59
|
var template = handlebars.compile(html);
|
|
59
60
|
var replacements = {
|
|
61
|
+
app_version: pjson.version,
|
|
60
62
|
project_id: projectId,
|
|
61
63
|
token: token,
|
|
62
64
|
app_id: app_id,
|
|
@@ -102,6 +104,7 @@ router.post('/install', async (req, res) => {
|
|
|
102
104
|
|
|
103
105
|
var template = handlebars.compile(html);
|
|
104
106
|
var replacements = {
|
|
107
|
+
app_version: pjson.version,
|
|
105
108
|
project_id: project_id,
|
|
106
109
|
token: token,
|
|
107
110
|
app_id: app_id,
|
|
@@ -142,6 +145,7 @@ router.post('/uninstall', async (req, res) => {
|
|
|
142
145
|
|
|
143
146
|
var template = handlebars.compile(html);
|
|
144
147
|
var replacements = {
|
|
148
|
+
app_version: pjson.version,
|
|
145
149
|
project_id: project_id,
|
|
146
150
|
token: token,
|
|
147
151
|
app_id: app_id,
|
|
@@ -189,6 +193,7 @@ router.get('/configure', async (req, res) => {
|
|
|
189
193
|
|
|
190
194
|
var template = handlebars.compile(html);
|
|
191
195
|
var replacements = {
|
|
196
|
+
app_version: pjson.version,
|
|
192
197
|
project_id: projectId,
|
|
193
198
|
token: token,
|
|
194
199
|
proxy_url: proxy_url,
|
|
@@ -214,6 +219,7 @@ router.get('/configure', async (req, res) => {
|
|
|
214
219
|
|
|
215
220
|
var template = handlebars.compile(html);
|
|
216
221
|
var replacements = {
|
|
222
|
+
app_version: pjson.version,
|
|
217
223
|
project_id: projectId,
|
|
218
224
|
token: token,
|
|
219
225
|
proxy_url: proxy_url,
|
|
@@ -258,10 +264,12 @@ router.post('/update', async (req, res) => {
|
|
|
258
264
|
|
|
259
265
|
var template = handlebars.compile(html);
|
|
260
266
|
var replacements = {
|
|
267
|
+
app_version: pjson.version,
|
|
261
268
|
project_id: projectId,
|
|
262
269
|
token: token,
|
|
263
270
|
proxy_url: proxy_url,
|
|
264
271
|
wab_token: settings.wab_token,
|
|
272
|
+
show_success_modal: true,
|
|
265
273
|
verify_token: settings.verify_token,
|
|
266
274
|
subscription_id: settings.subscriptionId,
|
|
267
275
|
}
|
|
@@ -316,9 +324,11 @@ router.post('/update', async (req, res) => {
|
|
|
316
324
|
|
|
317
325
|
var template = handlebars.compile(html);
|
|
318
326
|
var replacements = {
|
|
327
|
+
app_version: pjson.version,
|
|
319
328
|
project_id: projectId,
|
|
320
329
|
token: token,
|
|
321
330
|
proxy_url: proxy_url,
|
|
331
|
+
show_success_modal: true,
|
|
322
332
|
wab_token: settings.wab_token,
|
|
323
333
|
verify_token: settings.verify_token,
|
|
324
334
|
subscription_id: settings.subscriptionId,
|
|
@@ -332,7 +342,27 @@ router.post('/update', async (req, res) => {
|
|
|
332
342
|
})
|
|
333
343
|
|
|
334
344
|
}).catch((err) => {
|
|
335
|
-
|
|
345
|
+
|
|
346
|
+
readHTMLFile('/configure.html', (err, html) => {
|
|
347
|
+
if (err) {
|
|
348
|
+
console.log("(ERROR) Read html file: ", err);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
var template = handlebars.compile(html);
|
|
352
|
+
var replacements = {
|
|
353
|
+
app_version: pjson.version,
|
|
354
|
+
project_id: projectId,
|
|
355
|
+
token: token,
|
|
356
|
+
proxy_url: proxy_url,
|
|
357
|
+
show_error_modal: true
|
|
358
|
+
}
|
|
359
|
+
if (log) {
|
|
360
|
+
console.log("Replacements: ", replacements);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
var html = template(replacements);
|
|
364
|
+
res.send(html);
|
|
365
|
+
})
|
|
336
366
|
})
|
|
337
367
|
|
|
338
368
|
}
|
|
@@ -348,6 +378,8 @@ router.post('/disconnect', async (req, res) => {
|
|
|
348
378
|
let token = req.body.token;
|
|
349
379
|
let subscriptionId = req.body.subscription_id;
|
|
350
380
|
|
|
381
|
+
console.log("uninstall --> subscriptionId: ", subscriptionId)
|
|
382
|
+
|
|
351
383
|
let CONTENT_KEY = "whatsapp-" + projectId;
|
|
352
384
|
await db.remove(CONTENT_KEY);
|
|
353
385
|
console.log("Content deleted.");
|
|
@@ -373,6 +405,7 @@ router.post('/disconnect', async (req, res) => {
|
|
|
373
405
|
|
|
374
406
|
var template = handlebars.compile(html);
|
|
375
407
|
var replacements = {
|
|
408
|
+
app_version: pjson.version,
|
|
376
409
|
project_id: projectId,
|
|
377
410
|
token: token,
|
|
378
411
|
proxy_url: proxy_url,
|
|
@@ -683,36 +716,37 @@ function startApp(settings, callback) {
|
|
|
683
716
|
console.log("GRAPH_URL: ", GRAPH_URL);
|
|
684
717
|
}
|
|
685
718
|
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
719
|
+
if (!settings.APPS_API_URL) {
|
|
720
|
+
throw new Error("settings.APPS_API_URL is mandatory");
|
|
721
|
+
} else {
|
|
722
|
+
APPS_API_URL = settings.APPS_API_URL;
|
|
723
|
+
console.log("APPS_API_URL: ", APPS_API_URL);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
if (settings.log) {
|
|
727
|
+
log = settings.log;
|
|
728
|
+
}
|
|
692
729
|
|
|
693
|
-
|
|
694
|
-
|
|
730
|
+
db.connect(settings.MONGODB_URL, () => {
|
|
731
|
+
console.log("KVBaseMongo successfully connected.");
|
|
732
|
+
|
|
733
|
+
if (callback) {
|
|
734
|
+
callback();
|
|
695
735
|
}
|
|
736
|
+
})
|
|
737
|
+
}
|
|
696
738
|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
739
|
+
function readHTMLFile(templateName, callback) {
|
|
740
|
+
console.log("Reading file: ", templateName)
|
|
741
|
+
fs.readFile(__dirname + '/template' + templateName, { encoding: 'utf-8' },
|
|
742
|
+
function(err, html) {
|
|
743
|
+
if (err) {
|
|
744
|
+
throw err;
|
|
745
|
+
//callback(err);
|
|
746
|
+
} else {
|
|
747
|
+
callback(null, html)
|
|
701
748
|
}
|
|
702
749
|
})
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
function readHTMLFile(templateName, callback) {
|
|
706
|
-
console.log("Reading file: ", templateName)
|
|
707
|
-
fs.readFile(__dirname + '/template' + templateName, { encoding: 'utf-8' },
|
|
708
|
-
function(err, html) {
|
|
709
|
-
if (err) {
|
|
710
|
-
throw err;
|
|
711
|
-
//callback(err);
|
|
712
|
-
} else {
|
|
713
|
-
callback(null, html)
|
|
714
|
-
}
|
|
715
|
-
})
|
|
716
|
-
}
|
|
750
|
+
}
|
|
717
751
|
|
|
718
|
-
|
|
752
|
+
module.exports = { router: router, startApp: startApp };
|
package/package.json
CHANGED
package/template/configure.html
CHANGED
|
@@ -23,172 +23,242 @@
|
|
|
23
23
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
|
|
24
24
|
integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous">
|
|
25
25
|
</script>
|
|
26
|
-
|
|
27
|
-
<link rel="stylesheet" href="./css/style.css">
|
|
28
26
|
|
|
27
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
|
28
|
+
<link rel="stylesheet" href="./css/configure.css">
|
|
29
|
+
|
|
30
|
+
<style>
|
|
31
|
+
body {
|
|
32
|
+
font-family: 'Poppins', serif;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
35
|
+
|
|
29
36
|
</head>
|
|
30
37
|
|
|
38
|
+
|
|
31
39
|
<body>
|
|
40
|
+
|
|
41
|
+
<!-- Success modal -->
|
|
42
|
+
{{#if show_success_modal}}
|
|
43
|
+
<div id="success-update-modal" class="success-modal">
|
|
44
|
+
<div class="modal-content">
|
|
45
|
+
<img src="https://www.pngall.com/wp-content/uploads/9/Green-Tick-Vector-PNG-Images.png" width="80" height="auto" />
|
|
46
|
+
<p class="modal-text" style="margin-top: 20px; margin-bottom: 20px;">Configuration updated successfully</p>
|
|
47
|
+
<button class="btn cancel-btn" onclick="document.getElementById('success-update-modal').style.display='none'">Close</button>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
{{/if}}
|
|
51
|
+
|
|
52
|
+
<!-- Error modal -->
|
|
53
|
+
{{#if show_error_modal}}
|
|
54
|
+
<div id="error-update-modal" class="error-modal">
|
|
55
|
+
<div class="modal-content">
|
|
56
|
+
<img src="https://cdn-icons-png.flaticon.com/512/148/148766.png" width="80" height="auto" />
|
|
57
|
+
<p style="margin-top: 20px; margin-bottom: 20px;">An error occurred while updating the configuration</p>
|
|
58
|
+
<button class="btn cancel-btn" onclick="document.getElementById('error-update-modal').style.display='none'">Close</button>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
{{/if}}
|
|
62
|
+
|
|
63
|
+
|
|
32
64
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<div
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
65
|
+
<!-- HEADER -->
|
|
66
|
+
<div class="header">
|
|
67
|
+
<div class="header-content">
|
|
68
|
+
<div class="logo-title">
|
|
69
|
+
<div class="logo-container">
|
|
70
|
+
<img src="https://www.clipartmax.com/png/full/205-2058823_whatsapp-ios-icon-whatsapp-ios-icon-png.png" width="60px" height="60px">
|
|
71
|
+
</div>
|
|
72
|
+
<div class="title-version">
|
|
73
|
+
<p class="title">WhatsApp Business Connector</p>
|
|
74
|
+
<div class="status-box" style="padding: 0px 8px; letter-spacing: 1px; height: 18px;">
|
|
75
|
+
<p style="margin-bottom: 0px;">{{ app_version }}</p>
|
|
43
76
|
</div>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="status-box">
|
|
80
|
+
<p style="margin-bottom: 0px; margin-right: 8px;">Status: </p>
|
|
81
|
+
{{#if wab_token}}
|
|
82
|
+
<i class="fa fa-circle green-circle"></i>
|
|
83
|
+
<p style="margin-bottom: 0px;">Connected</p>
|
|
84
|
+
{{else}}
|
|
85
|
+
<i class="fa fa-circle red-circle"></i>
|
|
86
|
+
<p style="margin-bottom: 0px;">Disconnected</p>
|
|
87
|
+
{{/if}}
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
49
91
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
</div>
|
|
92
|
+
<!-- INFO BOX -->
|
|
93
|
+
<div class="info-box">
|
|
94
|
+
<div class="info-list">
|
|
95
|
+
<ul>
|
|
96
|
+
<div class="list-element">
|
|
97
|
+
<img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width=20 height=20 style="margin-right: 10px;"/>
|
|
98
|
+
<h7>Integrate your Whatsapp number with Tiledesk</h7>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="list-element">
|
|
101
|
+
<img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width=20 height=20 style="margin-right: 10px;"/>
|
|
102
|
+
<h7>Once a chat is initiated on your Whatsapp number, receive an alert on your Tiledesk account</h7>
|
|
63
103
|
</div>
|
|
104
|
+
<div class="list-element">
|
|
105
|
+
<img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width=20 height=20 style="margin-right: 10px;"/>
|
|
106
|
+
<h7>Enable instant messaging and answer multiple conversations, everything from Tiledesk account</h7>
|
|
107
|
+
</div>
|
|
108
|
+
</ul>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
64
111
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<h7>Enable instant messaging and answer multiple conversations - everything from Tiledesk account.</h7>
|
|
80
|
-
</li>
|
|
81
|
-
</ul>
|
|
112
|
+
<!-- Docs Section -->
|
|
113
|
+
<div class="docs-box">
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
<div class="docs-section">
|
|
117
|
+
<p style="margin-top: 20px; font-size: 18px; font-weight: 600;">Before you start</p>
|
|
118
|
+
<div style="padding: 20px; background-color: #2fa2dc24; border-radius: 8px; width: 600px; margin-bottom: 5px;">
|
|
119
|
+
<div style="display: flex; flex-direction: row; align-items: baseline;">
|
|
120
|
+
<div>
|
|
121
|
+
<img src="https://freeiconshop.com/wp-content/uploads/edd/arrow-flat.png" width="20px" height="auto" style="margin-right: 10px;">
|
|
122
|
+
</div>
|
|
123
|
+
<div>
|
|
124
|
+
<a href="https://gethelp.tiledesk.com/articles/connect-tiledesk-with-whatsapp-business/" target="_blank">Connect Tiledesk with WhatsApp Business</a>
|
|
125
|
+
<p style="color: grey; margin-bottom: 0px;">A small but very useful guide on how to connect your WhatsApp Business number with Tiledesk</p>
|
|
82
126
|
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
83
129
|
|
|
84
|
-
|
|
85
|
-
|
|
130
|
+
<div style="padding: 20px; background-color: #2fa2dc24; border-radius: 8px; width: 600px; margin-bottom: 5px;">
|
|
131
|
+
<div style="display: flex; flex-direction: row; align-items: baseline;">
|
|
132
|
+
<div>
|
|
133
|
+
<img src="https://freeiconshop.com/wp-content/uploads/edd/arrow-flat.png" width="20px" height="auto" style="margin-right: 10px;">
|
|
86
134
|
</div>
|
|
87
|
-
|
|
135
|
+
<div>
|
|
136
|
+
<a href="https://gethelp.tiledesk.com/articles/configure-a-whatsapp-business-account/" target="_blank">Configure a WhatsApp Business account</a>
|
|
137
|
+
<p style="color: grey; margin-bottom: 0px;">Not sure how to set up a business account? Take a look here.</p>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
88
141
|
|
|
89
|
-
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
|
|
90
145
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
<div style="min-width: 600px">
|
|
96
|
-
<form action="./update" method="post">
|
|
97
|
-
|
|
98
|
-
<div class="form-group" style="width: 490px;">
|
|
99
|
-
<label for="proxy_url">Webhook Endpoint
|
|
100
|
-
<span style="margin-left: 10px;">
|
|
101
|
-
<i class="fa fa-question-circle custom-tooltip" style="color: #337ab7;">
|
|
102
|
-
<span class="custom-tooltiptext">This is the endpoint to be reached by WhatsApp. Copy it to the Facebook Developer console in "Callback URL" in Whatsapp Configuration. See documention for more info.</span>
|
|
103
|
-
</i>
|
|
104
|
-
</span>
|
|
105
|
-
</label>
|
|
106
|
-
<!--<p style="margin-bottom: 5px; font-size: 12px; color: #a7a7a7;">Copy this URL in the Facebook Developer Dashboad. See documentation for more info.</p> -->
|
|
107
|
-
<div style="display: flex; flex-direction: row; justify-content: space-between">
|
|
108
|
-
<div style="width: 400px;">
|
|
109
|
-
<input type="text" readonly class="form-control" name="proxy_url" id="proxy_url"
|
|
110
|
-
value="{{ proxy_url}}">
|
|
111
|
-
</div>
|
|
112
|
-
<div style="width: 80px;">
|
|
113
|
-
<!--
|
|
114
|
-
<input type="button" class="btn btn-primary" style="width: 100%;"
|
|
115
|
-
onclick="copyTextToClipboard(this, document.getElementById('proxy_url').value)"
|
|
116
|
-
value="Copy"></input>
|
|
117
|
-
-->
|
|
118
|
-
<input type="button" id="copy-btn" class="btn btn-primary" style="width: 100%;"
|
|
119
|
-
onclick="copyTextToClipboard()"
|
|
120
|
-
value="Copy"></input>
|
|
121
|
-
</div>
|
|
146
|
+
<!-- CONFIGURE BOX -->
|
|
147
|
+
<div class="configure-box">
|
|
148
|
+
<div class="configure">
|
|
149
|
+
<p class="title" style="margin-bottom: 20px;">Your Configuration</p>
|
|
122
150
|
|
|
151
|
+
<div style="min-width: 600px">
|
|
152
|
+
<form action="./update" method="post">
|
|
153
|
+
<div class="form-group" style="width: 590px;">
|
|
154
|
+
<label class="input-label" for="proxy_url">Webhook Endpoint</label>
|
|
155
|
+
<div style="display: flex; flex-direction: row;">
|
|
156
|
+
<div style="width: 522px;">
|
|
157
|
+
<div style="display: flex; flex-direction: row; align-items: center;">
|
|
158
|
+
<input type="text" readonly class="form-control copy-form custom-input" name="proxy_url" id="proxy_url" value="{{ proxy_url}}">
|
|
159
|
+
<span style="margin-left: 10px;">
|
|
160
|
+
<i class="fa fa-question-circle custom-tooltip">
|
|
161
|
+
<span class="custom-tooltiptext">This is the endpoint to be reached by WhatsApp. Copy it to the Facebook Developer console in "Callback URL" in Whatsapp Configuration.</span>
|
|
162
|
+
</i>
|
|
163
|
+
</span>
|
|
164
|
+
|
|
123
165
|
</div>
|
|
166
|
+
|
|
124
167
|
</div>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
<label for="wab_token">Whatsapp Token
|
|
128
|
-
<span style="margin-left: 10px;">
|
|
129
|
-
<i class="fa fa-question-circle custom-tooltip" style="color: #337ab7;">
|
|
130
|
-
<span class="custom-tooltiptext">Paste it the permanent WhatsApp Business token. See documention for more info.</span>
|
|
131
|
-
</i>
|
|
132
|
-
</span>
|
|
133
|
-
</label>
|
|
134
|
-
<input type="text" class="form-control" name="wab_token" value="{{ wab_token }}"
|
|
135
|
-
placeholder="Enter the Whatsapp Token">
|
|
168
|
+
<div id="copy-div" class="icon-btn-div" onclick="copyTextToClipboard()">
|
|
169
|
+
<i class="fa fa-copy icon-btn"></i>
|
|
136
170
|
</div>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
<label for="verify_token">Verify Token
|
|
140
|
-
<span style="margin-left: 10px;">
|
|
141
|
-
<i class="fa fa-question-circle custom-tooltip" style="color: #337ab7;">
|
|
142
|
-
<span class="custom-tooltiptext">This is a verification token of your choice. Copy it to the Facebook Developer console in "Verify Token" in Whatsapp Configuration.
|
|
143
|
-
See documention for more info.</span>
|
|
144
|
-
</i>
|
|
145
|
-
</span>
|
|
146
|
-
</label>
|
|
147
|
-
<input type="password" class="form-control" name="verify_token" value="{{ verify_token }}"
|
|
148
|
-
placeholder="Enter your Verify Token">
|
|
171
|
+
<div id="copied-div" class="icon-btn-div" style="visibility: hidden;">
|
|
172
|
+
<i class="fa fa-check icon-btn" style="margin-left: -74px; color: green;"></i>
|
|
149
173
|
</div>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
150
176
|
|
|
151
|
-
|
|
152
|
-
|
|
177
|
+
<!-- Whatsapp Token -->
|
|
178
|
+
<div class="form-group" style="width: 522px;">
|
|
179
|
+
<label class="input-label" for="wab_token">Whatsapp Token
|
|
180
|
+
</label>
|
|
181
|
+
<div style="display: flex; flex-direction: row; align-items: center;">
|
|
182
|
+
<input type="text" required class="form-control custom-input" name="wab_token" value="{{ wab_token }}" placeholder="Enter the Whatsapp Token">
|
|
183
|
+
<span style="margin-left: 10px;">
|
|
184
|
+
<i class="fa fa-question-circle custom-tooltip">
|
|
185
|
+
<span class="custom-tooltiptext">This is the permanent WhatsApp Business token.</span>
|
|
186
|
+
</i>
|
|
187
|
+
</span>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
153
190
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
191
|
+
<!-- Verify Token -->
|
|
192
|
+
<div class="form-group" style="width: 522px;">
|
|
193
|
+
<label class="input-label" for="verify_token">Verify Token</label>
|
|
194
|
+
<div style="display: flex; flex-direction: row; align-items: center;">
|
|
195
|
+
<input type="password" required class="form-control custom-input" name="verify_token" value="{{ verify_token }}" placeholder="Enter your Verify Token">
|
|
196
|
+
<span style="margin-left: 10px;">
|
|
197
|
+
<i class="fa fa-question-circle custom-tooltip">
|
|
198
|
+
<span class="custom-tooltiptext">Choose the verification token end copy it to the Facebook Developer console in "Verify Token" in Whatsapp Configuration</span>
|
|
199
|
+
</i>
|
|
200
|
+
</span>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
163
203
|
|
|
164
|
-
|
|
204
|
+
<input type="hidden" name="project_id" value="{{ project_id }}" />
|
|
205
|
+
<input type="hidden" name="token" value="{{ token }}" />
|
|
165
206
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
207
|
+
{{#if wab_token}}
|
|
208
|
+
<div style="width: 500px; text-align: right;">
|
|
209
|
+
<input type="submit" class="btn" style="width: 200px; background-color: #0ba2dc; color: white; font-weight: 500;" value="Update">
|
|
210
|
+
</div>
|
|
211
|
+
{{else}}
|
|
212
|
+
<div style="width: 500px; text-align: right;">
|
|
213
|
+
<input type="submit" class="btn" style="width: 200px; background-color: #0ba2dc; color: white; font-weight: 500;" value="Connect">
|
|
214
|
+
</div>
|
|
215
|
+
{{/if}}
|
|
216
|
+
</form>
|
|
217
|
+
</div>
|
|
171
218
|
|
|
219
|
+
|
|
220
|
+
|
|
172
221
|
</div>
|
|
173
222
|
</div>
|
|
174
223
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
224
|
+
|
|
225
|
+
<div class="disconnect-box">
|
|
226
|
+
<div class="disconnect">
|
|
227
|
+
<p class="title" style="margin-bottom: 20px;"> Disconnect</p>
|
|
228
|
+
|
|
229
|
+
<!-- Disconnect Button -->
|
|
230
|
+
{{#if wab_token}}
|
|
231
|
+
<div>
|
|
232
|
+
<p style="color: rgb(140, 140, 140);">The WhatsApp Business App is configured on your Tildesk project.</p>
|
|
233
|
+
<p>By clicking on disconnect you will no longer be able to receive messages from the WhatsApp channel</p>
|
|
234
|
+
<form action="./disconnect" method="post">
|
|
235
|
+
<input type="hidden" name="project_id" value="{{ project_id }}">
|
|
236
|
+
<input type="hidden" name="token" value="{{ token }}">
|
|
237
|
+
<input type="hidden" name="subscription_id" value="{{ subscription_id }}">
|
|
238
|
+
<input type="submit" class="btn disconnect-button" style="margin-top: 10px; width: 160px;" value="Disconnect">
|
|
239
|
+
</form>
|
|
240
|
+
</div>
|
|
241
|
+
{{else}}
|
|
242
|
+
<!-- App not configured -->
|
|
243
|
+
<p style="color: rgb(140, 140, 140);">The WhatsApp Business App is not yet configured on your Tildesk project.</p>
|
|
244
|
+
{{/if}}
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
<!--
|
|
250
|
+
<div class="version-box">
|
|
251
|
+
<div class="version">
|
|
252
|
+
<p class="version-title">App version: </p>
|
|
253
|
+
<div class="status-box" style="padding: 0px 20px; letter-spacing: 1px; height: 30px;">
|
|
254
|
+
<p style="margin-bottom: 0px;">{{ app_version }}</p>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
-->
|
|
191
259
|
|
|
260
|
+
<script>
|
|
261
|
+
|
|
192
262
|
function copyTextToClipboard() {
|
|
193
263
|
const proxyUrl = document.getElementById('proxy_url').select()
|
|
194
264
|
|
|
@@ -196,15 +266,18 @@
|
|
|
196
266
|
try {
|
|
197
267
|
document.execCommand('copy');
|
|
198
268
|
console.log('Async: Copied to clipboard!');
|
|
199
|
-
let
|
|
200
|
-
|
|
269
|
+
let el1 = document.getElementById('copy-div');
|
|
270
|
+
el1.style.visibility = 'hidden';
|
|
271
|
+
|
|
272
|
+
let el2 = document.getElementById('copied-div');
|
|
273
|
+
el2.style.visibility = 'visible';
|
|
274
|
+
|
|
275
|
+
//let btn = document.getElementById('copy-btn');
|
|
276
|
+
//btn.value = "Copied!";
|
|
201
277
|
} catch (err) {
|
|
202
278
|
console.error('Async: Could not copy text: ', err);
|
|
203
279
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
280
|
+
}
|
|
207
281
|
</script>
|
|
208
282
|
|
|
209
|
-
|
|
210
|
-
</body>
|
|
283
|
+
</body>
|