@unboundcx/sdk 2.6.13 → 2.6.15

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/services/messaging.js +285 -49
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "2.6.13",
3
+ "version": "2.6.15",
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",
@@ -799,11 +799,30 @@ export class TollFreeCampaignsService {
799
799
  return result;
800
800
  }
801
801
 
802
- async list() {
803
- const result = await this.sdk._fetch(
804
- '/messaging/campaigns/tollfree',
805
- 'GET',
806
- );
802
+ /**
803
+ * List all toll-free campaigns with optional filtering
804
+ * @param {Object} [params] - Filter parameters
805
+ * @param {number} [params.page=1] - Page number
806
+ * @param {number} [params.limit=50] - Items per page
807
+ * @param {string} [params.name] - Filter by campaign name
808
+ * @param {string} [params.status] - Filter by status
809
+ * @param {string} [params.operatorType='contains'] - Filter operator: contains, equals, startsWith, endsWith
810
+ * @returns {Promise<Array>} List of campaigns
811
+ */
812
+ async list({ page, limit, name, status, operatorType } = {}) {
813
+ const queryParams = new URLSearchParams();
814
+
815
+ if (page !== undefined) queryParams.append('page', page);
816
+ if (limit !== undefined) queryParams.append('limit', limit);
817
+ if (name) queryParams.append('name', name);
818
+ if (status) queryParams.append('status', status);
819
+ if (operatorType) queryParams.append('operatorType', operatorType);
820
+
821
+ const url = queryParams.toString()
822
+ ? `/messaging/campaigns/tollfree?${queryParams.toString()}`
823
+ : '/messaging/campaigns/tollfree';
824
+
825
+ const result = await this.sdk._fetch(url, 'GET');
807
826
  return result;
808
827
  }
809
828
 
@@ -876,63 +895,135 @@ export class TenDlcBrandsService {
876
895
  }
877
896
 
878
897
  /**
879
- * List all 10DLC brands
898
+ * List all 10DLC brands with optional filtering
899
+ * @param {Object} [params] - Filter parameters
900
+ * @param {number} [params.page=1] - Page number
901
+ * @param {number} [params.limit=50] - Items per page
902
+ * @param {string} [params.name] - Filter by brand name
903
+ * @param {string} [params.status] - Filter by status
904
+ * @param {string} [params.operatorType='contains'] - Filter operator: contains, equals, startsWith, endsWith
905
+ * @returns {Promise<Array>} List of brands
880
906
  */
881
- async list() {
882
- const result = await this.sdk._fetch(
883
- '/messaging/campaigns/10dlc/brand',
884
- 'GET',
885
- );
907
+ async list({ page, limit, name, status, operatorType } = {}) {
908
+ const queryParams = new URLSearchParams();
909
+
910
+ if (page !== undefined) queryParams.append('page', page);
911
+ if (limit !== undefined) queryParams.append('limit', limit);
912
+ if (name) queryParams.append('name', name);
913
+ if (status) queryParams.append('status', status);
914
+ if (operatorType) queryParams.append('operatorType', operatorType);
915
+
916
+ const url = queryParams.toString()
917
+ ? `/messaging/campaigns/10dlc/brand?${queryParams.toString()}`
918
+ : '/messaging/campaigns/10dlc/brand';
919
+
920
+ const result = await this.sdk._fetch(url, 'GET');
886
921
  return result;
887
922
  }
888
923
 
889
924
  /**
890
925
  * Create a new 10DLC brand
926
+ * @param {Object} params - Brand parameters
927
+ * @param {string} params.name - Brand display name (required)
928
+ * @param {string} params.entityType - Entity type: PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT (required)
929
+ * @param {string} [params.cspId] - CSP ID for resellers
930
+ * @param {string} params.companyName - Company name (required)
931
+ * @param {string} [params.ein] - Employer Identification Number
932
+ * @param {string} params.address1 - Street address (required)
933
+ * @param {string} [params.address2] - Street address line 2
934
+ * @param {string} params.city - City (required)
935
+ * @param {string} params.state - State (required)
936
+ * @param {string} params.postalCode - Postal code (required)
937
+ * @param {string} params.country - Country (required)
938
+ * @param {string} [params.pocFirstName] - Point of contact first name
939
+ * @param {string} [params.pocLastName] - Point of contact last name
940
+ * @param {string} params.pocEmail - Point of contact email (required)
941
+ * @param {string} params.pocPhone - Point of contact phone (required)
942
+ * @param {string} [params.stockSymbol] - Stock symbol for public companies
943
+ * @param {string} [params.stockExchange] - Stock exchange for public companies
944
+ * @param {string} [params.website] - Company website
945
+ * @param {string} params.vertical - Business vertical (required)
946
+ * @param {string} [params.altBusinessId] - Alternative business ID
947
+ * @param {string} [params.altBusinessIdType] - Alternative business ID type
948
+ * @param {string} [params.brandRelationship] - Brand relationship
949
+ * @returns {Promise<Object>} Created brand details
891
950
  */
892
951
  async create({
952
+ name,
953
+ entityType,
954
+ cspId,
893
955
  companyName,
894
956
  ein,
895
- website,
957
+ address1,
958
+ address2,
959
+ city,
960
+ state,
961
+ postalCode,
962
+ country,
963
+ pocFirstName,
964
+ pocLastName,
965
+ pocEmail,
966
+ pocPhone,
896
967
  stockSymbol,
897
968
  stockExchange,
898
- ipPooling,
899
- optInMessage,
900
- optInKeywords,
901
- optOutMessage,
902
- optOutKeywords,
903
- helpMessage,
904
- helpKeywords,
969
+ website,
970
+ vertical,
971
+ altBusinessId,
972
+ altBusinessIdType,
973
+ brandRelationship,
905
974
  }) {
906
975
  this.sdk.validateParams(
907
- { companyName },
976
+ { name, entityType, companyName, address1, city, state, postalCode, country, pocEmail, pocPhone, vertical },
908
977
  {
978
+ name: { type: 'string', required: true },
979
+ entityType: { type: 'string', required: true },
980
+ cspId: { type: 'string', required: false },
909
981
  companyName: { type: 'string', required: true },
910
982
  ein: { type: 'string', required: false },
911
- website: { type: 'string', required: false },
983
+ address1: { type: 'string', required: true },
984
+ address2: { type: 'string', required: false },
985
+ city: { type: 'string', required: true },
986
+ state: { type: 'string', required: true },
987
+ postalCode: { type: 'string', required: true },
988
+ country: { type: 'string', required: true },
989
+ pocFirstName: { type: 'string', required: false },
990
+ pocLastName: { type: 'string', required: false },
991
+ pocEmail: { type: 'string', required: true },
992
+ pocPhone: { type: 'string', required: true },
912
993
  stockSymbol: { type: 'string', required: false },
913
994
  stockExchange: { type: 'string', required: false },
914
- ipPooling: { type: 'boolean', required: false },
915
- optInMessage: { type: 'string', required: false },
916
- optInKeywords: { type: 'array', required: false },
917
- optOutMessage: { type: 'string', required: false },
918
- optOutKeywords: { type: 'array', required: false },
919
- helpMessage: { type: 'string', required: false },
920
- helpKeywords: { type: 'array', required: false },
995
+ website: { type: 'string', required: false },
996
+ vertical: { type: 'string', required: true },
997
+ altBusinessId: { type: 'string', required: false },
998
+ altBusinessIdType: { type: 'string', required: false },
999
+ brandRelationship: { type: 'string', required: false },
921
1000
  },
922
1001
  );
923
1002
 
924
- const brandData = { companyName };
1003
+ const brandData = {
1004
+ name,
1005
+ entityType,
1006
+ companyName,
1007
+ address1,
1008
+ city,
1009
+ state,
1010
+ postalCode,
1011
+ country,
1012
+ pocEmail,
1013
+ pocPhone,
1014
+ vertical,
1015
+ };
1016
+ if (cspId) brandData.cspId = cspId;
925
1017
  if (ein) brandData.ein = ein;
926
- if (website) brandData.website = website;
1018
+ if (address2) brandData.address2 = address2;
1019
+ if (pocFirstName) brandData.pocFirstName = pocFirstName;
1020
+ if (pocLastName) brandData.pocLastName = pocLastName;
927
1021
  if (stockSymbol) brandData.stockSymbol = stockSymbol;
928
1022
  if (stockExchange) brandData.stockExchange = stockExchange;
929
- if (ipPooling !== undefined) brandData.ipPooling = ipPooling;
930
- if (optInMessage) brandData.optInMessage = optInMessage;
931
- if (optInKeywords) brandData.optInKeywords = optInKeywords;
932
- if (optOutMessage) brandData.optOutMessage = optOutMessage;
933
- if (optOutKeywords) brandData.optOutKeywords = optOutKeywords;
934
- if (helpMessage) brandData.helpMessage = helpMessage;
935
- if (helpKeywords) brandData.helpKeywords = helpKeywords;
1023
+ if (website) brandData.website = website;
1024
+ if (altBusinessId) brandData.altBusinessId = altBusinessId;
1025
+ if (altBusinessIdType) brandData.altBusinessIdType = altBusinessIdType;
1026
+ if (brandRelationship) brandData.brandRelationship = brandRelationship;
936
1027
 
937
1028
  const options = {
938
1029
  body: brandData,
@@ -948,6 +1039,8 @@ export class TenDlcBrandsService {
948
1039
 
949
1040
  /**
950
1041
  * Get a 10DLC brand by ID
1042
+ * @param {string} brandId - Brand ID (required)
1043
+ * @returns {Promise<Object>} Brand details
951
1044
  */
952
1045
  async get(brandId) {
953
1046
  this.sdk.validateParams(
@@ -966,20 +1059,116 @@ export class TenDlcBrandsService {
966
1059
 
967
1060
  /**
968
1061
  * Update a 10DLC brand
1062
+ * @param {string} brandId - Brand ID to update (required)
1063
+ * @param {Object} params - Brand parameters to update
1064
+ * @param {string} [params.name] - Brand display name
1065
+ * @param {string} [params.entityType] - Entity type: PRIVATE_PROFIT, PUBLIC_PROFIT, NON_PROFIT
1066
+ * @param {string} [params.cspId] - CSP ID for resellers
1067
+ * @param {string} [params.companyName] - Company name
1068
+ * @param {string} [params.ein] - Employer Identification Number
1069
+ * @param {string} [params.address1] - Street address
1070
+ * @param {string} [params.address2] - Street address line 2
1071
+ * @param {string} [params.city] - City
1072
+ * @param {string} [params.state] - State
1073
+ * @param {string} [params.postalCode] - Postal code
1074
+ * @param {string} [params.country] - Country
1075
+ * @param {string} [params.pocEmail] - Point of contact email
1076
+ * @param {string} [params.pocPhone] - Point of contact phone
1077
+ * @param {string} [params.stockSymbol] - Stock symbol for public companies
1078
+ * @param {string} [params.stockExchange] - Stock exchange for public companies
1079
+ * @param {string} [params.website] - Company website
1080
+ * @param {string} [params.vertical] - Business vertical
1081
+ * @param {string} [params.altBusinessId] - Alternative business ID
1082
+ * @param {string} [params.altBusinessIdType] - Alternative business ID type
1083
+ * @param {string} [params.brandRelationship] - Brand relationship
1084
+ * @param {string} [params.businessContactEmail] - Business contact email for 2025 compliance
1085
+ * @param {string} [params.firstName] - First name for 2025 compliance
1086
+ * @param {string} [params.lastName] - Last name for 2025 compliance
1087
+ * @param {string} [params.mobilePhone] - Mobile phone for 2025 compliance
1088
+ * @returns {Promise<Object>} Updated brand details
969
1089
  */
970
- async update(brandId, { companyName, website }) {
1090
+ async update(brandId, {
1091
+ name,
1092
+ entityType,
1093
+ cspId,
1094
+ companyName,
1095
+ ein,
1096
+ address1,
1097
+ address2,
1098
+ city,
1099
+ state,
1100
+ postalCode,
1101
+ country,
1102
+ pocEmail,
1103
+ pocPhone,
1104
+ stockSymbol,
1105
+ stockExchange,
1106
+ website,
1107
+ vertical,
1108
+ altBusinessId,
1109
+ altBusinessIdType,
1110
+ brandRelationship,
1111
+ businessContactEmail,
1112
+ firstName,
1113
+ lastName,
1114
+ mobilePhone,
1115
+ } = {}) {
971
1116
  this.sdk.validateParams(
972
1117
  { brandId },
973
1118
  {
974
1119
  brandId: { type: 'string', required: true },
1120
+ name: { type: 'string', required: false },
1121
+ entityType: { type: 'string', required: false },
1122
+ cspId: { type: 'string', required: false },
975
1123
  companyName: { type: 'string', required: false },
1124
+ ein: { type: 'string', required: false },
1125
+ address1: { type: 'string', required: false },
1126
+ address2: { type: 'string', required: false },
1127
+ city: { type: 'string', required: false },
1128
+ state: { type: 'string', required: false },
1129
+ postalCode: { type: 'string', required: false },
1130
+ country: { type: 'string', required: false },
1131
+ pocEmail: { type: 'string', required: false },
1132
+ pocPhone: { type: 'string', required: false },
1133
+ stockSymbol: { type: 'string', required: false },
1134
+ stockExchange: { type: 'string', required: false },
976
1135
  website: { type: 'string', required: false },
1136
+ vertical: { type: 'string', required: false },
1137
+ altBusinessId: { type: 'string', required: false },
1138
+ altBusinessIdType: { type: 'string', required: false },
1139
+ brandRelationship: { type: 'string', required: false },
1140
+ businessContactEmail: { type: 'string', required: false },
1141
+ firstName: { type: 'string', required: false },
1142
+ lastName: { type: 'string', required: false },
1143
+ mobilePhone: { type: 'string', required: false },
977
1144
  },
978
1145
  );
979
1146
 
980
1147
  const updateData = {};
981
- if (companyName) updateData.companyName = companyName;
982
- if (website) updateData.website = website;
1148
+ if (name !== undefined) updateData.name = name;
1149
+ if (entityType !== undefined) updateData.entityType = entityType;
1150
+ if (cspId !== undefined) updateData.cspId = cspId;
1151
+ if (companyName !== undefined) updateData.companyName = companyName;
1152
+ if (ein !== undefined) updateData.ein = ein;
1153
+ if (address1 !== undefined) updateData.address1 = address1;
1154
+ if (address2 !== undefined) updateData.address2 = address2;
1155
+ if (city !== undefined) updateData.city = city;
1156
+ if (state !== undefined) updateData.state = state;
1157
+ if (postalCode !== undefined) updateData.postalCode = postalCode;
1158
+ if (country !== undefined) updateData.country = country;
1159
+ if (pocEmail !== undefined) updateData.pocEmail = pocEmail;
1160
+ if (pocPhone !== undefined) updateData.pocPhone = pocPhone;
1161
+ if (stockSymbol !== undefined) updateData.stockSymbol = stockSymbol;
1162
+ if (stockExchange !== undefined) updateData.stockExchange = stockExchange;
1163
+ if (website !== undefined) updateData.website = website;
1164
+ if (vertical !== undefined) updateData.vertical = vertical;
1165
+ if (altBusinessId !== undefined) updateData.altBusinessId = altBusinessId;
1166
+ if (altBusinessIdType !== undefined) updateData.altBusinessIdType = altBusinessIdType;
1167
+ if (brandRelationship !== undefined) updateData.brandRelationship = brandRelationship;
1168
+ if (businessContactEmail !== undefined) updateData.businessContactEmail = businessContactEmail;
1169
+ if (firstName !== undefined) updateData.firstName = firstName;
1170
+ if (lastName !== undefined) updateData.lastName = lastName;
1171
+ if (mobilePhone !== undefined) updateData.mobilePhone = mobilePhone;
983
1172
 
984
1173
  const options = {
985
1174
  body: updateData,
@@ -995,6 +1184,8 @@ export class TenDlcBrandsService {
995
1184
 
996
1185
  /**
997
1186
  * Delete a 10DLC brand
1187
+ * @param {string} brandId - Brand ID to delete (required)
1188
+ * @returns {Promise<Object>} Deletion confirmation
998
1189
  */
999
1190
  async delete(brandId) {
1000
1191
  this.sdk.validateParams(
@@ -1012,7 +1203,9 @@ export class TenDlcBrandsService {
1012
1203
  }
1013
1204
 
1014
1205
  /**
1015
- * Revet a 10DLC brand
1206
+ * Revet (re-vet) a 10DLC brand - resubmit brand for carrier approval
1207
+ * @param {string} brandId - Brand ID to revet (required)
1208
+ * @returns {Promise<Object>} Revet confirmation and updated brand status
1016
1209
  */
1017
1210
  async revet(brandId) {
1018
1211
  this.sdk.validateParams(
@@ -1030,7 +1223,9 @@ export class TenDlcBrandsService {
1030
1223
  }
1031
1224
 
1032
1225
  /**
1033
- * Get brand feedback
1226
+ * Get brand feedback from carriers
1227
+ * @param {string} brandId - Brand ID to get feedback for (required)
1228
+ * @returns {Promise<Object>} Brand feedback details from carriers
1034
1229
  */
1035
1230
  async getFeedback(brandId) {
1036
1231
  this.sdk.validateParams(
@@ -1048,7 +1243,10 @@ export class TenDlcBrandsService {
1048
1243
  }
1049
1244
 
1050
1245
  /**
1051
- * Create external brand vetting
1246
+ * Create external brand vetting for higher throughput approval
1247
+ * @param {string} brandId - Brand ID to create external vetting for (required)
1248
+ * @param {Object} [vettingData] - External vetting data
1249
+ * @returns {Promise<Object>} External vetting creation confirmation
1052
1250
  */
1053
1251
  async createExternalVetting(brandId, vettingData) {
1054
1252
  this.sdk.validateParams(
@@ -1073,6 +1271,8 @@ export class TenDlcBrandsService {
1073
1271
 
1074
1272
  /**
1075
1273
  * Get brand external vetting responses
1274
+ * @param {string} brandId - Brand ID to get vetting responses for (required)
1275
+ * @returns {Promise<Object>} External vetting responses
1076
1276
  */
1077
1277
  async getExternalVettingResponses(brandId) {
1078
1278
  this.sdk.validateParams(
@@ -1088,6 +1288,26 @@ export class TenDlcBrandsService {
1088
1288
  );
1089
1289
  return result;
1090
1290
  }
1291
+
1292
+ /**
1293
+ * Resend two-factor authentication email for PUBLIC_PROFIT brands
1294
+ * @param {string} brandId - Brand ID to resend 2FA for
1295
+ * @returns {Promise<Object>} Success message and details
1296
+ */
1297
+ async resend2fa(brandId) {
1298
+ this.sdk.validateParams(
1299
+ { brandId },
1300
+ {
1301
+ brandId: { type: 'string', required: true },
1302
+ },
1303
+ );
1304
+
1305
+ const result = await this.sdk._fetch(
1306
+ `/messaging/campaigns/10dlc/brand/${brandId}/resend-2fa`,
1307
+ 'POST',
1308
+ );
1309
+ return result;
1310
+ }
1091
1311
  }
1092
1312
 
1093
1313
  export class TenDlcCampaignManagementService {
@@ -1096,13 +1316,29 @@ export class TenDlcCampaignManagementService {
1096
1316
  }
1097
1317
 
1098
1318
  /**
1099
- * List all 10DLC campaigns
1319
+ * List all 10DLC campaigns with optional filtering
1320
+ * @param {Object} [params] - Filter parameters
1321
+ * @param {number} [params.page=1] - Page number
1322
+ * @param {number} [params.limit=50] - Items per page
1323
+ * @param {string} [params.name] - Filter by campaign name
1324
+ * @param {string} [params.status] - Filter by status
1325
+ * @param {string} [params.operatorType='contains'] - Filter operator: contains, equals, startsWith, endsWith
1326
+ * @returns {Promise<Array>} List of campaigns
1100
1327
  */
1101
- async list() {
1102
- const result = await this.sdk._fetch(
1103
- '/messaging/campaigns/10dlc/campaign',
1104
- 'GET',
1105
- );
1328
+ async list({ page, limit, name, status, operatorType } = {}) {
1329
+ const queryParams = new URLSearchParams();
1330
+
1331
+ if (page !== undefined) queryParams.append('page', page);
1332
+ if (limit !== undefined) queryParams.append('limit', limit);
1333
+ if (name) queryParams.append('name', name);
1334
+ if (status) queryParams.append('status', status);
1335
+ if (operatorType) queryParams.append('operatorType', operatorType);
1336
+
1337
+ const url = queryParams.toString()
1338
+ ? `/messaging/campaigns/10dlc/campaign?${queryParams.toString()}`
1339
+ : '/messaging/campaigns/10dlc/campaign';
1340
+
1341
+ const result = await this.sdk._fetch(url, 'GET');
1106
1342
  return result;
1107
1343
  }
1108
1344