@tiledesk/tiledesk-whatsapp-connector 0.1.44 → 0.1.46

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
@@ -21,6 +21,7 @@ const { TiledeskChannel } = require('./tiledesk/TiledeskChannel');
21
21
  const { TiledeskAppsClient } = require('./tiledesk/TiledeskAppsClient');
22
22
  const { MessageHandler } = require('./tiledesk/MessageHandler');
23
23
  const { TiledeskBotTester } = require('./tiledesk/TiledeskBotTester');
24
+ const { TemplateManager } = require('./tiledesk/TemplateManager');
24
25
 
25
26
  // mongo
26
27
  const { KVBaseMongo } = require('./tiledesk/KVBaseMongo');
@@ -58,6 +59,10 @@ handlebars.registerHelper('isEqual', (a, b) => {
58
59
  }
59
60
  })
60
61
 
62
+ handlebars.registerHelper('json', (a) => {
63
+ return JSON.stringify(a);
64
+ })
65
+
61
66
  router.get('/', async (req, res) => {
62
67
  res.send('Welcome to Tiledesk-WhatsApp Business connector!')
63
68
  })
@@ -73,6 +78,9 @@ router.get('/detail', async (req, res) => {
73
78
  const tdChannel = new TiledeskChannel({ settings: { project_id: project_id, token: token }, API_URL: API_URL })
74
79
  let isAvailable = await tdChannel.getProjectDetail();
75
80
  winston.debug("(wab) app is available: ", isAvailable);
81
+ if (!project_id || !token || !app_id) {
82
+ return res.status(500).send("<p>Ops! An error occured.</p><p>Missing query params! project_id, token and app_id are required.</p>")
83
+ }
76
84
 
77
85
  const appClient = new TiledeskAppsClient({ APPS_API_URL: APPS_API_URL });
78
86
  let installation = await appClient.getInstallations(project_id, app_id);
@@ -204,6 +212,7 @@ router.get('/configure', async (req, res) => {
204
212
  proxy_url: proxy_url,
205
213
  wab_token: settings.wab_token,
206
214
  verify_token: settings.verify_token,
215
+ business_account_id: settings.business_account_id,
207
216
  subscription_id: settings.subscriptionId,
208
217
  department_id: settings.department_id,
209
218
  departments: departments
@@ -242,19 +251,20 @@ router.post('/update', async (req, res) => {
242
251
 
243
252
  winston.verbose("(wab) /update");
244
253
 
245
- let projectId = req.body.project_id;
254
+ let project_id = req.body.project_id;
246
255
  let token = req.body.token;
247
256
  let wab_token = req.body.wab_token;
248
257
  let verify_token = req.body.verify_token;
249
258
  let department_id = req.body.department;
259
+ let business_account_id = req.body.business_account_id;
250
260
 
251
- let CONTENT_KEY = "whatsapp-" + projectId;
261
+ let CONTENT_KEY = "whatsapp-" + project_id;
252
262
  let settings = await db.get(CONTENT_KEY);
253
263
 
254
- let proxy_url = BASE_URL + "/webhook/" + projectId;
264
+ let proxy_url = BASE_URL + "/webhook/" + project_id;
255
265
 
256
266
  // get departments
257
- const tdChannel = new TiledeskChannel({ settings: { project_id: projectId, token: token }, API_URL: API_URL })
267
+ const tdChannel = new TiledeskChannel({ settings: { project_id: project_id, token: token }, API_URL: API_URL })
258
268
  let departments = await tdChannel.getDepartments(token);
259
269
 
260
270
  if (settings) {
@@ -262,6 +272,7 @@ router.post('/update', async (req, res) => {
262
272
  settings.wab_token = wab_token;
263
273
  settings.verify_token = verify_token;
264
274
  settings.department_id = department_id;
275
+ settings.business_account_id = business_account_id;
265
276
 
266
277
  await db.set(CONTENT_KEY, settings);
267
278
 
@@ -269,12 +280,13 @@ router.post('/update', async (req, res) => {
269
280
  var template = handlebars.compile(html);
270
281
  var replacements = {
271
282
  app_version: pjson.version,
272
- project_id: projectId,
283
+ project_id: project_id,
273
284
  token: token,
274
285
  proxy_url: proxy_url,
275
286
  wab_token: settings.wab_token,
276
287
  show_success_modal: true,
277
288
  verify_token: settings.verify_token,
289
+ business_account_id: settings.business_account_id,
278
290
  subscription_id: settings.subscriptionId,
279
291
  department_id: settings.department_id,
280
292
  departments: departments
@@ -285,7 +297,7 @@ router.post('/update', async (req, res) => {
285
297
 
286
298
  } else {
287
299
 
288
- const tdClient = new TiledeskSubscriptionClient({ API_URL: API_URL, project_id: projectId, token: token })
300
+ const tdClient = new TiledeskSubscriptionClient({ API_URL: API_URL, project_id: project_id, token: token })
289
301
 
290
302
  const subscription_info = {
291
303
  target: BASE_URL + "/tiledesk",
@@ -294,7 +306,7 @@ router.post('/update', async (req, res) => {
294
306
 
295
307
  /*
296
308
  // callback
297
- await tdClient.subscribe(projectId, data, (err, data) => {
309
+ await tdClient.subscribe(project_id, data, (err, data) => {
298
310
  // code here
299
311
  })
300
312
  */
@@ -305,13 +317,14 @@ router.post('/update', async (req, res) => {
305
317
  winston.debug("\n(wab) Subscription: " + subscription)
306
318
 
307
319
  let settings = {
308
- project_id: projectId,
320
+ project_id: project_id,
309
321
  token: token,
310
322
  proxy_url: proxy_url,
311
323
  subscriptionId: subscription._id,
312
324
  secret: subscription.secret,
313
325
  wab_token: wab_token,
314
326
  verify_token: verify_token,
327
+ business_account_id: business_account_id,
315
328
  department_id: department_id
316
329
  }
317
330
 
@@ -322,12 +335,13 @@ router.post('/update', async (req, res) => {
322
335
  var template = handlebars.compile(html);
323
336
  var replacements = {
324
337
  app_version: pjson.version,
325
- project_id: projectId,
338
+ project_id: project_id,
326
339
  token: token,
327
340
  proxy_url: proxy_url,
328
341
  show_success_modal: true,
329
342
  wab_token: settings.wab_token,
330
343
  verify_token: settings.verify_token,
344
+ business_account_id: settings.business_account_id,
331
345
  subscription_id: settings.subscriptionId,
332
346
  department_id: settings.department_id,
333
347
  departments: departments
@@ -342,7 +356,7 @@ router.post('/update', async (req, res) => {
342
356
  var template = handlebars.compile(html);
343
357
  var replacements = {
344
358
  app_version: pjson.version,
345
- project_id: projectId,
359
+ project_id: project_id,
346
360
  token: token,
347
361
  proxy_url: proxy_url,
348
362
  departments: departments,
@@ -360,25 +374,25 @@ router.post('/disconnect', async (req, res) => {
360
374
 
361
375
  winston.verbose("(wab) /disconnect")
362
376
 
363
- let projectId = req.body.project_id;
377
+ let project_id = req.body.project_id;
364
378
  let token = req.body.token;
365
379
  let subscriptionId = req.body.subscription_id;
366
380
 
367
381
 
368
- let CONTENT_KEY = "whatsapp-" + projectId;
382
+ let CONTENT_KEY = "whatsapp-" + project_id;
369
383
  await db.remove(CONTENT_KEY);
370
384
  winston.verbose("(wab) Content deleted.");
371
385
 
372
- let proxy_url = BASE_URL + "/webhook/" + projectId;
386
+ let proxy_url = BASE_URL + "/webhook/" + project_id;
373
387
 
374
- const tdClient = new TiledeskSubscriptionClient({ API_URL: API_URL, project_id: projectId, token: token })
388
+ const tdClient = new TiledeskSubscriptionClient({ API_URL: API_URL, project_id: project_id, token: token })
375
389
  // get departments
376
- const tdChannel = new TiledeskChannel({ settings: { project_id: projectId, token: token }, API_URL: API_URL })
390
+ const tdChannel = new TiledeskChannel({ settings: { project_id: project_id, token: token }, API_URL: API_URL })
377
391
  let departments = await tdChannel.getDepartments(token);
378
392
 
379
393
  /*
380
394
  // callback
381
- tdClient.unsubsribe(projectId, subscriptionId, (err, data) => {
395
+ tdClient.unsubsribe(project_id, subscriptionId, (err, data) => {
382
396
  // code here
383
397
  })
384
398
  */
@@ -389,7 +403,7 @@ router.post('/disconnect', async (req, res) => {
389
403
  var template = handlebars.compile(html);
390
404
  var replacements = {
391
405
  app_version: pjson.version,
392
- project_id: projectId,
406
+ project_id: project_id,
393
407
  token: token,
394
408
  proxy_url: proxy_url,
395
409
  departments: departments
@@ -404,14 +418,62 @@ router.post('/disconnect', async (req, res) => {
404
418
 
405
419
  })
406
420
 
421
+ router.get('/direct/tiledesk', async (req, res) => {
422
+
423
+ winston.verbose("/direct/tiledesk")
424
+
425
+ let project_id = req.query.project_id;
426
+ let whatsapp_receiver = req.query.whatsapp_receiver;
427
+ let phone_number_id = req.query.phone_number_id;
428
+
429
+ let CONTENT_KEY = "whatsapp-" + project_id;
430
+ let settings = await db.get(CONTENT_KEY);
431
+
432
+ /*
433
+ let tiledeskChannelMessage = {
434
+ text: "Ciao, benvenuto sull'ambiente di sviluppo di Tiledesk! Questo messaggio serve ad aprire una nuova conversazione. Ha funzionato?"
435
+ }
436
+ */
437
+
438
+ let tiledeskChannelMessage = {
439
+ text: "Sample text",
440
+ attributes: {
441
+ attachment: {
442
+ type: "wa_template",
443
+ template: {
444
+ language: "en_US",
445
+ name: "hello_world"
446
+ }
447
+ }
448
+ }
449
+ }
450
+ const tlr = new TiledeskWhatsappTranslator();
451
+ const twClient = new TiledeskWhatsapp({ token: settings.wab_token, GRAPH_URL: GRAPH_URL });
452
+
453
+ let whatsappJsonMessage = await tlr.toWhatsapp(tiledeskChannelMessage, whatsapp_receiver);
454
+ winston.verbose("(wab) whatsappJsonMessage", whatsappJsonMessage)
455
+
456
+ twClient.sendMessage(phone_number_id, whatsappJsonMessage).then((response) => {
457
+ winston.verbose("(wab) Message sent to WhatsApp! " + response.status + " " + response.statusText);
458
+ }).catch((err) => {
459
+ return res.status(400).send({success: false, error: err});
460
+ winston.error("(wab) error send message: " + err);
461
+ })
462
+
463
+ res.status(200).send("Message sent");
464
+
465
+ })
466
+
407
467
  router.post('/tiledesk', async (req, res) => {
468
+
408
469
  winston.verbose("(wab) Message received from Tiledesk")
409
470
 
410
471
  var tiledeskChannelMessage = req.body.payload;
411
- var projectId = req.body.payload.id_project;
472
+ winston.verbose("(wab) tiledeskChannelMessage: ", tiledeskChannelMessage)
473
+ var project_id = req.body.payload.id_project;
412
474
 
413
475
  // get settings from mongo
414
- let CONTENT_KEY = "whatsapp-" + projectId;
476
+ let CONTENT_KEY = "whatsapp-" + project_id;
415
477
  let settings = await db.get(CONTENT_KEY);
416
478
  let wab_token = settings.wab_token;
417
479
 
@@ -440,19 +502,57 @@ router.post('/tiledesk', async (req, res) => {
440
502
  }
441
503
 
442
504
  let recipient_id = tiledeskChannelMessage.recipient;
505
+ let sender = tiledeskChannelMessage.sender;
443
506
  let whatsapp_receiver = recipient_id.substring(recipient_id.lastIndexOf("-") + 1);
444
507
  let phone_number_id = recipient_id.substring(recipient_id.lastIndexOf("wab-") + 4, recipient_id.lastIndexOf("-"));
445
508
 
509
+ /*
510
+ if (settings.expired &&
511
+ settings.expired === true) {
512
+ winston.info("settings expired: " + settings.expired);
513
+ return res.status(200).send({ success: 'false', message: "plan expired"})
514
+
515
+ */
516
+
517
+ // Return an info message option
518
+ if (settings.expired &&
519
+ settings.expired === true) {
520
+
521
+ winston.verbose("settings expired: " + settings.expired);
522
+ let tiledeskJsonMessage = {
523
+ text: 'Expired. Upgrade Plan.',
524
+ sender: sender,
525
+ senderFullname: "System",
526
+ attributes: {
527
+ subtype: 'info'
528
+ },
529
+ channel: { name: 'whatsapp' }
530
+ }
531
+ let message_info = {
532
+ channel: "whatsapp",
533
+ whatsapp: {
534
+ from: whatsapp_receiver,
535
+ phone_number_id: phone_number_id
536
+ }
537
+ }
538
+
539
+ const tdChannel = new TiledeskChannel({ settings: settings, API_URL: API_URL })
540
+ const response = await tdChannel.send(tiledeskJsonMessage, message_info, settings.department_id);
541
+ winston.verbose("(wab) Expiration message sent to Tiledesk")
542
+ return res.sendStatus(200);
543
+ }
544
+
446
545
  winston.debug("(wab) text: " + text);
447
546
  winston.debug("(wab) attributes: " + attributes)
448
547
  winston.debug("(wab) tiledesk sender_id: " + sender_id);
449
548
  winston.debug("(wab) recipient_id: " + recipient_id);
450
549
  winston.debug("(wab) whatsapp_receiver: " + whatsapp_receiver);
451
- winston.debug("(wab) phone_number_id: " + phone_number_id)
550
+ winston.debug("(wab) phone_number_id: " + phone_number_id);
452
551
 
453
552
  const messageHandler = new MessageHandler({ tiledeskChannelMessage: tiledeskChannelMessage });
454
553
  const tlr = new TiledeskWhatsappTranslator();
455
554
 
555
+
456
556
  if (commands) {
457
557
  let i = 0;
458
558
  async function execute(command) {
@@ -462,7 +562,7 @@ router.post('/tiledesk', async (req, res) => {
462
562
  winston.debug("(wab) message generated from command: " + tiledeskCommandMessage)
463
563
 
464
564
  let whatsappJsonMessage = await tlr.toWhatsapp(tiledeskCommandMessage, whatsapp_receiver);
465
- winston.verbose("(wab) 🟢 whatsappJsonMessage" + whatsappJsonMessage)
565
+ winston.verbose("(wab) whatsappJsonMessage", whatsappJsonMessage)
466
566
 
467
567
  if (whatsappJsonMessage) {
468
568
  const twClient = new TiledeskWhatsapp({ token: settings.wab_token, GRAPH_URL: GRAPH_URL });
@@ -509,10 +609,12 @@ router.post('/tiledesk', async (req, res) => {
509
609
  twClient.sendMessage(phone_number_id, whatsappJsonMessage).then((response) => {
510
610
  winston.verbose("(wab) Message sent to WhatsApp! " + response.status + " " + response.statusText);
511
611
  }).catch((err) => {
612
+ res.status(400).send({success: false, error: "il template non esiste"});
512
613
  winston.error("(wab) error send message: " + err);
513
614
  })
514
615
 
515
616
  } else {
617
+ res.status(400).send({success: false, error: "il template non esiste"});
516
618
  winston.error("(wab) Whatsapp Json Message is undefined!")
517
619
  }
518
620
 
@@ -528,7 +630,7 @@ router.post('/tiledesk', async (req, res) => {
528
630
  router.post("/webhook/:project_id", async (req, res) => {
529
631
 
530
632
  // Parse the request body from the POST
531
- let projectId = req.params.project_id;
633
+ let project_id = req.params.project_id;
532
634
  winston.verbose("(wab) Message received from WhatsApp");
533
635
 
534
636
  // Check the Incoming webhook message
@@ -549,7 +651,7 @@ router.post("/webhook/:project_id", async (req, res) => {
549
651
 
550
652
  let whatsappChannelMessage = req.body.entry[0].changes[0].value.messages[0];
551
653
 
552
- let CONTENT_KEY = "whatsapp-" + projectId;
654
+ let CONTENT_KEY = "whatsapp-" + project_id;
553
655
  let settings = await db.get(CONTENT_KEY);
554
656
  winston.debug("(wab) settings: " + settings);
555
657
 
@@ -566,7 +668,7 @@ router.post("/webhook/:project_id", async (req, res) => {
566
668
 
567
669
  let code = whatsappChannelMessage.text.body.split(' ')[0];
568
670
 
569
- const bottester = new TiledeskBotTester({ project_id: projectId, redis_client: redis_client, db: db, tdChannel: tdChannel, tlr: tlr });
671
+ const bottester = new TiledeskBotTester({ project_id: project_id, redis_client: redis_client, db: db, tdChannel: tdChannel, tlr: tlr });
570
672
  bottester.startBotConversation(req.body, code).then((result) => {
571
673
  winston.verbose("(wab) test conversation started");
572
674
  winston.debug("(wab) startBotConversation result: " + result);
@@ -601,7 +703,7 @@ router.post("/webhook/:project_id", async (req, res) => {
601
703
  tiledeskJsonMessage = await tlr.toTiledesk(whatsappChannelMessage, firstname);
602
704
  }
603
705
 
604
- else if ((whatsappChannelMessage.type == 'image') || (whatsappChannelMessage.type == 'video') || (whatsappChannelMessage.type == 'document')) {
706
+ else if ((whatsappChannelMessage.type == 'image') || (whatsappChannelMessage.type == 'video') || (whatsappChannelMessage.type == 'document') || (whatsappChannelMessage.type == 'audio')) {
605
707
  let media;
606
708
  const util = new TiledeskWhatsapp({ token: settings.wab_token, GRAPH_URL: GRAPH_URL })
607
709
 
@@ -652,13 +754,29 @@ router.post("/webhook/:project_id", async (req, res) => {
652
754
  tiledeskJsonMessage = await tlr.toTiledesk(whatsappChannelMessage, firstname, media_url);
653
755
  }
654
756
 
757
+ if (whatsappChannelMessage.type == 'audio') {
758
+ media = whatsappChannelMessage.audio;
759
+
760
+ const filename = await util.downloadMedia(media.id);
761
+ if (!filename) {
762
+ winston.debug("(wab) Unable to download media with id " + media.id + ". Message not sent.");
763
+ return res.status(500).send({ success: false, error: "unable to download media" })
764
+ }
765
+ let file_path = path.join(__dirname, 'tmp', filename);
766
+
767
+ const media_url = await util.uploadMedia(file_path, "files");
768
+ winston.debug("(wab) media_url: " + media_url)
769
+
770
+ tiledeskJsonMessage = await tlr.toTiledesk(whatsappChannelMessage, firstname, media_url);
771
+ }
772
+
655
773
  } else {
656
774
  // unsupported. Try anyway to send something.
657
775
  winston.debug("(wab) unsupported message")
658
776
  }
659
777
 
660
778
  if (tiledeskJsonMessage) {
661
- winston.verbose("(wab) 🟠 tiledeskJsonMessage: " + tiledeskJsonMessage);
779
+ winston.verbose("(wab) tiledeskJsonMessage: ", tiledeskJsonMessage);
662
780
  const response = await tdChannel.send(tiledeskJsonMessage, message_info, settings.department_id);
663
781
  winston.verbose("(wab) Message sent to Tiledesk!")
664
782
  winston.debug("(wab) response: " + response)
@@ -683,7 +801,7 @@ router.get("/webhook/:project_id", async (req, res) => {
683
801
  /**
684
802
  * UPDATE YOUR VERIFY TOKEN
685
803
  *This will be the Verify Token value when you set up webhook
686
- **/
804
+ */
687
805
  winston.verbose("(wab) Verify the webhook... ");
688
806
  winston.debug("(wab) req.query: " + req.query);
689
807
 
@@ -756,6 +874,117 @@ router.post("/newtest", async (req, res) => {
756
874
 
757
875
  })
758
876
 
877
+ router.get('/templates/detail', async (req, res) => {
878
+
879
+ let project_id = req.query.project_id;
880
+ let token = req.query.token;
881
+ let app_id = req.query.app_id;
882
+ let template_id = req.query.id_template;
883
+ winston.debug("get template_id: " + template_id);
884
+
885
+ let CONTENT_KEY = "whatsapp-" + project_id;
886
+ let settings = await db.get(CONTENT_KEY);
887
+ winston.debug("(wab) settings: ", settings);
888
+
889
+ if (settings) {
890
+ // forse non serve, comunque non si può prendere un singolo template
891
+ /*
892
+ let tm = new TemplateManager({ token: settings.wab_token, business_account_id: settings.business_account_id, GRAPH_URL: GRAPH_URL })
893
+ let templates_info = await tm.getTemplateNamespace();
894
+ let namespace = templates_info.message_template_namespace;
895
+ let template = await tm.getTemplateById(namespace);
896
+ */
897
+ let tm = new TemplateManager({ token: settings.wab_token, business_account_id: settings.business_account_id, GRAPH_URL: GRAPH_URL })
898
+ let templates = await tm.getTemplates();
899
+ let template = JSON.parse(JSON.stringify(templates.data.find(t => t.id === template_id)));
900
+ let template_name = template.name;
901
+
902
+ let template_copy = {
903
+ name: template.name,
904
+ components: template.components,
905
+ language: template.language,
906
+ status: template.status,
907
+ id: template.id,
908
+ category: template.category
909
+ }
910
+
911
+ readHTMLFile('/template_detail.html', (err, html) => {
912
+ var template = handlebars.compile(html);
913
+ var replacements = {
914
+ app_version: pjson.version,
915
+ project_id: project_id,
916
+ token: token,
917
+ app_id: app_id,
918
+ name: template_name,
919
+ template: template_copy
920
+ }
921
+ var html = template(replacements);
922
+ res.send(html);
923
+ })
924
+
925
+ } else {
926
+ return res.send("whatsapp not installed on this project")
927
+ }
928
+ })
929
+
930
+ router.get("/templates/:project_id", async (req, res) => {
931
+ winston.verbose("(wab) /templates");
932
+
933
+ let project_id = req.params.project_id;
934
+ let token = req.query.token;
935
+ let app_id = req.query.app_id;
936
+
937
+ let CONTENT_KEY = "whatsapp-" + project_id;
938
+ let settings = await db.get(CONTENT_KEY);
939
+ winston.debug("(wab) settings: ", settings);
940
+
941
+ if (settings) {
942
+ let tm = new TemplateManager({ token: settings.wab_token, business_account_id: settings.business_account_id, GRAPH_URL: GRAPH_URL })
943
+ let templates = await tm.getTemplates();
944
+
945
+ readHTMLFile('/templates.html', (err, html) => {
946
+ var template = handlebars.compile(html);
947
+ var replacements = {
948
+ app_version: pjson.version,
949
+ project_id: project_id,
950
+ token: token,
951
+ app_id: app_id,
952
+ templates: templates.data
953
+ }
954
+ var html = template(replacements);
955
+ res.send(html);
956
+ })
957
+ } else {
958
+ winston.verbose("No settings found.")
959
+ return res.status(404).send({ success: false, error: "whatsapp not installed for the project id " + project_id });
960
+ }
961
+
962
+ })
963
+
964
+ router.get("/ext/templates/:project_id", async (req, res) => {
965
+ winston.verbose("(wab) /ext/templates");
966
+
967
+ let project_id = req.params.project_id;
968
+
969
+ let CONTENT_KEY = "whatsapp-" + project_id;
970
+ let settings = await db.get(CONTENT_KEY);
971
+
972
+ if (settings) {
973
+ let tm = new TemplateManager({ token: settings.wab_token, business_account_id: settings.business_account_id, GRAPH_URL: GRAPH_URL })
974
+ let templates = await tm.getTemplates();
975
+
976
+ if (templates) {
977
+ res.status(200).send(templates.data);
978
+ } else {
979
+ res.status(500).send({ success: false, code: '02', message: "a problem occurred while getting templates from whatsapp" })
980
+ }
981
+
982
+ } else {
983
+ res.status(400).send({ success: false, code: '01', message: "whatsapp not installed for the project_id " + project_id })
984
+ }
985
+
986
+ })
987
+
759
988
  // *****************************
760
989
  // ********* FUNCTIONS *********
761
990
  // *****************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-whatsapp-connector",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
4
4
  "description": "Tiledesk Whatsapp connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,7 +25,7 @@
25
25
  </script>
26
26
 
27
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">
28
+ <link rel="stylesheet" href="/css/configure.css">
29
29
 
30
30
  <style>
31
31
  body {
@@ -87,11 +87,29 @@
87
87
  {{/if}}
88
88
  </div>
89
89
  </div>
90
+
90
91
  </div>
91
92
 
93
+
94
+
95
+
92
96
  <!-- INFO BOX -->
93
97
  <div class="info-box">
98
+
94
99
  <div class="info-list">
100
+ <!--
101
+ <div style="margin-bottom:20px;">
102
+ {{#if wab_token}}
103
+ <form action="./templates/{{project_id}}" method="get">
104
+ <input type="hidden" name="project_id" value="{{ project_id }}" />
105
+ <input type="hidden" name="app_id" value="{{ app_id }}" />
106
+ <input type="hidden" name="token" value="{{ token }}" />
107
+ <input type="submit" class="btn install-button" value="Manage Templates">
108
+ </form>
109
+ {{/if}}
110
+ </div>
111
+ -->
112
+
95
113
  <ul>
96
114
  <div class="list-element">
97
115
  <img src="https://cdn-icons-png.flaticon.com/512/1443/1443000.png" width=20 height=20 style="margin-right: 10px;"/>
@@ -202,6 +220,19 @@
202
220
  </div>
203
221
  </div>
204
222
 
223
+ <!-- WhatsApp Business Account ID -->
224
+ <div class="form-group" style="width: 522px;">
225
+ <label class="input-label" for="verify_token">WhatsApp Business Account ID</label>
226
+ <div style="display: flex; flex-direction: row; align-items: center;">
227
+ <input type="text" required class="form-control custom-input" name="business_account_id" value="{{ business_account_id }}" placeholder="Enter your Business Account ID">
228
+ <span style="margin-left: 10px;">
229
+ <i class="fa fa-question-circle custom-tooltip">
230
+ <span class="custom-tooltiptext">This is the WhatsApp Business Account ID that can be found in Whatsapp Getting Started on the Facebook Developer console.</span>
231
+ </i>
232
+ </span>
233
+ </div>
234
+ </div>
235
+
205
236
  <!-- Departments -->
206
237
  <div class="form-group" style="width: 522px;">
207
238
  <label class="input-label" for="department">Department <span style="font-weight: normal;">(Optional)</span></label>