@unboundcx/sdk 2.6.9 → 2.6.10
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/package.json +1 -1
- package/services/messaging.js +384 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.10",
|
|
4
4
|
"description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
package/services/messaging.js
CHANGED
|
@@ -626,20 +626,6 @@ export class TollFreeCampaignsService {
|
|
|
626
626
|
return result;
|
|
627
627
|
}
|
|
628
628
|
|
|
629
|
-
async get(campaignId) {
|
|
630
|
-
this.sdk.validateParams(
|
|
631
|
-
{ campaignId },
|
|
632
|
-
{
|
|
633
|
-
campaignId: { type: 'string', required: true },
|
|
634
|
-
},
|
|
635
|
-
);
|
|
636
|
-
|
|
637
|
-
const result = await this.sdk._fetch(
|
|
638
|
-
`/messaging/campaigns/tollfree/${campaignId}`,
|
|
639
|
-
'GET',
|
|
640
|
-
);
|
|
641
|
-
return result;
|
|
642
|
-
}
|
|
643
629
|
|
|
644
630
|
async list() {
|
|
645
631
|
const result = await this.sdk._fetch(
|
|
@@ -658,13 +644,13 @@ export class TollFreeCampaignsService {
|
|
|
658
644
|
);
|
|
659
645
|
|
|
660
646
|
const result = await this.sdk._fetch(
|
|
661
|
-
`/messaging/campaigns/tollfree/${campaignId}
|
|
662
|
-
'
|
|
647
|
+
`/messaging/campaigns/tollfree/refresh/${campaignId}`,
|
|
648
|
+
'GET',
|
|
663
649
|
);
|
|
664
650
|
return result;
|
|
665
651
|
}
|
|
666
652
|
|
|
667
|
-
async
|
|
653
|
+
async getPhoneNumberCampaignStatus(phoneNumber) {
|
|
668
654
|
this.sdk.validateParams(
|
|
669
655
|
{ phoneNumber },
|
|
670
656
|
{
|
|
@@ -672,14 +658,9 @@ export class TollFreeCampaignsService {
|
|
|
672
658
|
},
|
|
673
659
|
);
|
|
674
660
|
|
|
675
|
-
const options = {
|
|
676
|
-
query: { phoneNumber },
|
|
677
|
-
};
|
|
678
|
-
|
|
679
661
|
const result = await this.sdk._fetch(
|
|
680
|
-
|
|
662
|
+
`/messaging/campaigns/tollfree/phoneNumber/${encodeURIComponent(phoneNumber)}/campaignStatus`,
|
|
681
663
|
'GET',
|
|
682
|
-
options,
|
|
683
664
|
);
|
|
684
665
|
return result;
|
|
685
666
|
}
|
|
@@ -688,9 +669,51 @@ export class TollFreeCampaignsService {
|
|
|
688
669
|
export class TenDlcCampaignsService {
|
|
689
670
|
constructor(sdk) {
|
|
690
671
|
this.sdk = sdk;
|
|
672
|
+
this.brands = new TenDlcBrandsService(sdk);
|
|
673
|
+
this.campaigns = new TenDlcCampaignManagementService(sdk);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Get phone number campaign status for 10DLC
|
|
678
|
+
* @param {string} phoneNumber - Phone number to check
|
|
679
|
+
* @returns {Promise<Object>} Campaign status information
|
|
680
|
+
*/
|
|
681
|
+
async getPhoneNumberCampaignStatus(phoneNumber) {
|
|
682
|
+
this.sdk.validateParams(
|
|
683
|
+
{ phoneNumber },
|
|
684
|
+
{
|
|
685
|
+
phoneNumber: { type: 'string', required: true },
|
|
686
|
+
},
|
|
687
|
+
);
|
|
688
|
+
|
|
689
|
+
const result = await this.sdk._fetch(
|
|
690
|
+
`/messaging/campaigns/10dlc/phoneNumber/${encodeURIComponent(phoneNumber)}/campaignStatus`,
|
|
691
|
+
'GET',
|
|
692
|
+
);
|
|
693
|
+
return result;
|
|
691
694
|
}
|
|
695
|
+
}
|
|
692
696
|
|
|
693
|
-
|
|
697
|
+
export class TenDlcBrandsService {
|
|
698
|
+
constructor(sdk) {
|
|
699
|
+
this.sdk = sdk;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* List all 10DLC brands
|
|
704
|
+
*/
|
|
705
|
+
async list() {
|
|
706
|
+
const result = await this.sdk._fetch(
|
|
707
|
+
'/messaging/campaigns/10dlc/brand',
|
|
708
|
+
'GET',
|
|
709
|
+
);
|
|
710
|
+
return result;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Create a new 10DLC brand
|
|
715
|
+
*/
|
|
716
|
+
async create({
|
|
694
717
|
companyName,
|
|
695
718
|
ein,
|
|
696
719
|
website,
|
|
@@ -747,7 +770,28 @@ export class TenDlcCampaignsService {
|
|
|
747
770
|
return result;
|
|
748
771
|
}
|
|
749
772
|
|
|
750
|
-
|
|
773
|
+
/**
|
|
774
|
+
* Get a 10DLC brand by ID
|
|
775
|
+
*/
|
|
776
|
+
async get(brandId) {
|
|
777
|
+
this.sdk.validateParams(
|
|
778
|
+
{ brandId },
|
|
779
|
+
{
|
|
780
|
+
brandId: { type: 'string', required: true },
|
|
781
|
+
},
|
|
782
|
+
);
|
|
783
|
+
|
|
784
|
+
const result = await this.sdk._fetch(
|
|
785
|
+
`/messaging/campaigns/10dlc/brand/${brandId}`,
|
|
786
|
+
'GET',
|
|
787
|
+
);
|
|
788
|
+
return result;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Update a 10DLC brand
|
|
793
|
+
*/
|
|
794
|
+
async update(brandId, { companyName, website }) {
|
|
751
795
|
this.sdk.validateParams(
|
|
752
796
|
{ brandId },
|
|
753
797
|
{
|
|
@@ -772,4 +816,319 @@ export class TenDlcCampaignsService {
|
|
|
772
816
|
);
|
|
773
817
|
return result;
|
|
774
818
|
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Delete a 10DLC brand
|
|
822
|
+
*/
|
|
823
|
+
async delete(brandId) {
|
|
824
|
+
this.sdk.validateParams(
|
|
825
|
+
{ brandId },
|
|
826
|
+
{
|
|
827
|
+
brandId: { type: 'string', required: true },
|
|
828
|
+
},
|
|
829
|
+
);
|
|
830
|
+
|
|
831
|
+
const result = await this.sdk._fetch(
|
|
832
|
+
`/messaging/campaigns/10dlc/brand/${brandId}`,
|
|
833
|
+
'DELETE',
|
|
834
|
+
);
|
|
835
|
+
return result;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Revet a 10DLC brand
|
|
840
|
+
*/
|
|
841
|
+
async revet(brandId) {
|
|
842
|
+
this.sdk.validateParams(
|
|
843
|
+
{ brandId },
|
|
844
|
+
{
|
|
845
|
+
brandId: { type: 'string', required: true },
|
|
846
|
+
},
|
|
847
|
+
);
|
|
848
|
+
|
|
849
|
+
const result = await this.sdk._fetch(
|
|
850
|
+
`/messaging/campaigns/10dlc/brand/${brandId}/revet`,
|
|
851
|
+
'PUT',
|
|
852
|
+
);
|
|
853
|
+
return result;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Get brand feedback
|
|
858
|
+
*/
|
|
859
|
+
async getFeedback(brandId) {
|
|
860
|
+
this.sdk.validateParams(
|
|
861
|
+
{ brandId },
|
|
862
|
+
{
|
|
863
|
+
brandId: { type: 'string', required: true },
|
|
864
|
+
},
|
|
865
|
+
);
|
|
866
|
+
|
|
867
|
+
const result = await this.sdk._fetch(
|
|
868
|
+
`/messaging/campaigns/10dlc/brand/${brandId}/feedback`,
|
|
869
|
+
'GET',
|
|
870
|
+
);
|
|
871
|
+
return result;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Create external brand vetting
|
|
876
|
+
*/
|
|
877
|
+
async createExternalVetting(brandId, vettingData) {
|
|
878
|
+
this.sdk.validateParams(
|
|
879
|
+
{ brandId },
|
|
880
|
+
{
|
|
881
|
+
brandId: { type: 'string', required: true },
|
|
882
|
+
vettingData: { type: 'object', required: false },
|
|
883
|
+
},
|
|
884
|
+
);
|
|
885
|
+
|
|
886
|
+
const options = {
|
|
887
|
+
body: vettingData || {},
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
const result = await this.sdk._fetch(
|
|
891
|
+
`/messaging/campaigns/10dlc/brand/${brandId}/externalVetting`,
|
|
892
|
+
'POST',
|
|
893
|
+
options,
|
|
894
|
+
);
|
|
895
|
+
return result;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* Get brand external vetting responses
|
|
900
|
+
*/
|
|
901
|
+
async getExternalVettingResponses(brandId) {
|
|
902
|
+
this.sdk.validateParams(
|
|
903
|
+
{ brandId },
|
|
904
|
+
{
|
|
905
|
+
brandId: { type: 'string', required: true },
|
|
906
|
+
},
|
|
907
|
+
);
|
|
908
|
+
|
|
909
|
+
const result = await this.sdk._fetch(
|
|
910
|
+
`/messaging/campaigns/10dlc/brand/${brandId}/externalvetting/responses`,
|
|
911
|
+
'GET',
|
|
912
|
+
);
|
|
913
|
+
return result;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
export class TenDlcCampaignManagementService {
|
|
918
|
+
constructor(sdk) {
|
|
919
|
+
this.sdk = sdk;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* List all 10DLC campaigns
|
|
924
|
+
*/
|
|
925
|
+
async list() {
|
|
926
|
+
const result = await this.sdk._fetch(
|
|
927
|
+
'/messaging/campaigns/10dlc/campaign',
|
|
928
|
+
'GET',
|
|
929
|
+
);
|
|
930
|
+
return result;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Create a new 10DLC campaign
|
|
935
|
+
*/
|
|
936
|
+
async create(campaignData) {
|
|
937
|
+
this.sdk.validateParams(
|
|
938
|
+
campaignData,
|
|
939
|
+
{
|
|
940
|
+
brandId: { type: 'string', required: true },
|
|
941
|
+
description: { type: 'string', required: true },
|
|
942
|
+
messageFlow: { type: 'string', required: true },
|
|
943
|
+
helpMessage: { type: 'string', required: false },
|
|
944
|
+
optInMessage: { type: 'string', required: false },
|
|
945
|
+
optOutMessage: { type: 'string', required: false },
|
|
946
|
+
useCase: { type: 'string', required: false },
|
|
947
|
+
vertical: { type: 'string', required: false },
|
|
948
|
+
},
|
|
949
|
+
);
|
|
950
|
+
|
|
951
|
+
const options = {
|
|
952
|
+
body: campaignData,
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
const result = await this.sdk._fetch(
|
|
956
|
+
'/messaging/campaigns/10dlc/campaign',
|
|
957
|
+
'POST',
|
|
958
|
+
options,
|
|
959
|
+
);
|
|
960
|
+
return result;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Get a 10DLC campaign by ID
|
|
965
|
+
*/
|
|
966
|
+
async get(campaignId) {
|
|
967
|
+
this.sdk.validateParams(
|
|
968
|
+
{ campaignId },
|
|
969
|
+
{
|
|
970
|
+
campaignId: { type: 'string', required: true },
|
|
971
|
+
},
|
|
972
|
+
);
|
|
973
|
+
|
|
974
|
+
const result = await this.sdk._fetch(
|
|
975
|
+
`/messaging/campaigns/10dlc/campaign/${campaignId}`,
|
|
976
|
+
'GET',
|
|
977
|
+
);
|
|
978
|
+
return result;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Update a 10DLC campaign
|
|
983
|
+
*/
|
|
984
|
+
async update(campaignId, updateData) {
|
|
985
|
+
this.sdk.validateParams(
|
|
986
|
+
{ campaignId },
|
|
987
|
+
{
|
|
988
|
+
campaignId: { type: 'string', required: true },
|
|
989
|
+
description: { type: 'string', required: false },
|
|
990
|
+
messageFlow: { type: 'string', required: false },
|
|
991
|
+
helpMessage: { type: 'string', required: false },
|
|
992
|
+
optInMessage: { type: 'string', required: false },
|
|
993
|
+
optOutMessage: { type: 'string', required: false },
|
|
994
|
+
},
|
|
995
|
+
);
|
|
996
|
+
|
|
997
|
+
const options = {
|
|
998
|
+
body: updateData,
|
|
999
|
+
};
|
|
1000
|
+
|
|
1001
|
+
const result = await this.sdk._fetch(
|
|
1002
|
+
`/messaging/campaigns/10dlc/campaign/${campaignId}`,
|
|
1003
|
+
'PUT',
|
|
1004
|
+
options,
|
|
1005
|
+
);
|
|
1006
|
+
return result;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* Delete a 10DLC campaign
|
|
1011
|
+
*/
|
|
1012
|
+
async delete(campaignId) {
|
|
1013
|
+
this.sdk.validateParams(
|
|
1014
|
+
{ campaignId },
|
|
1015
|
+
{
|
|
1016
|
+
campaignId: { type: 'string', required: true },
|
|
1017
|
+
},
|
|
1018
|
+
);
|
|
1019
|
+
|
|
1020
|
+
const result = await this.sdk._fetch(
|
|
1021
|
+
`/messaging/campaigns/10dlc/campaign/${campaignId}`,
|
|
1022
|
+
'DELETE',
|
|
1023
|
+
);
|
|
1024
|
+
return result;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* Get campaign operation status
|
|
1029
|
+
*/
|
|
1030
|
+
async getOperationStatus(campaignId) {
|
|
1031
|
+
this.sdk.validateParams(
|
|
1032
|
+
{ campaignId },
|
|
1033
|
+
{
|
|
1034
|
+
campaignId: { type: 'string', required: true },
|
|
1035
|
+
},
|
|
1036
|
+
);
|
|
1037
|
+
|
|
1038
|
+
const result = await this.sdk._fetch(
|
|
1039
|
+
`/messaging/campaigns/10dlc/campaign/${campaignId}/operationStatus`,
|
|
1040
|
+
'GET',
|
|
1041
|
+
);
|
|
1042
|
+
return result;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Get MNO campaign metadata
|
|
1047
|
+
*/
|
|
1048
|
+
async getMnoMetaData(campaignId) {
|
|
1049
|
+
this.sdk.validateParams(
|
|
1050
|
+
{ campaignId },
|
|
1051
|
+
{
|
|
1052
|
+
campaignId: { type: 'string', required: true },
|
|
1053
|
+
},
|
|
1054
|
+
);
|
|
1055
|
+
|
|
1056
|
+
const result = await this.sdk._fetch(
|
|
1057
|
+
`/messaging/campaigns/10dlc/campaign/${campaignId}/mnoMetaData`,
|
|
1058
|
+
'GET',
|
|
1059
|
+
);
|
|
1060
|
+
return result;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Add phone number to campaign
|
|
1065
|
+
*/
|
|
1066
|
+
async addPhoneNumber(campaignId, phoneNumberData) {
|
|
1067
|
+
this.sdk.validateParams(
|
|
1068
|
+
{ campaignId, phoneNumberData },
|
|
1069
|
+
{
|
|
1070
|
+
campaignId: { type: 'string', required: true },
|
|
1071
|
+
phoneNumberData: { type: 'object', required: true },
|
|
1072
|
+
},
|
|
1073
|
+
);
|
|
1074
|
+
|
|
1075
|
+
const options = {
|
|
1076
|
+
body: phoneNumberData,
|
|
1077
|
+
};
|
|
1078
|
+
|
|
1079
|
+
const result = await this.sdk._fetch(
|
|
1080
|
+
`/messaging/campaigns/10dlc/campaign/${campaignId}/phoneNumber`,
|
|
1081
|
+
'POST',
|
|
1082
|
+
options,
|
|
1083
|
+
);
|
|
1084
|
+
return result;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Update phone number in campaign
|
|
1089
|
+
*/
|
|
1090
|
+
async updatePhoneNumber(campaignId, phoneNumberData) {
|
|
1091
|
+
this.sdk.validateParams(
|
|
1092
|
+
{ campaignId, phoneNumberData },
|
|
1093
|
+
{
|
|
1094
|
+
campaignId: { type: 'string', required: true },
|
|
1095
|
+
phoneNumberData: { type: 'object', required: true },
|
|
1096
|
+
},
|
|
1097
|
+
);
|
|
1098
|
+
|
|
1099
|
+
const options = {
|
|
1100
|
+
body: phoneNumberData,
|
|
1101
|
+
};
|
|
1102
|
+
|
|
1103
|
+
const result = await this.sdk._fetch(
|
|
1104
|
+
`/messaging/campaigns/10dlc/campaign/${campaignId}/phoneNumber`,
|
|
1105
|
+
'PUT',
|
|
1106
|
+
options,
|
|
1107
|
+
);
|
|
1108
|
+
return result;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Remove phone number from campaign
|
|
1113
|
+
*/
|
|
1114
|
+
async removePhoneNumber(campaignId, phoneNumberData) {
|
|
1115
|
+
this.sdk.validateParams(
|
|
1116
|
+
{ campaignId, phoneNumberData },
|
|
1117
|
+
{
|
|
1118
|
+
campaignId: { type: 'string', required: true },
|
|
1119
|
+
phoneNumberData: { type: 'object', required: true },
|
|
1120
|
+
},
|
|
1121
|
+
);
|
|
1122
|
+
|
|
1123
|
+
const options = {
|
|
1124
|
+
body: phoneNumberData,
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1127
|
+
const result = await this.sdk._fetch(
|
|
1128
|
+
`/messaging/campaigns/10dlc/campaign/${campaignId}/phoneNumber`,
|
|
1129
|
+
'DELETE',
|
|
1130
|
+
options,
|
|
1131
|
+
);
|
|
1132
|
+
return result;
|
|
1133
|
+
}
|
|
775
1134
|
}
|