@dawntech/blip-tools 0.6.1 → 0.7.0
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/dist/exceptions/index.d.ts +1 -4
- package/dist/index.cjs +134 -14
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +133 -14
- package/dist/modules/blip-campaign.d.ts +15 -0
- package/dist/modules/blip-contact.d.ts +5 -0
- package/dist/modules/blip-dispatch.d.ts +9 -8
- package/dist/modules/blip-main.d.ts +4 -0
- package/dist/modules/blip-threads.d.ts +18 -0
- package/dist/modules/blip-ticket.d.ts +3 -3
- package/dist/modules/index.d.ts +2 -1
- package/dist/types/campaign.d.ts +14 -0
- package/dist/types/campaing-request.d.ts +1 -0
- package/dist/types/contact.d.ts +2 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/threads.d.ts +13 -0
- package/package.json +1 -1
- package/dist/types/ticket-search-result.d.ts +0 -21
package/dist/index.cjs
CHANGED
|
@@ -40,7 +40,6 @@ function handleError(error) {
|
|
|
40
40
|
if (error.response?.data.code) {
|
|
41
41
|
throw new BlipError(error.response?.data.description, error.response?.data.code);
|
|
42
42
|
}
|
|
43
|
-
throw new BlipError(error.message, 0);
|
|
44
43
|
}
|
|
45
44
|
throw error;
|
|
46
45
|
}
|
|
@@ -204,6 +203,14 @@ class BlipAttendance {
|
|
|
204
203
|
}
|
|
205
204
|
}
|
|
206
205
|
|
|
206
|
+
function createUri(url, params) {
|
|
207
|
+
const encodedParams = encodeBlipParams(params);
|
|
208
|
+
if (encodedParams) {
|
|
209
|
+
return `${url}?${encodedParams}`;
|
|
210
|
+
}
|
|
211
|
+
return url;
|
|
212
|
+
}
|
|
213
|
+
|
|
207
214
|
class BlipContact {
|
|
208
215
|
api;
|
|
209
216
|
constructor(context) {
|
|
@@ -243,6 +250,26 @@ class BlipContact {
|
|
|
243
250
|
throw handleError(error);
|
|
244
251
|
}
|
|
245
252
|
}
|
|
253
|
+
async search({ filter, skip, take } = {}) {
|
|
254
|
+
const params = {
|
|
255
|
+
$filter: filter,
|
|
256
|
+
$skip: skip,
|
|
257
|
+
$take: take,
|
|
258
|
+
};
|
|
259
|
+
try {
|
|
260
|
+
const response = await this.api.post('/commands', {
|
|
261
|
+
id: crypto.randomUUID(),
|
|
262
|
+
to: 'postmaster@crm.msging.net',
|
|
263
|
+
method: 'get',
|
|
264
|
+
uri: createUri('/contacts', params),
|
|
265
|
+
});
|
|
266
|
+
validateResponse(response);
|
|
267
|
+
return response.data.resource.items;
|
|
268
|
+
}
|
|
269
|
+
catch (error) {
|
|
270
|
+
throw handleError(error);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
246
273
|
}
|
|
247
274
|
|
|
248
275
|
class BlipContext {
|
|
@@ -313,7 +340,7 @@ class BlipDispatch {
|
|
|
313
340
|
/**
|
|
314
341
|
* Sends a template-based message to any user. For sending messages to clients who are active, use `sendTemplateMessage` instead.
|
|
315
342
|
*/
|
|
316
|
-
async sendIndividualActiveCampaign({ campaignName, masterState, flowId, stateId, channelType, phone, templateName, params = [], }) {
|
|
343
|
+
async sendIndividualActiveCampaign({ campaignName, masterState, flowId, stateId, channelType, phone, templateName, params = [], scheduled, }) {
|
|
317
344
|
const body = {
|
|
318
345
|
id: crypto.randomUUID(),
|
|
319
346
|
to: 'postmaster@activecampaign.msging.net',
|
|
@@ -328,9 +355,10 @@ class BlipDispatch {
|
|
|
328
355
|
flowId,
|
|
329
356
|
stateId,
|
|
330
357
|
channelType,
|
|
358
|
+
scheduled: scheduled?.toISOString(),
|
|
331
359
|
},
|
|
332
360
|
audience: {
|
|
333
|
-
recipient: `+${phone}`,
|
|
361
|
+
recipient: `+${phone.replace('+', '')}`,
|
|
334
362
|
},
|
|
335
363
|
message: {
|
|
336
364
|
messageTemplate: templateName,
|
|
@@ -390,7 +418,7 @@ class BlipDispatch {
|
|
|
390
418
|
/**
|
|
391
419
|
* Sends a simple text message to an active user. For sending messages to clients who have never interacted or are inactive, use `sendTemplate` instead.
|
|
392
420
|
*/
|
|
393
|
-
async sendSimpleMessage({ identity, content, metadata }) {
|
|
421
|
+
async sendSimpleMessage({ identity, content, metadata, }) {
|
|
394
422
|
try {
|
|
395
423
|
const response = await this.api.post('/messages', {
|
|
396
424
|
id: crypto.randomUUID(),
|
|
@@ -493,14 +521,6 @@ class BlipInteraction {
|
|
|
493
521
|
}
|
|
494
522
|
}
|
|
495
523
|
|
|
496
|
-
function createUri(url, params) {
|
|
497
|
-
const encodedParams = encodeBlipParams(params);
|
|
498
|
-
if (encodedParams) {
|
|
499
|
-
return `${url}?${encodedParams}`;
|
|
500
|
-
}
|
|
501
|
-
return url;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
524
|
class BlipTicket {
|
|
505
525
|
api;
|
|
506
526
|
constructor(context) {
|
|
@@ -582,10 +602,70 @@ class BlipWhatsapp {
|
|
|
582
602
|
}
|
|
583
603
|
}
|
|
584
604
|
|
|
585
|
-
|
|
605
|
+
class BlipCampaign {
|
|
606
|
+
api;
|
|
607
|
+
constructor(context) {
|
|
608
|
+
this.api = context.api;
|
|
609
|
+
}
|
|
610
|
+
async search({ filter, skip, take } = {}) {
|
|
611
|
+
try {
|
|
612
|
+
const params = {
|
|
613
|
+
$filter: filter,
|
|
614
|
+
$skip: skip,
|
|
615
|
+
$take: take,
|
|
616
|
+
};
|
|
617
|
+
const body = {
|
|
618
|
+
id: crypto.randomUUID(),
|
|
619
|
+
to: 'postmaster@activecampaign.msging.net',
|
|
620
|
+
method: 'get',
|
|
621
|
+
uri: createUri('/campaigns', params),
|
|
622
|
+
};
|
|
623
|
+
const response = await this.api.post('/commands', body);
|
|
624
|
+
validateResponse(response);
|
|
625
|
+
return response.data.resource.items;
|
|
626
|
+
}
|
|
627
|
+
catch (error) {
|
|
628
|
+
throw handleError(error);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
async get(campaignId) {
|
|
632
|
+
try {
|
|
633
|
+
const body = {
|
|
634
|
+
id: crypto.randomUUID(),
|
|
635
|
+
to: 'postmaster@activecampaign.msging.net',
|
|
636
|
+
method: 'get',
|
|
637
|
+
uri: `/campaigns/${campaignId}`,
|
|
638
|
+
};
|
|
639
|
+
const response = await this.api.post('/commands', body);
|
|
640
|
+
validateResponse(response);
|
|
641
|
+
return response.data.resource;
|
|
642
|
+
}
|
|
643
|
+
catch (error) {
|
|
644
|
+
throw handleError(error);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
async deleteCampaign(campaignId) {
|
|
648
|
+
try {
|
|
649
|
+
const body = {
|
|
650
|
+
id: crypto.randomUUID(),
|
|
651
|
+
to: 'postmaster@activecampaign.msging.net',
|
|
652
|
+
method: 'delete',
|
|
653
|
+
uri: `/campaigns/${campaignId}`,
|
|
654
|
+
};
|
|
655
|
+
const response = await this.api.post('/commands', body);
|
|
656
|
+
validateResponse(response);
|
|
657
|
+
}
|
|
658
|
+
catch (error) {
|
|
659
|
+
throw handleError(error);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
586
665
|
__proto__: null,
|
|
587
666
|
BlipAttendance: BlipAttendance,
|
|
588
667
|
BlipBucket: BlipBucket,
|
|
668
|
+
BlipCampaign: BlipCampaign,
|
|
589
669
|
BlipContact: BlipContact,
|
|
590
670
|
BlipContext: BlipContext,
|
|
591
671
|
BlipDispatch: BlipDispatch,
|
|
@@ -725,6 +805,36 @@ class BlipAnalytics {
|
|
|
725
805
|
}
|
|
726
806
|
}
|
|
727
807
|
|
|
808
|
+
class BlipThreads {
|
|
809
|
+
api;
|
|
810
|
+
constructor(context) {
|
|
811
|
+
this.api = context.api;
|
|
812
|
+
}
|
|
813
|
+
async getThread({ identity, refreshExpiredMedia, skip, take, messageId, storageDate, direction, getFromOriginator, }) {
|
|
814
|
+
const params = {
|
|
815
|
+
refreshExpiredMedia: refreshExpiredMedia ? 'true' : 'false',
|
|
816
|
+
$skip: skip,
|
|
817
|
+
$take: take,
|
|
818
|
+
messageId,
|
|
819
|
+
storageDate,
|
|
820
|
+
direction,
|
|
821
|
+
getFromOriginator,
|
|
822
|
+
};
|
|
823
|
+
try {
|
|
824
|
+
const response = await this.api.post('/commands', {
|
|
825
|
+
id: crypto.randomUUID(),
|
|
826
|
+
method: 'get',
|
|
827
|
+
uri: createUri(`/threads/${identity}`, params),
|
|
828
|
+
});
|
|
829
|
+
validateResponse(response);
|
|
830
|
+
return response.data.resource.items;
|
|
831
|
+
}
|
|
832
|
+
catch (error) {
|
|
833
|
+
throw handleError(error);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
728
838
|
class Blip {
|
|
729
839
|
api;
|
|
730
840
|
bucket;
|
|
@@ -739,6 +849,8 @@ class Blip {
|
|
|
739
849
|
whatsapp;
|
|
740
850
|
monitoring;
|
|
741
851
|
analytics;
|
|
852
|
+
campaign;
|
|
853
|
+
threads;
|
|
742
854
|
constructor(params) {
|
|
743
855
|
validateInstance(params);
|
|
744
856
|
this.api = axios.create({
|
|
@@ -760,8 +872,16 @@ class Blip {
|
|
|
760
872
|
this.whatsapp = new BlipWhatsapp({ api: this.api });
|
|
761
873
|
this.monitoring = new BlipMonitoring({ api: this.api });
|
|
762
874
|
this.analytics = new BlipAnalytics({ api: this.api });
|
|
875
|
+
this.campaign = new BlipCampaign({ api: this.api });
|
|
876
|
+
this.threads = new BlipThreads({ api: this.api });
|
|
763
877
|
}
|
|
764
878
|
}
|
|
765
879
|
|
|
880
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
881
|
+
__proto__: null,
|
|
882
|
+
BlipError: BlipError
|
|
883
|
+
});
|
|
884
|
+
|
|
766
885
|
exports.Blip = Blip;
|
|
767
|
-
exports.
|
|
886
|
+
exports.Exceptions = index;
|
|
887
|
+
exports.Modules = index$1;
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -38,7 +38,6 @@ function handleError(error) {
|
|
|
38
38
|
if (error.response?.data.code) {
|
|
39
39
|
throw new BlipError(error.response?.data.description, error.response?.data.code);
|
|
40
40
|
}
|
|
41
|
-
throw new BlipError(error.message, 0);
|
|
42
41
|
}
|
|
43
42
|
throw error;
|
|
44
43
|
}
|
|
@@ -202,6 +201,14 @@ class BlipAttendance {
|
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
|
|
204
|
+
function createUri(url, params) {
|
|
205
|
+
const encodedParams = encodeBlipParams(params);
|
|
206
|
+
if (encodedParams) {
|
|
207
|
+
return `${url}?${encodedParams}`;
|
|
208
|
+
}
|
|
209
|
+
return url;
|
|
210
|
+
}
|
|
211
|
+
|
|
205
212
|
class BlipContact {
|
|
206
213
|
api;
|
|
207
214
|
constructor(context) {
|
|
@@ -241,6 +248,26 @@ class BlipContact {
|
|
|
241
248
|
throw handleError(error);
|
|
242
249
|
}
|
|
243
250
|
}
|
|
251
|
+
async search({ filter, skip, take } = {}) {
|
|
252
|
+
const params = {
|
|
253
|
+
$filter: filter,
|
|
254
|
+
$skip: skip,
|
|
255
|
+
$take: take,
|
|
256
|
+
};
|
|
257
|
+
try {
|
|
258
|
+
const response = await this.api.post('/commands', {
|
|
259
|
+
id: randomUUID(),
|
|
260
|
+
to: 'postmaster@crm.msging.net',
|
|
261
|
+
method: 'get',
|
|
262
|
+
uri: createUri('/contacts', params),
|
|
263
|
+
});
|
|
264
|
+
validateResponse(response);
|
|
265
|
+
return response.data.resource.items;
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
throw handleError(error);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
244
271
|
}
|
|
245
272
|
|
|
246
273
|
class BlipContext {
|
|
@@ -311,7 +338,7 @@ class BlipDispatch {
|
|
|
311
338
|
/**
|
|
312
339
|
* Sends a template-based message to any user. For sending messages to clients who are active, use `sendTemplateMessage` instead.
|
|
313
340
|
*/
|
|
314
|
-
async sendIndividualActiveCampaign({ campaignName, masterState, flowId, stateId, channelType, phone, templateName, params = [], }) {
|
|
341
|
+
async sendIndividualActiveCampaign({ campaignName, masterState, flowId, stateId, channelType, phone, templateName, params = [], scheduled, }) {
|
|
315
342
|
const body = {
|
|
316
343
|
id: randomUUID(),
|
|
317
344
|
to: 'postmaster@activecampaign.msging.net',
|
|
@@ -326,9 +353,10 @@ class BlipDispatch {
|
|
|
326
353
|
flowId,
|
|
327
354
|
stateId,
|
|
328
355
|
channelType,
|
|
356
|
+
scheduled: scheduled?.toISOString(),
|
|
329
357
|
},
|
|
330
358
|
audience: {
|
|
331
|
-
recipient: `+${phone}`,
|
|
359
|
+
recipient: `+${phone.replace('+', '')}`,
|
|
332
360
|
},
|
|
333
361
|
message: {
|
|
334
362
|
messageTemplate: templateName,
|
|
@@ -388,7 +416,7 @@ class BlipDispatch {
|
|
|
388
416
|
/**
|
|
389
417
|
* Sends a simple text message to an active user. For sending messages to clients who have never interacted or are inactive, use `sendTemplate` instead.
|
|
390
418
|
*/
|
|
391
|
-
async sendSimpleMessage({ identity, content, metadata }) {
|
|
419
|
+
async sendSimpleMessage({ identity, content, metadata, }) {
|
|
392
420
|
try {
|
|
393
421
|
const response = await this.api.post('/messages', {
|
|
394
422
|
id: randomUUID(),
|
|
@@ -491,14 +519,6 @@ class BlipInteraction {
|
|
|
491
519
|
}
|
|
492
520
|
}
|
|
493
521
|
|
|
494
|
-
function createUri(url, params) {
|
|
495
|
-
const encodedParams = encodeBlipParams(params);
|
|
496
|
-
if (encodedParams) {
|
|
497
|
-
return `${url}?${encodedParams}`;
|
|
498
|
-
}
|
|
499
|
-
return url;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
522
|
class BlipTicket {
|
|
503
523
|
api;
|
|
504
524
|
constructor(context) {
|
|
@@ -580,10 +600,70 @@ class BlipWhatsapp {
|
|
|
580
600
|
}
|
|
581
601
|
}
|
|
582
602
|
|
|
583
|
-
|
|
603
|
+
class BlipCampaign {
|
|
604
|
+
api;
|
|
605
|
+
constructor(context) {
|
|
606
|
+
this.api = context.api;
|
|
607
|
+
}
|
|
608
|
+
async search({ filter, skip, take } = {}) {
|
|
609
|
+
try {
|
|
610
|
+
const params = {
|
|
611
|
+
$filter: filter,
|
|
612
|
+
$skip: skip,
|
|
613
|
+
$take: take,
|
|
614
|
+
};
|
|
615
|
+
const body = {
|
|
616
|
+
id: randomUUID(),
|
|
617
|
+
to: 'postmaster@activecampaign.msging.net',
|
|
618
|
+
method: 'get',
|
|
619
|
+
uri: createUri('/campaigns', params),
|
|
620
|
+
};
|
|
621
|
+
const response = await this.api.post('/commands', body);
|
|
622
|
+
validateResponse(response);
|
|
623
|
+
return response.data.resource.items;
|
|
624
|
+
}
|
|
625
|
+
catch (error) {
|
|
626
|
+
throw handleError(error);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
async get(campaignId) {
|
|
630
|
+
try {
|
|
631
|
+
const body = {
|
|
632
|
+
id: randomUUID(),
|
|
633
|
+
to: 'postmaster@activecampaign.msging.net',
|
|
634
|
+
method: 'get',
|
|
635
|
+
uri: `/campaigns/${campaignId}`,
|
|
636
|
+
};
|
|
637
|
+
const response = await this.api.post('/commands', body);
|
|
638
|
+
validateResponse(response);
|
|
639
|
+
return response.data.resource;
|
|
640
|
+
}
|
|
641
|
+
catch (error) {
|
|
642
|
+
throw handleError(error);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
async deleteCampaign(campaignId) {
|
|
646
|
+
try {
|
|
647
|
+
const body = {
|
|
648
|
+
id: randomUUID(),
|
|
649
|
+
to: 'postmaster@activecampaign.msging.net',
|
|
650
|
+
method: 'delete',
|
|
651
|
+
uri: `/campaigns/${campaignId}`,
|
|
652
|
+
};
|
|
653
|
+
const response = await this.api.post('/commands', body);
|
|
654
|
+
validateResponse(response);
|
|
655
|
+
}
|
|
656
|
+
catch (error) {
|
|
657
|
+
throw handleError(error);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
584
663
|
__proto__: null,
|
|
585
664
|
BlipAttendance: BlipAttendance,
|
|
586
665
|
BlipBucket: BlipBucket,
|
|
666
|
+
BlipCampaign: BlipCampaign,
|
|
587
667
|
BlipContact: BlipContact,
|
|
588
668
|
BlipContext: BlipContext,
|
|
589
669
|
BlipDispatch: BlipDispatch,
|
|
@@ -723,6 +803,36 @@ class BlipAnalytics {
|
|
|
723
803
|
}
|
|
724
804
|
}
|
|
725
805
|
|
|
806
|
+
class BlipThreads {
|
|
807
|
+
api;
|
|
808
|
+
constructor(context) {
|
|
809
|
+
this.api = context.api;
|
|
810
|
+
}
|
|
811
|
+
async getThread({ identity, refreshExpiredMedia, skip, take, messageId, storageDate, direction, getFromOriginator, }) {
|
|
812
|
+
const params = {
|
|
813
|
+
refreshExpiredMedia: refreshExpiredMedia ? 'true' : 'false',
|
|
814
|
+
$skip: skip,
|
|
815
|
+
$take: take,
|
|
816
|
+
messageId,
|
|
817
|
+
storageDate,
|
|
818
|
+
direction,
|
|
819
|
+
getFromOriginator,
|
|
820
|
+
};
|
|
821
|
+
try {
|
|
822
|
+
const response = await this.api.post('/commands', {
|
|
823
|
+
id: randomUUID(),
|
|
824
|
+
method: 'get',
|
|
825
|
+
uri: createUri(`/threads/${identity}`, params),
|
|
826
|
+
});
|
|
827
|
+
validateResponse(response);
|
|
828
|
+
return response.data.resource.items;
|
|
829
|
+
}
|
|
830
|
+
catch (error) {
|
|
831
|
+
throw handleError(error);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
|
|
726
836
|
class Blip {
|
|
727
837
|
api;
|
|
728
838
|
bucket;
|
|
@@ -737,6 +847,8 @@ class Blip {
|
|
|
737
847
|
whatsapp;
|
|
738
848
|
monitoring;
|
|
739
849
|
analytics;
|
|
850
|
+
campaign;
|
|
851
|
+
threads;
|
|
740
852
|
constructor(params) {
|
|
741
853
|
validateInstance(params);
|
|
742
854
|
this.api = axios.create({
|
|
@@ -758,7 +870,14 @@ class Blip {
|
|
|
758
870
|
this.whatsapp = new BlipWhatsapp({ api: this.api });
|
|
759
871
|
this.monitoring = new BlipMonitoring({ api: this.api });
|
|
760
872
|
this.analytics = new BlipAnalytics({ api: this.api });
|
|
873
|
+
this.campaign = new BlipCampaign({ api: this.api });
|
|
874
|
+
this.threads = new BlipThreads({ api: this.api });
|
|
761
875
|
}
|
|
762
876
|
}
|
|
763
877
|
|
|
764
|
-
|
|
878
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
879
|
+
__proto__: null,
|
|
880
|
+
BlipError: BlipError
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
export { Blip, index as Exceptions, index$1 as Modules };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { Campaign } from '../types';
|
|
3
|
+
export default class BlipCampaign {
|
|
4
|
+
private api;
|
|
5
|
+
constructor(context: {
|
|
6
|
+
api: AxiosInstance;
|
|
7
|
+
});
|
|
8
|
+
search({ filter, skip, take }?: {
|
|
9
|
+
filter?: string;
|
|
10
|
+
skip?: number;
|
|
11
|
+
take?: number;
|
|
12
|
+
}): Promise<Campaign[]>;
|
|
13
|
+
get(campaignId: string): Promise<Campaign>;
|
|
14
|
+
deleteCampaign(campaignId: string): Promise<void>;
|
|
15
|
+
}
|
|
@@ -10,15 +10,16 @@ export default class BlipDispatch {
|
|
|
10
10
|
/**
|
|
11
11
|
* Sends a template-based message to any user. For sending messages to clients who are active, use `sendTemplateMessage` instead.
|
|
12
12
|
*/
|
|
13
|
-
sendIndividualActiveCampaign({ campaignName, masterState, flowId, stateId, channelType, phone, templateName, params, }: {
|
|
13
|
+
sendIndividualActiveCampaign({ campaignName, masterState, flowId, stateId, channelType, phone, templateName, params, scheduled, }: {
|
|
14
14
|
campaignName: string;
|
|
15
15
|
masterState: string;
|
|
16
16
|
flowId: string;
|
|
17
17
|
stateId: string;
|
|
18
|
-
channelType: string;
|
|
18
|
+
channelType: 'whatsapp' | string;
|
|
19
19
|
phone: string;
|
|
20
20
|
templateName: string;
|
|
21
|
-
params
|
|
21
|
+
params?: string[];
|
|
22
|
+
scheduled?: Date;
|
|
22
23
|
}): Promise<CampaignNotification>;
|
|
23
24
|
getCampaignNotificationStatus({ campaignNotificationId }: {
|
|
24
25
|
campaignNotificationId: string;
|
|
@@ -29,15 +30,15 @@ export default class BlipDispatch {
|
|
|
29
30
|
sendTemplateMessage({ identity, template, metadata, }: {
|
|
30
31
|
identity: string;
|
|
31
32
|
template: Template;
|
|
32
|
-
metadata?: string
|
|
33
|
+
metadata?: Record<string, string>;
|
|
33
34
|
}): Promise<void>;
|
|
34
35
|
/**
|
|
35
36
|
* Sends a simple text message to an active user. For sending messages to clients who have never interacted or are inactive, use `sendTemplate` instead.
|
|
36
37
|
*/
|
|
37
|
-
sendSimpleMessage({ identity, content, metadata }: {
|
|
38
|
+
sendSimpleMessage({ identity, content, metadata, }: {
|
|
38
39
|
identity: string;
|
|
39
40
|
content: string;
|
|
40
|
-
metadata?: string
|
|
41
|
+
metadata?: Record<string, string>;
|
|
41
42
|
}): Promise<void>;
|
|
42
43
|
/**
|
|
43
44
|
* Sends a text message to an active user with a midia. For sending messages to clients who have never interacted or are inactive, use `sendTemplate` instead.
|
|
@@ -47,7 +48,7 @@ export default class BlipDispatch {
|
|
|
47
48
|
uri: string;
|
|
48
49
|
identity: string;
|
|
49
50
|
text: string;
|
|
50
|
-
metadata?: string
|
|
51
|
+
metadata?: Record<string, string>;
|
|
51
52
|
title: string;
|
|
52
53
|
aspectRatio?: string;
|
|
53
54
|
size?: number;
|
|
@@ -58,6 +59,6 @@ export default class BlipDispatch {
|
|
|
58
59
|
identity: string;
|
|
59
60
|
message: string;
|
|
60
61
|
buttons: string[];
|
|
61
|
-
metadata?: string
|
|
62
|
+
metadata?: Record<string, string>;
|
|
62
63
|
}): Promise<void>;
|
|
63
64
|
}
|
|
@@ -11,6 +11,8 @@ import BlipWhatsapp from './blip-whatsapp';
|
|
|
11
11
|
import BlipContact from './blip-contact';
|
|
12
12
|
import BlipMonitoring from './blip-monitoring';
|
|
13
13
|
import BlipAnalytics from './blip-analytics';
|
|
14
|
+
import BlipCampaign from './blip-campaign';
|
|
15
|
+
import BlipThreads from './blip-threads';
|
|
14
16
|
export declare class Blip {
|
|
15
17
|
private api;
|
|
16
18
|
bucket: BlipBucket;
|
|
@@ -25,5 +27,7 @@ export declare class Blip {
|
|
|
25
27
|
whatsapp: BlipWhatsapp;
|
|
26
28
|
monitoring: BlipMonitoring;
|
|
27
29
|
analytics: BlipAnalytics;
|
|
30
|
+
campaign: BlipCampaign;
|
|
31
|
+
threads: BlipThreads;
|
|
28
32
|
constructor(params: BlipConstructor);
|
|
29
33
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ThreadItem } from '../types/threads';
|
|
3
|
+
export default class BlipThreads {
|
|
4
|
+
private api;
|
|
5
|
+
constructor(context: {
|
|
6
|
+
api: AxiosInstance;
|
|
7
|
+
});
|
|
8
|
+
getThread({ identity, refreshExpiredMedia, skip, take, messageId, storageDate, direction, getFromOriginator, }: {
|
|
9
|
+
identity: string;
|
|
10
|
+
refreshExpiredMedia?: boolean;
|
|
11
|
+
skip?: number;
|
|
12
|
+
take?: number;
|
|
13
|
+
messageId?: string;
|
|
14
|
+
storageDate?: string;
|
|
15
|
+
direction?: 'asc' | 'desc';
|
|
16
|
+
getFromOriginator?: string;
|
|
17
|
+
}): Promise<ThreadItem[]>;
|
|
18
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import {
|
|
2
|
+
import { Ticket } from '../types';
|
|
3
3
|
export default class BlipTicket {
|
|
4
4
|
private api;
|
|
5
5
|
constructor(context: {
|
|
@@ -9,6 +9,6 @@ export default class BlipTicket {
|
|
|
9
9
|
filter?: string;
|
|
10
10
|
skip?: number;
|
|
11
11
|
take?: number;
|
|
12
|
-
}): Promise<
|
|
13
|
-
getTicket(ticketId: string): Promise<
|
|
12
|
+
}): Promise<Ticket[]>;
|
|
13
|
+
getTicket(ticketId: string): Promise<Ticket>;
|
|
14
14
|
}
|
package/dist/modules/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ import BlipEvent from './blip-event';
|
|
|
8
8
|
import BlipInteraction from './blip-interaction';
|
|
9
9
|
import BlipTicket from './blip-ticket';
|
|
10
10
|
import BlipWhatsapp from './blip-whatsapp';
|
|
11
|
-
|
|
11
|
+
import BlipCampaign from './blip-campaign';
|
|
12
|
+
export { BlipMedia, BlipBucket, BlipAttendance, BlipContact, BlipContext, BlipDispatch, BlipEvent, BlipInteraction, BlipTicket, BlipWhatsapp, BlipCampaign, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Campaign {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
campaignType: string;
|
|
5
|
+
masterState: string;
|
|
6
|
+
flowId: string;
|
|
7
|
+
stateId: string;
|
|
8
|
+
status: string;
|
|
9
|
+
created: string;
|
|
10
|
+
scheduled: string;
|
|
11
|
+
isToUseLiteApi: boolean;
|
|
12
|
+
channelType: string;
|
|
13
|
+
canSendWithOpenTicket: boolean;
|
|
14
|
+
}
|
package/dist/types/contact.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { AttendanceHourContainer } from './attendance-hour-container';
|
|
|
2
2
|
import { BlipConstructor } from './blip-constructor';
|
|
3
3
|
import { BlipRequestBody, BlipResponse, BlipArrayBody } from './blip';
|
|
4
4
|
import { Parameter, Component, Template } from './template';
|
|
5
|
-
import { TicketSearchResult } from './ticket-search-result';
|
|
6
5
|
import { Ticket } from './ticket';
|
|
7
6
|
import { MonitoredTickets, MonitoredTicketMetrics, MonitoredAttendantStatusMetrics } from './monitoring';
|
|
8
7
|
import { TicketAnalyticsReport, TicketAnalyticsTimings } from './analytics';
|
|
9
|
-
|
|
8
|
+
import { Campaign } from './campaign';
|
|
9
|
+
import { Contact } from './contact';
|
|
10
|
+
export { AttendanceHourContainer, BlipConstructor, BlipRequestBody, BlipResponse, BlipArrayBody, Parameter, Component, Template, TicketAnalyticsReport, MonitoredTickets, MonitoredTicketMetrics, MonitoredAttendantStatusMetrics, TicketAnalyticsTimings, Ticket, Campaign, Contact, };
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface TicketSearchResult {
|
|
2
|
-
total: number;
|
|
3
|
-
itemType: string;
|
|
4
|
-
items: Ticket[];
|
|
5
|
-
}
|
|
6
|
-
export interface Ticket {
|
|
7
|
-
closed: boolean;
|
|
8
|
-
customerDomain: string;
|
|
9
|
-
customerIdentity: string;
|
|
10
|
-
externalId: string;
|
|
11
|
-
id: string;
|
|
12
|
-
ownerIdentity: string;
|
|
13
|
-
priority: number;
|
|
14
|
-
provider: string;
|
|
15
|
-
rating: number;
|
|
16
|
-
sequentialId: number;
|
|
17
|
-
status: string;
|
|
18
|
-
storageDate: string;
|
|
19
|
-
team: string;
|
|
20
|
-
unreadMessages: number;
|
|
21
|
-
}
|