@proveanything/smartlinks 1.1.0 → 1.1.2
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/API_SUMMARY.md +150 -160
- package/dist/api/broadcasts.d.ts +3 -39
- package/dist/api/broadcasts.js +0 -55
- package/dist/api/comms.d.ts +36 -1
- package/dist/api/comms.js +54 -0
- package/dist/types/broadcasts.d.ts +5 -85
- package/dist/types/comms.d.ts +84 -0
- package/dist/types/comms.js +0 -2
- package/package.json +1 -1
package/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2 | Generated: 2025-12-18T22:42:25.982Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -532,127 +532,6 @@ interface AuthKitConfig {
|
|
|
532
532
|
|
|
533
533
|
### broadcasts
|
|
534
534
|
|
|
535
|
-
**BroadcastEvent** (interface)
|
|
536
|
-
```typescript
|
|
537
|
-
interface BroadcastEvent {
|
|
538
|
-
orgId: string
|
|
539
|
-
broadcastId: string
|
|
540
|
-
userId?: string
|
|
541
|
-
contactId?: string
|
|
542
|
-
channel?: string
|
|
543
|
-
timestamp: string
|
|
544
|
-
[k: string]: any
|
|
545
|
-
}
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
**BroadcastQueryByUser** (interface)
|
|
549
|
-
```typescript
|
|
550
|
-
interface BroadcastQueryByUser {
|
|
551
|
-
userId?: string
|
|
552
|
-
contactId?: string
|
|
553
|
-
from?: string
|
|
554
|
-
to?: string
|
|
555
|
-
limit?: number
|
|
556
|
-
}
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
**RecipientIdsQuery** (interface)
|
|
560
|
-
```typescript
|
|
561
|
-
interface RecipientIdsQuery {
|
|
562
|
-
broadcastId: string
|
|
563
|
-
idField?: IdField
|
|
564
|
-
from?: string
|
|
565
|
-
to?: string
|
|
566
|
-
limit?: number
|
|
567
|
-
}
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
**RecipientsWithoutActionQuery** (interface)
|
|
571
|
-
```typescript
|
|
572
|
-
interface RecipientsWithoutActionQuery {
|
|
573
|
-
broadcastId: string
|
|
574
|
-
actionId?: string
|
|
575
|
-
appId?: string
|
|
576
|
-
idField?: IdField
|
|
577
|
-
from?: string
|
|
578
|
-
to?: string
|
|
579
|
-
limit?: number
|
|
580
|
-
}
|
|
581
|
-
```
|
|
582
|
-
|
|
583
|
-
**RecipientsWithActionQuery** (interface)
|
|
584
|
-
```typescript
|
|
585
|
-
interface RecipientsWithActionQuery {
|
|
586
|
-
broadcastId: string
|
|
587
|
-
actionId?: string
|
|
588
|
-
appId?: string
|
|
589
|
-
outcome?: string
|
|
590
|
-
idField?: IdField
|
|
591
|
-
includeOutcome?: boolean
|
|
592
|
-
from?: string
|
|
593
|
-
to?: string
|
|
594
|
-
limit?: number
|
|
595
|
-
}
|
|
596
|
-
```
|
|
597
|
-
|
|
598
|
-
**RecipientWithOutcome** (interface)
|
|
599
|
-
```typescript
|
|
600
|
-
interface RecipientWithOutcome {
|
|
601
|
-
id: string; outcome: string
|
|
602
|
-
}
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
**AppendBroadcastBody** (interface)
|
|
606
|
-
```typescript
|
|
607
|
-
interface AppendBroadcastBody {
|
|
608
|
-
broadcastId: string
|
|
609
|
-
userId?: string
|
|
610
|
-
contactId?: string
|
|
611
|
-
channel?: string
|
|
612
|
-
timestamp?: string
|
|
613
|
-
[k: string]: any
|
|
614
|
-
}
|
|
615
|
-
```
|
|
616
|
-
|
|
617
|
-
**AppendBroadcastBulkBody** (interface)
|
|
618
|
-
```typescript
|
|
619
|
-
interface AppendBroadcastBulkBody {
|
|
620
|
-
params: { broadcastId: string; [k: string]: any }
|
|
621
|
-
ids: string[]
|
|
622
|
-
idField?: IdField
|
|
623
|
-
}
|
|
624
|
-
```
|
|
625
|
-
|
|
626
|
-
**AppendResult** (interface)
|
|
627
|
-
```typescript
|
|
628
|
-
interface AppendResult {
|
|
629
|
-
success: true
|
|
630
|
-
}
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
**AppendBulkResult** (interface)
|
|
634
|
-
```typescript
|
|
635
|
-
interface AppendBulkResult {
|
|
636
|
-
success: true; count: number
|
|
637
|
-
}
|
|
638
|
-
```
|
|
639
|
-
|
|
640
|
-
**CreateBroadcastBody** (interface)
|
|
641
|
-
```typescript
|
|
642
|
-
interface CreateBroadcastBody {
|
|
643
|
-
appId: string
|
|
644
|
-
data?: Record<string, any>
|
|
645
|
-
}
|
|
646
|
-
```
|
|
647
|
-
|
|
648
|
-
**UpdateBroadcastBody** (interface)
|
|
649
|
-
```typescript
|
|
650
|
-
interface UpdateBroadcastBody {
|
|
651
|
-
appId?: string
|
|
652
|
-
data?: Record<string, any>
|
|
653
|
-
}
|
|
654
|
-
```
|
|
655
|
-
|
|
656
535
|
**ListBroadcastsQuery** (interface)
|
|
657
536
|
```typescript
|
|
658
537
|
interface ListBroadcastsQuery {
|
|
@@ -668,11 +547,11 @@ interface BroadcastRecord {
|
|
|
668
547
|
id: string
|
|
669
548
|
collectionId: string
|
|
670
549
|
appId: string
|
|
671
|
-
templateId?: string
|
|
672
|
-
segmentId?: string
|
|
673
|
-
status?:
|
|
674
|
-
scheduledAt?: string
|
|
675
|
-
sentAt?: string
|
|
550
|
+
templateId?: string | null
|
|
551
|
+
segmentId?: string | null
|
|
552
|
+
status?: string | null
|
|
553
|
+
scheduledAt?: string | null
|
|
554
|
+
sentAt?: string | null
|
|
676
555
|
data?: {
|
|
677
556
|
display?: {
|
|
678
557
|
title?: string
|
|
@@ -696,8 +575,6 @@ interface BroadcastList {
|
|
|
696
575
|
}
|
|
697
576
|
```
|
|
698
577
|
|
|
699
|
-
**RecipientId** = `string`
|
|
700
|
-
|
|
701
578
|
### claimSet
|
|
702
579
|
|
|
703
580
|
**ClaimCodeRef** (interface)
|
|
@@ -865,6 +742,124 @@ interface SendNotificationResponse {
|
|
|
865
742
|
}
|
|
866
743
|
```
|
|
867
744
|
|
|
745
|
+
**CommunicationEvent** (interface)
|
|
746
|
+
```typescript
|
|
747
|
+
interface CommunicationEvent {
|
|
748
|
+
orgId: string
|
|
749
|
+
broadcastId?: string
|
|
750
|
+
journeyId?: string
|
|
751
|
+
userId?: string
|
|
752
|
+
contactId?: string
|
|
753
|
+
channel?: string
|
|
754
|
+
timestamp: string
|
|
755
|
+
eventType: string
|
|
756
|
+
outcome?: string | null
|
|
757
|
+
templateId?: string | null
|
|
758
|
+
[k: string]: any
|
|
759
|
+
}
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
**CommsQueryByUser** (interface)
|
|
763
|
+
```typescript
|
|
764
|
+
interface CommsQueryByUser {
|
|
765
|
+
userId?: string
|
|
766
|
+
contactId?: string
|
|
767
|
+
from?: string
|
|
768
|
+
to?: string
|
|
769
|
+
limit?: number
|
|
770
|
+
}
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
**RecipientWithOutcome** (interface)
|
|
774
|
+
```typescript
|
|
775
|
+
interface RecipientWithOutcome {
|
|
776
|
+
id: string; outcome: string
|
|
777
|
+
}
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
**CommsRecipientIdsQuery** (interface)
|
|
781
|
+
```typescript
|
|
782
|
+
interface CommsRecipientIdsQuery {
|
|
783
|
+
broadcastId?: string
|
|
784
|
+
journeyId?: string
|
|
785
|
+
idField?: IdField
|
|
786
|
+
from?: string
|
|
787
|
+
to?: string
|
|
788
|
+
limit?: number
|
|
789
|
+
}
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
**CommsRecipientsWithoutActionQuery** (interface)
|
|
793
|
+
```typescript
|
|
794
|
+
interface CommsRecipientsWithoutActionQuery {
|
|
795
|
+
broadcastId?: string
|
|
796
|
+
journeyId?: string
|
|
797
|
+
actionId?: string
|
|
798
|
+
appId?: string
|
|
799
|
+
idField?: IdField
|
|
800
|
+
from?: string
|
|
801
|
+
to?: string
|
|
802
|
+
limit?: number
|
|
803
|
+
}
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
**CommsRecipientsWithActionQuery** (interface)
|
|
807
|
+
```typescript
|
|
808
|
+
interface CommsRecipientsWithActionQuery {
|
|
809
|
+
broadcastId?: string
|
|
810
|
+
journeyId?: string
|
|
811
|
+
actionId?: string
|
|
812
|
+
appId?: string
|
|
813
|
+
outcome?: string
|
|
814
|
+
idField?: IdField
|
|
815
|
+
includeOutcome?: boolean
|
|
816
|
+
from?: string
|
|
817
|
+
to?: string
|
|
818
|
+
limit?: number
|
|
819
|
+
}
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
**LogCommunicationEventBody** (interface)
|
|
823
|
+
```typescript
|
|
824
|
+
interface LogCommunicationEventBody {
|
|
825
|
+
broadcastId?: string
|
|
826
|
+
journeyId?: string
|
|
827
|
+
userId?: string
|
|
828
|
+
contactId?: string
|
|
829
|
+
channel?: string
|
|
830
|
+
eventType: string
|
|
831
|
+
outcome?: string
|
|
832
|
+
templateId?: string
|
|
833
|
+
timestamp?: string
|
|
834
|
+
[k: string]: any
|
|
835
|
+
}
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
**LogBulkCommunicationEventsBody** (interface)
|
|
839
|
+
```typescript
|
|
840
|
+
interface LogBulkCommunicationEventsBody {
|
|
841
|
+
params: { broadcastId?: string; journeyId?: string; [k: string]: any }
|
|
842
|
+
ids: string[]
|
|
843
|
+
idField?: IdField
|
|
844
|
+
}
|
|
845
|
+
```
|
|
846
|
+
|
|
847
|
+
**AppendResult** (interface)
|
|
848
|
+
```typescript
|
|
849
|
+
interface AppendResult {
|
|
850
|
+
success: true
|
|
851
|
+
}
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
**AppendBulkResult** (interface)
|
|
855
|
+
```typescript
|
|
856
|
+
interface AppendBulkResult {
|
|
857
|
+
success: true; count: number
|
|
858
|
+
}
|
|
859
|
+
```
|
|
860
|
+
|
|
861
|
+
**RecipientId** = `string`
|
|
862
|
+
|
|
868
863
|
### contact
|
|
869
864
|
|
|
870
865
|
**ContactResponse** (interface)
|
|
@@ -1633,50 +1628,21 @@ Look up a serial number by code for a batch (admin only).
|
|
|
1633
1628
|
|
|
1634
1629
|
### broadcasts
|
|
1635
1630
|
|
|
1636
|
-
**byUser**(collectionId: string,
|
|
1637
|
-
query: BroadcastQueryByUser = {}) → `Promise<BroadcastEvent[]>`
|
|
1638
|
-
POST /admin/collection/:collectionId/broadcasts/by-user Returns broadcast events array, newest first.
|
|
1639
|
-
|
|
1640
|
-
**recipientIds**(collectionId: string,
|
|
1641
|
-
query: RecipientIdsQuery) → `Promise<RecipientId[]>`
|
|
1642
|
-
POST /admin/collection/:collectionId/broadcasts/recipient-ids Returns recipient IDs for a broadcast.
|
|
1643
|
-
|
|
1644
|
-
**recipientsWithoutAction**(collectionId: string,
|
|
1645
|
-
query: RecipientsWithoutActionQuery) → `Promise<RecipientId[]>`
|
|
1646
|
-
POST /admin/collection/:collectionId/broadcasts/recipients/without-action Returns IDs who received the broadcast but did not perform an action.
|
|
1647
|
-
|
|
1648
|
-
**recipientsWithAction**(collectionId: string,
|
|
1649
|
-
query: RecipientsWithActionQuery) → `Promise<RecipientId[] | RecipientWithOutcome[]>`
|
|
1650
|
-
POST /admin/collection/:collectionId/broadcasts/recipients/with-action Returns IDs who received the broadcast and performed an action; optionally includes outcome.
|
|
1651
|
-
|
|
1652
|
-
**append**(collectionId: string,
|
|
1653
|
-
body: AppendBroadcastBody) → `Promise<AppendResult>`
|
|
1654
|
-
POST /admin/collection/:collectionId/broadcasts/append Appends one broadcast event.
|
|
1655
|
-
|
|
1656
|
-
**appendBulk**(collectionId: string,
|
|
1657
|
-
body: AppendBroadcastBulkBody | ({ broadcastId: string; ids: string[]; idField?: 'userId'|'contactId'; [k: string]: any }) → `void`
|
|
1658
|
-
POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
|
|
1659
|
-
|
|
1660
1631
|
**create**(collectionId: string,
|
|
1661
|
-
body:
|
|
1662
|
-
POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
|
|
1632
|
+
body: Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>) → `Promise<BroadcastRecord>`
|
|
1663
1633
|
|
|
1664
1634
|
**list**(collectionId: string,
|
|
1665
1635
|
query: ListBroadcastsQuery = {}) → `Promise<BroadcastList>`
|
|
1666
|
-
POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
|
|
1667
1636
|
|
|
1668
1637
|
**get**(collectionId: string,
|
|
1669
1638
|
id: string) → `Promise<BroadcastRecord>`
|
|
1670
|
-
POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
|
|
1671
1639
|
|
|
1672
1640
|
**update**(collectionId: string,
|
|
1673
1641
|
id: string,
|
|
1674
|
-
body:
|
|
1675
|
-
POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
|
|
1642
|
+
body: Partial<Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>>) → `Promise<BroadcastRecord>`
|
|
1676
1643
|
|
|
1677
1644
|
**remove**(collectionId: string,
|
|
1678
1645
|
id: string) → `Promise<void>`
|
|
1679
|
-
POST /admin/collection/:collectionId/broadcasts/append/bulk Appends many broadcast recipients. Accepts preferred body shape with params + ids, and legacy flat shape.
|
|
1680
1646
|
|
|
1681
1647
|
### claimSet
|
|
1682
1648
|
|
|
@@ -1762,6 +1728,30 @@ Assign a value to a serial number for a collection (admin only).
|
|
|
1762
1728
|
request: SendNotificationRequest) → `Promise<SendNotificationResponse>`
|
|
1763
1729
|
Send a notification to specified targets within a collection. Supports multiple delivery methods including push notifications, email, and wallet pass updates. The notification will be delivered based on user preferences and the specified delivery mode. ```typescript const result = await comms.sendNotification('my-collection', { subjectTargets: [{ type: 'product', id: 'prod_123' }], severity: 'important', mode: 'preferred', template: { push: { title: 'Update available', body: 'We\'ve shipped an important update.', icon: 'https://cdn.example.com/brand/logo-128.png' }, email: { subject: 'Important update for your product', body: 'There\'s an important update. Open your pass or profile to learn more.' }, walletUpdate: { textModulesData: [ { id: 'notice', header: 'Update', body: 'Open your wallet pass for details.' } ] } } }) if (result.ok) { console.log('Notification queued:', result.notificationId) console.log('Totals:', result.status.totals) } ```
|
|
1764
1730
|
|
|
1731
|
+
**queryByUser**(collectionId: string,
|
|
1732
|
+
body: CommsQueryByUser = {}) → `Promise<CommunicationEvent[]>`
|
|
1733
|
+
Analytics: Query communication events by user or contact. POST /admin/collection/:collectionId/comm/query/by-user
|
|
1734
|
+
|
|
1735
|
+
**queryRecipientIds**(collectionId: string,
|
|
1736
|
+
body: CommsRecipientIdsQuery) → `Promise<RecipientId[]>`
|
|
1737
|
+
Analytics: Recipient IDs for a communication source. POST /admin/collection/:collectionId/comm/query/recipient-ids
|
|
1738
|
+
|
|
1739
|
+
**queryRecipientsWithoutAction**(collectionId: string,
|
|
1740
|
+
body: CommsRecipientsWithoutActionQuery) → `Promise<RecipientId[]>`
|
|
1741
|
+
Analytics: Recipients who did not perform an action. POST /admin/collection/:collectionId/comm/query/recipients/without-action
|
|
1742
|
+
|
|
1743
|
+
**queryRecipientsWithAction**(collectionId: string,
|
|
1744
|
+
body: CommsRecipientsWithActionQuery) → `Promise<RecipientId[] | RecipientWithOutcome[]>`
|
|
1745
|
+
Analytics: Recipients who performed an action, optionally with outcome. POST /admin/collection/:collectionId/comm/query/recipients/with-action
|
|
1746
|
+
|
|
1747
|
+
**logCommunicationEvent**(collectionId: string,
|
|
1748
|
+
body: LogCommunicationEventBody) → `Promise<AppendResult>`
|
|
1749
|
+
Logging: Append a single communication event. POST /admin/collection/:collectionId/comm/log
|
|
1750
|
+
|
|
1751
|
+
**logBulkCommunicationEvents**(collectionId: string,
|
|
1752
|
+
body: LogBulkCommunicationEventsBody | ({ sourceId: string; ids: string[]; idField?: 'userId'|'contactId'; [k: string]: any }) → `void`
|
|
1753
|
+
Logging: Append many communication events for a list of IDs. POST /admin/collection/:collectionId/comm/log/bulk
|
|
1754
|
+
|
|
1765
1755
|
### contact
|
|
1766
1756
|
|
|
1767
1757
|
**create**(collectionId: string, data: ContactCreateRequest) → `Promise<ContactResponse>`
|
package/dist/api/broadcasts.d.ts
CHANGED
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ListBroadcastsQuery, BroadcastRecord, BroadcastList } from "../types/broadcasts";
|
|
2
2
|
export declare namespace broadcasts {
|
|
3
|
-
|
|
4
|
-
* POST /admin/collection/:collectionId/broadcasts/by-user
|
|
5
|
-
* Returns broadcast events array, newest first.
|
|
6
|
-
*/
|
|
7
|
-
function byUser(collectionId: string, query?: BroadcastQueryByUser): Promise<BroadcastEvent[]>;
|
|
8
|
-
/**
|
|
9
|
-
* POST /admin/collection/:collectionId/broadcasts/recipient-ids
|
|
10
|
-
* Returns recipient IDs for a broadcast.
|
|
11
|
-
*/
|
|
12
|
-
function recipientIds(collectionId: string, query: RecipientIdsQuery): Promise<RecipientId[]>;
|
|
13
|
-
/**
|
|
14
|
-
* POST /admin/collection/:collectionId/broadcasts/recipients/without-action
|
|
15
|
-
* Returns IDs who received the broadcast but did not perform an action.
|
|
16
|
-
*/
|
|
17
|
-
function recipientsWithoutAction(collectionId: string, query: RecipientsWithoutActionQuery): Promise<RecipientId[]>;
|
|
18
|
-
/**
|
|
19
|
-
* POST /admin/collection/:collectionId/broadcasts/recipients/with-action
|
|
20
|
-
* Returns IDs who received the broadcast and performed an action; optionally includes outcome.
|
|
21
|
-
*/
|
|
22
|
-
function recipientsWithAction(collectionId: string, query: RecipientsWithActionQuery): Promise<RecipientId[] | RecipientWithOutcome[]>;
|
|
23
|
-
/**
|
|
24
|
-
* POST /admin/collection/:collectionId/broadcasts/append
|
|
25
|
-
* Appends one broadcast event.
|
|
26
|
-
*/
|
|
27
|
-
function append(collectionId: string, body: AppendBroadcastBody): Promise<AppendResult>;
|
|
28
|
-
/**
|
|
29
|
-
* POST /admin/collection/:collectionId/broadcasts/append/bulk
|
|
30
|
-
* Appends many broadcast recipients.
|
|
31
|
-
* Accepts preferred body shape with params + ids, and legacy flat shape.
|
|
32
|
-
*/
|
|
33
|
-
function appendBulk(collectionId: string, body: AppendBroadcastBulkBody | ({
|
|
34
|
-
broadcastId: string;
|
|
35
|
-
ids: string[];
|
|
36
|
-
idField?: 'userId' | 'contactId';
|
|
37
|
-
[k: string]: any;
|
|
38
|
-
})): Promise<AppendBulkResult>;
|
|
39
|
-
function create(collectionId: string, body: CreateBroadcastBody): Promise<BroadcastRecord>;
|
|
3
|
+
function create(collectionId: string, body: Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>): Promise<BroadcastRecord>;
|
|
40
4
|
function list(collectionId: string, query?: ListBroadcastsQuery): Promise<BroadcastList>;
|
|
41
5
|
function get(collectionId: string, id: string): Promise<BroadcastRecord>;
|
|
42
|
-
function update(collectionId: string, id: string, body:
|
|
6
|
+
function update(collectionId: string, id: string, body: Partial<Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>>): Promise<BroadcastRecord>;
|
|
43
7
|
function remove(collectionId: string, id: string): Promise<void>;
|
|
44
8
|
}
|
package/dist/api/broadcasts.js
CHANGED
|
@@ -17,61 +17,6 @@ function encodeQuery(params) {
|
|
|
17
17
|
}
|
|
18
18
|
export var broadcasts;
|
|
19
19
|
(function (broadcasts) {
|
|
20
|
-
/**
|
|
21
|
-
* POST /admin/collection/:collectionId/broadcasts/by-user
|
|
22
|
-
* Returns broadcast events array, newest first.
|
|
23
|
-
*/
|
|
24
|
-
async function byUser(collectionId, query = {}) {
|
|
25
|
-
const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/by-user`;
|
|
26
|
-
return post(path, query);
|
|
27
|
-
}
|
|
28
|
-
broadcasts.byUser = byUser;
|
|
29
|
-
/**
|
|
30
|
-
* POST /admin/collection/:collectionId/broadcasts/recipient-ids
|
|
31
|
-
* Returns recipient IDs for a broadcast.
|
|
32
|
-
*/
|
|
33
|
-
async function recipientIds(collectionId, query) {
|
|
34
|
-
const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/recipient-ids`;
|
|
35
|
-
return post(path, query);
|
|
36
|
-
}
|
|
37
|
-
broadcasts.recipientIds = recipientIds;
|
|
38
|
-
/**
|
|
39
|
-
* POST /admin/collection/:collectionId/broadcasts/recipients/without-action
|
|
40
|
-
* Returns IDs who received the broadcast but did not perform an action.
|
|
41
|
-
*/
|
|
42
|
-
async function recipientsWithoutAction(collectionId, query) {
|
|
43
|
-
const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/recipients/without-action`;
|
|
44
|
-
return post(path, query);
|
|
45
|
-
}
|
|
46
|
-
broadcasts.recipientsWithoutAction = recipientsWithoutAction;
|
|
47
|
-
/**
|
|
48
|
-
* POST /admin/collection/:collectionId/broadcasts/recipients/with-action
|
|
49
|
-
* Returns IDs who received the broadcast and performed an action; optionally includes outcome.
|
|
50
|
-
*/
|
|
51
|
-
async function recipientsWithAction(collectionId, query) {
|
|
52
|
-
const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/recipients/with-action`;
|
|
53
|
-
return post(path, query);
|
|
54
|
-
}
|
|
55
|
-
broadcasts.recipientsWithAction = recipientsWithAction;
|
|
56
|
-
/**
|
|
57
|
-
* POST /admin/collection/:collectionId/broadcasts/append
|
|
58
|
-
* Appends one broadcast event.
|
|
59
|
-
*/
|
|
60
|
-
async function append(collectionId, body) {
|
|
61
|
-
const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/append`;
|
|
62
|
-
return post(path, body);
|
|
63
|
-
}
|
|
64
|
-
broadcasts.append = append;
|
|
65
|
-
/**
|
|
66
|
-
* POST /admin/collection/:collectionId/broadcasts/append/bulk
|
|
67
|
-
* Appends many broadcast recipients.
|
|
68
|
-
* Accepts preferred body shape with params + ids, and legacy flat shape.
|
|
69
|
-
*/
|
|
70
|
-
async function appendBulk(collectionId, body) {
|
|
71
|
-
const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/append/bulk`;
|
|
72
|
-
return post(path, body);
|
|
73
|
-
}
|
|
74
|
-
broadcasts.appendBulk = appendBulk;
|
|
75
20
|
// CRUD: Create broadcast
|
|
76
21
|
async function create(collectionId, body) {
|
|
77
22
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/`;
|
package/dist/api/comms.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SendNotificationRequest, SendNotificationResponse } from "../types/comms";
|
|
1
|
+
import type { SendNotificationRequest, SendNotificationResponse, CommunicationEvent, CommsQueryByUser, CommsRecipientIdsQuery, CommsRecipientsWithoutActionQuery, CommsRecipientsWithActionQuery, RecipientId, RecipientWithOutcome, LogCommunicationEventBody, LogBulkCommunicationEventsBody, AppendResult, AppendBulkResult } from "../types/comms";
|
|
2
2
|
/**
|
|
3
3
|
* Communications namespace for sending notifications and managing user communications
|
|
4
4
|
*/
|
|
@@ -44,4 +44,39 @@ export declare namespace comms {
|
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
function sendNotification(collectionId: string, request: SendNotificationRequest): Promise<SendNotificationResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Analytics: Query communication events by user or contact.
|
|
49
|
+
* POST /admin/collection/:collectionId/comm/query/by-user
|
|
50
|
+
*/
|
|
51
|
+
function queryByUser(collectionId: string, body?: CommsQueryByUser): Promise<CommunicationEvent[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Analytics: Recipient IDs for a communication source.
|
|
54
|
+
* POST /admin/collection/:collectionId/comm/query/recipient-ids
|
|
55
|
+
*/
|
|
56
|
+
function queryRecipientIds(collectionId: string, body: CommsRecipientIdsQuery): Promise<RecipientId[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Analytics: Recipients who did not perform an action.
|
|
59
|
+
* POST /admin/collection/:collectionId/comm/query/recipients/without-action
|
|
60
|
+
*/
|
|
61
|
+
function queryRecipientsWithoutAction(collectionId: string, body: CommsRecipientsWithoutActionQuery): Promise<RecipientId[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Analytics: Recipients who performed an action, optionally with outcome.
|
|
64
|
+
* POST /admin/collection/:collectionId/comm/query/recipients/with-action
|
|
65
|
+
*/
|
|
66
|
+
function queryRecipientsWithAction(collectionId: string, body: CommsRecipientsWithActionQuery): Promise<RecipientId[] | RecipientWithOutcome[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Logging: Append a single communication event.
|
|
69
|
+
* POST /admin/collection/:collectionId/comm/log
|
|
70
|
+
*/
|
|
71
|
+
function logCommunicationEvent(collectionId: string, body: LogCommunicationEventBody): Promise<AppendResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Logging: Append many communication events for a list of IDs.
|
|
74
|
+
* POST /admin/collection/:collectionId/comm/log/bulk
|
|
75
|
+
*/
|
|
76
|
+
function logBulkCommunicationEvents(collectionId: string, body: LogBulkCommunicationEventsBody | ({
|
|
77
|
+
sourceId: string;
|
|
78
|
+
ids: string[];
|
|
79
|
+
idField?: 'userId' | 'contactId';
|
|
80
|
+
[k: string]: any;
|
|
81
|
+
})): Promise<AppendBulkResult>;
|
|
47
82
|
}
|
package/dist/api/comms.js
CHANGED
|
@@ -51,4 +51,58 @@ export var comms;
|
|
|
51
51
|
return post(path, request);
|
|
52
52
|
}
|
|
53
53
|
comms.sendNotification = sendNotification;
|
|
54
|
+
/**
|
|
55
|
+
* Analytics: Query communication events by user or contact.
|
|
56
|
+
* POST /admin/collection/:collectionId/comm/query/by-user
|
|
57
|
+
*/
|
|
58
|
+
async function queryByUser(collectionId, body = {}) {
|
|
59
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/query/by-user`;
|
|
60
|
+
return post(path, body);
|
|
61
|
+
}
|
|
62
|
+
comms.queryByUser = queryByUser;
|
|
63
|
+
/**
|
|
64
|
+
* Analytics: Recipient IDs for a communication source.
|
|
65
|
+
* POST /admin/collection/:collectionId/comm/query/recipient-ids
|
|
66
|
+
*/
|
|
67
|
+
async function queryRecipientIds(collectionId, body) {
|
|
68
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/query/recipient-ids`;
|
|
69
|
+
return post(path, body);
|
|
70
|
+
}
|
|
71
|
+
comms.queryRecipientIds = queryRecipientIds;
|
|
72
|
+
/**
|
|
73
|
+
* Analytics: Recipients who did not perform an action.
|
|
74
|
+
* POST /admin/collection/:collectionId/comm/query/recipients/without-action
|
|
75
|
+
*/
|
|
76
|
+
async function queryRecipientsWithoutAction(collectionId, body) {
|
|
77
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/query/recipients/without-action`;
|
|
78
|
+
return post(path, body);
|
|
79
|
+
}
|
|
80
|
+
comms.queryRecipientsWithoutAction = queryRecipientsWithoutAction;
|
|
81
|
+
/**
|
|
82
|
+
* Analytics: Recipients who performed an action, optionally with outcome.
|
|
83
|
+
* POST /admin/collection/:collectionId/comm/query/recipients/with-action
|
|
84
|
+
*/
|
|
85
|
+
async function queryRecipientsWithAction(collectionId, body) {
|
|
86
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/query/recipients/with-action`;
|
|
87
|
+
return post(path, body);
|
|
88
|
+
}
|
|
89
|
+
comms.queryRecipientsWithAction = queryRecipientsWithAction;
|
|
90
|
+
/**
|
|
91
|
+
* Logging: Append a single communication event.
|
|
92
|
+
* POST /admin/collection/:collectionId/comm/log
|
|
93
|
+
*/
|
|
94
|
+
async function logCommunicationEvent(collectionId, body) {
|
|
95
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/log`;
|
|
96
|
+
return post(path, body);
|
|
97
|
+
}
|
|
98
|
+
comms.logCommunicationEvent = logCommunicationEvent;
|
|
99
|
+
/**
|
|
100
|
+
* Logging: Append many communication events for a list of IDs.
|
|
101
|
+
* POST /admin/collection/:collectionId/comm/log/bulk
|
|
102
|
+
*/
|
|
103
|
+
async function logBulkCommunicationEvents(collectionId, body) {
|
|
104
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/comm/log/bulk`;
|
|
105
|
+
return post(path, body);
|
|
106
|
+
}
|
|
107
|
+
comms.logBulkCommunicationEvents = logBulkCommunicationEvents;
|
|
54
108
|
})(comms || (comms = {}));
|
|
@@ -1,83 +1,3 @@
|
|
|
1
|
-
import type { IdField } from './common';
|
|
2
|
-
export interface BroadcastEvent {
|
|
3
|
-
orgId: string;
|
|
4
|
-
broadcastId: string;
|
|
5
|
-
userId?: string;
|
|
6
|
-
contactId?: string;
|
|
7
|
-
channel?: string;
|
|
8
|
-
timestamp: string;
|
|
9
|
-
[k: string]: any;
|
|
10
|
-
}
|
|
11
|
-
export interface BroadcastQueryByUser {
|
|
12
|
-
userId?: string;
|
|
13
|
-
contactId?: string;
|
|
14
|
-
from?: string;
|
|
15
|
-
to?: string;
|
|
16
|
-
limit?: number;
|
|
17
|
-
}
|
|
18
|
-
export interface RecipientIdsQuery {
|
|
19
|
-
broadcastId: string;
|
|
20
|
-
idField?: IdField;
|
|
21
|
-
from?: string;
|
|
22
|
-
to?: string;
|
|
23
|
-
limit?: number;
|
|
24
|
-
}
|
|
25
|
-
export interface RecipientsWithoutActionQuery {
|
|
26
|
-
broadcastId: string;
|
|
27
|
-
actionId?: string;
|
|
28
|
-
appId?: string;
|
|
29
|
-
idField?: IdField;
|
|
30
|
-
from?: string;
|
|
31
|
-
to?: string;
|
|
32
|
-
limit?: number;
|
|
33
|
-
}
|
|
34
|
-
export interface RecipientsWithActionQuery {
|
|
35
|
-
broadcastId: string;
|
|
36
|
-
actionId?: string;
|
|
37
|
-
appId?: string;
|
|
38
|
-
outcome?: string;
|
|
39
|
-
idField?: IdField;
|
|
40
|
-
includeOutcome?: boolean;
|
|
41
|
-
from?: string;
|
|
42
|
-
to?: string;
|
|
43
|
-
limit?: number;
|
|
44
|
-
}
|
|
45
|
-
export type RecipientId = string;
|
|
46
|
-
export interface RecipientWithOutcome {
|
|
47
|
-
id: string;
|
|
48
|
-
outcome: string;
|
|
49
|
-
}
|
|
50
|
-
export interface AppendBroadcastBody {
|
|
51
|
-
broadcastId: string;
|
|
52
|
-
userId?: string;
|
|
53
|
-
contactId?: string;
|
|
54
|
-
channel?: string;
|
|
55
|
-
timestamp?: string;
|
|
56
|
-
[k: string]: any;
|
|
57
|
-
}
|
|
58
|
-
export interface AppendBroadcastBulkBody {
|
|
59
|
-
params: {
|
|
60
|
-
broadcastId: string;
|
|
61
|
-
[k: string]: any;
|
|
62
|
-
};
|
|
63
|
-
ids: string[];
|
|
64
|
-
idField?: IdField;
|
|
65
|
-
}
|
|
66
|
-
export interface AppendResult {
|
|
67
|
-
success: true;
|
|
68
|
-
}
|
|
69
|
-
export interface AppendBulkResult {
|
|
70
|
-
success: true;
|
|
71
|
-
count: number;
|
|
72
|
-
}
|
|
73
|
-
export interface CreateBroadcastBody {
|
|
74
|
-
appId: string;
|
|
75
|
-
data?: Record<string, any>;
|
|
76
|
-
}
|
|
77
|
-
export interface UpdateBroadcastBody {
|
|
78
|
-
appId?: string;
|
|
79
|
-
data?: Record<string, any>;
|
|
80
|
-
}
|
|
81
1
|
export interface ListBroadcastsQuery {
|
|
82
2
|
limit?: number;
|
|
83
3
|
offset?: number;
|
|
@@ -87,11 +7,11 @@ export interface BroadcastRecord {
|
|
|
87
7
|
id: string;
|
|
88
8
|
collectionId: string;
|
|
89
9
|
appId: string;
|
|
90
|
-
templateId?: string;
|
|
91
|
-
segmentId?: string;
|
|
92
|
-
status?:
|
|
93
|
-
scheduledAt?: string;
|
|
94
|
-
sentAt?: string;
|
|
10
|
+
templateId?: string | null;
|
|
11
|
+
segmentId?: string | null;
|
|
12
|
+
status?: string | null;
|
|
13
|
+
scheduledAt?: string | null;
|
|
14
|
+
sentAt?: string | null;
|
|
95
15
|
data?: {
|
|
96
16
|
display?: {
|
|
97
17
|
title?: string;
|
package/dist/types/comms.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IdField } from './common';
|
|
1
2
|
/**
|
|
2
3
|
* Target subject for notifications (product, collection, etc.)
|
|
3
4
|
*/
|
|
@@ -104,3 +105,86 @@ export interface SendNotificationResponse {
|
|
|
104
105
|
};
|
|
105
106
|
};
|
|
106
107
|
}
|
|
108
|
+
export interface CommunicationEvent {
|
|
109
|
+
orgId: string;
|
|
110
|
+
broadcastId?: string;
|
|
111
|
+
journeyId?: string;
|
|
112
|
+
userId?: string;
|
|
113
|
+
contactId?: string;
|
|
114
|
+
channel?: string;
|
|
115
|
+
timestamp: string;
|
|
116
|
+
eventType: string;
|
|
117
|
+
outcome?: string | null;
|
|
118
|
+
templateId?: string | null;
|
|
119
|
+
[k: string]: any;
|
|
120
|
+
}
|
|
121
|
+
export interface CommsQueryByUser {
|
|
122
|
+
userId?: string;
|
|
123
|
+
contactId?: string;
|
|
124
|
+
from?: string;
|
|
125
|
+
to?: string;
|
|
126
|
+
limit?: number;
|
|
127
|
+
}
|
|
128
|
+
export type RecipientId = string;
|
|
129
|
+
export interface RecipientWithOutcome {
|
|
130
|
+
id: string;
|
|
131
|
+
outcome: string;
|
|
132
|
+
}
|
|
133
|
+
export interface CommsRecipientIdsQuery {
|
|
134
|
+
broadcastId?: string;
|
|
135
|
+
journeyId?: string;
|
|
136
|
+
idField?: IdField;
|
|
137
|
+
from?: string;
|
|
138
|
+
to?: string;
|
|
139
|
+
limit?: number;
|
|
140
|
+
}
|
|
141
|
+
export interface CommsRecipientsWithoutActionQuery {
|
|
142
|
+
broadcastId?: string;
|
|
143
|
+
journeyId?: string;
|
|
144
|
+
actionId?: string;
|
|
145
|
+
appId?: string;
|
|
146
|
+
idField?: IdField;
|
|
147
|
+
from?: string;
|
|
148
|
+
to?: string;
|
|
149
|
+
limit?: number;
|
|
150
|
+
}
|
|
151
|
+
export interface CommsRecipientsWithActionQuery {
|
|
152
|
+
broadcastId?: string;
|
|
153
|
+
journeyId?: string;
|
|
154
|
+
actionId?: string;
|
|
155
|
+
appId?: string;
|
|
156
|
+
outcome?: string;
|
|
157
|
+
idField?: IdField;
|
|
158
|
+
includeOutcome?: boolean;
|
|
159
|
+
from?: string;
|
|
160
|
+
to?: string;
|
|
161
|
+
limit?: number;
|
|
162
|
+
}
|
|
163
|
+
export interface LogCommunicationEventBody {
|
|
164
|
+
broadcastId?: string;
|
|
165
|
+
journeyId?: string;
|
|
166
|
+
userId?: string;
|
|
167
|
+
contactId?: string;
|
|
168
|
+
channel?: string;
|
|
169
|
+
eventType: string;
|
|
170
|
+
outcome?: string;
|
|
171
|
+
templateId?: string;
|
|
172
|
+
timestamp?: string;
|
|
173
|
+
[k: string]: any;
|
|
174
|
+
}
|
|
175
|
+
export interface LogBulkCommunicationEventsBody {
|
|
176
|
+
params: {
|
|
177
|
+
broadcastId?: string;
|
|
178
|
+
journeyId?: string;
|
|
179
|
+
[k: string]: any;
|
|
180
|
+
};
|
|
181
|
+
ids: string[];
|
|
182
|
+
idField?: IdField;
|
|
183
|
+
}
|
|
184
|
+
export interface AppendResult {
|
|
185
|
+
success: true;
|
|
186
|
+
}
|
|
187
|
+
export interface AppendBulkResult {
|
|
188
|
+
success: true;
|
|
189
|
+
count: number;
|
|
190
|
+
}
|
package/dist/types/comms.js
CHANGED