@unboundcx/sdk 2.8.6 → 2.8.8
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/README.md +48 -1
- package/base.js +43 -12
- package/index.js +27 -3
- package/package.json +5 -2
- package/proto/transcription.proto +207 -0
- package/services/ai/SttStream.js +311 -0
- package/services/ai/playbooks.js +958 -0
- package/services/ai.js +1006 -45
- package/services/engagementMetrics.js +6 -2
- package/services/externalOAuth.js +45 -0
- package/services/fax.js +249 -0
- package/services/knowledgeBase.js +229 -0
- package/services/messaging/EmailTemplatesService.js +31 -11
- package/services/messaging/TenDlcCampaignManagementService.js +187 -105
- package/services/messaging/TollFreeCampaignsService.js +263 -110
- package/services/notes.js +27 -2
- package/services/objects.js +92 -3
- package/services/phoneNumbers.js +88 -3
- package/services/portals.js +89 -0
- package/services/sipEndpoints.js +105 -33
- package/services/storage.js +310 -6
- package/services/taskRouter/MetricsService.js +111 -0
- package/services/taskRouter/TaskRouterService.js +12 -0
- package/services/taskRouter/TaskService.js +846 -0
- package/services/taskRouter/WorkerService.js +394 -0
- package/services/taskRouter.js +6 -0
- package/services/video.js +145 -5
- package/services/voice.js +124 -67
- package/services/workflows.js +167 -7
|
@@ -6,60 +6,133 @@ export class TollFreeCampaignsService {
|
|
|
6
6
|
/**
|
|
7
7
|
* Create toll-free campaign
|
|
8
8
|
* @param {Object} params - Campaign parameters
|
|
9
|
-
* @param {string} params.
|
|
10
|
-
* @param {string} params.
|
|
11
|
-
* @param {string} params.
|
|
12
|
-
* @param {string} params.
|
|
13
|
-
* @param {string} [params.
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
9
|
+
* @param {string} params.name - Campaign name (required)
|
|
10
|
+
* @param {string} [params.campaignDescription] - Campaign description
|
|
11
|
+
* @param {string} [params.address1] - Business address line 1
|
|
12
|
+
* @param {string} [params.address2] - Business address line 2
|
|
13
|
+
* @param {string} [params.city] - Business city
|
|
14
|
+
* @param {string} [params.state] - Business state
|
|
15
|
+
* @param {string} [params.zip] - Business zip code
|
|
16
|
+
* @param {string} [params.pocFirstName] - Point of contact first name
|
|
17
|
+
* @param {string} [params.pocLastName] - Point of contact last name
|
|
18
|
+
* @param {string} [params.pocPhoneNumber] - Point of contact phone
|
|
19
|
+
* @param {string} [params.pocEmail] - Point of contact email
|
|
20
|
+
* @param {string} [params.businessName] - Business name
|
|
16
21
|
* @param {string} [params.website] - Business website
|
|
22
|
+
* @param {string} [params.messageVolume] - Expected message volume
|
|
23
|
+
* @param {string} [params.optInWorkflow] - Opt-in workflow description
|
|
24
|
+
* @param {Array<string>} [params.optInWorkflowUrls] - Opt-in workflow image URLs
|
|
25
|
+
* @param {Array<string>} [params.phoneNumbers] - Phone numbers for campaign
|
|
26
|
+
* @param {string} [params.productionMessageExample] - Production message example
|
|
27
|
+
* @param {string} [params.useCase] - Use case category
|
|
28
|
+
* @param {string} [params.useCaseDescription] - Use case description
|
|
29
|
+
* @param {string} [params.webhookUrl] - Webhook URL
|
|
30
|
+
* @param {string} [params.businessRegistrationNumber] - Business registration number
|
|
31
|
+
* @param {string} [params.businessRegistrationType] - Business registration type
|
|
32
|
+
* @param {string} [params.businessRegistrationCountry] - Business registration country (ISO 3166-1 alpha-2)
|
|
33
|
+
* @param {string} [params.doingBusinessAs] - Doing business as name
|
|
34
|
+
* @param {string} [params.entityType] - Entity type
|
|
35
|
+
* @param {string} [params.optInConfirmationResponse] - Opt-in confirmation response
|
|
36
|
+
* @param {string} [params.helpMessageResponse] - Help message response
|
|
37
|
+
* @param {string} [params.privacyPolicyURL] - Privacy policy URL
|
|
38
|
+
* @param {string} [params.termsAndConditionURL] - Terms and conditions URL
|
|
39
|
+
* @param {boolean} [params.ageGatedContent] - Age gated content flag
|
|
40
|
+
* @param {string} [params.optInKeywords] - Opt-in keywords
|
|
17
41
|
* @returns {Promise<Object>} Created campaign details
|
|
18
42
|
*/
|
|
19
43
|
async create({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
44
|
+
name,
|
|
45
|
+
campaignDescription,
|
|
46
|
+
address1,
|
|
47
|
+
address2,
|
|
48
|
+
city,
|
|
49
|
+
state,
|
|
50
|
+
zip,
|
|
51
|
+
pocFirstName,
|
|
52
|
+
pocLastName,
|
|
53
|
+
pocPhoneNumber,
|
|
54
|
+
pocEmail,
|
|
55
|
+
businessName,
|
|
27
56
|
website,
|
|
57
|
+
messageVolume,
|
|
58
|
+
optInWorkflow,
|
|
59
|
+
optInWorkflowUrls,
|
|
60
|
+
phoneNumbers,
|
|
61
|
+
productionMessageExample,
|
|
62
|
+
useCase,
|
|
63
|
+
useCaseDescription,
|
|
64
|
+
webhookUrl,
|
|
65
|
+
businessRegistrationNumber,
|
|
66
|
+
businessRegistrationType,
|
|
67
|
+
businessRegistrationCountry,
|
|
68
|
+
doingBusinessAs,
|
|
69
|
+
entityType,
|
|
70
|
+
optInConfirmationResponse,
|
|
71
|
+
helpMessageResponse,
|
|
72
|
+
privacyPolicyURL,
|
|
73
|
+
termsAndConditionURL,
|
|
74
|
+
ageGatedContent,
|
|
75
|
+
optInKeywords,
|
|
28
76
|
}) {
|
|
29
77
|
this.sdk.validateParams(
|
|
30
|
-
{
|
|
78
|
+
{ name },
|
|
31
79
|
{
|
|
32
|
-
|
|
33
|
-
phoneNumber: { type: 'string', required: true },
|
|
34
|
-
description: { type: 'string', required: true },
|
|
35
|
-
messageFlow: { type: 'string', required: true },
|
|
36
|
-
helpMessage: { type: 'string', required: false },
|
|
37
|
-
optInKeywords: { type: 'array', required: false },
|
|
38
|
-
optOutKeywords: { type: 'array', required: false },
|
|
39
|
-
website: { type: 'string', required: false },
|
|
80
|
+
name: { type: 'string', required: true },
|
|
40
81
|
},
|
|
41
82
|
);
|
|
42
83
|
|
|
43
|
-
const campaignData = {
|
|
44
|
-
companyName,
|
|
45
|
-
phoneNumber,
|
|
46
|
-
description,
|
|
47
|
-
messageFlow,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
if (helpMessage) campaignData.helpMessage = helpMessage;
|
|
51
|
-
if (optInKeywords) campaignData.optInKeywords = optInKeywords;
|
|
52
|
-
if (optOutKeywords) campaignData.optOutKeywords = optOutKeywords;
|
|
53
|
-
if (website) campaignData.website = website;
|
|
84
|
+
const campaignData = { name };
|
|
54
85
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
86
|
+
if (campaignDescription !== undefined)
|
|
87
|
+
campaignData.campaignDescription = campaignDescription;
|
|
88
|
+
if (address1 !== undefined) campaignData.address1 = address1;
|
|
89
|
+
if (address2 !== undefined) campaignData.address2 = address2;
|
|
90
|
+
if (city !== undefined) campaignData.city = city;
|
|
91
|
+
if (state !== undefined) campaignData.state = state;
|
|
92
|
+
if (zip !== undefined) campaignData.zip = zip;
|
|
93
|
+
if (pocFirstName !== undefined) campaignData.pocFirstName = pocFirstName;
|
|
94
|
+
if (pocLastName !== undefined) campaignData.pocLastName = pocLastName;
|
|
95
|
+
if (pocPhoneNumber !== undefined)
|
|
96
|
+
campaignData.pocPhoneNumber = pocPhoneNumber;
|
|
97
|
+
if (pocEmail !== undefined) campaignData.pocEmail = pocEmail;
|
|
98
|
+
if (businessName !== undefined) campaignData.businessName = businessName;
|
|
99
|
+
if (website !== undefined) campaignData.website = website;
|
|
100
|
+
if (messageVolume !== undefined) campaignData.messageVolume = messageVolume;
|
|
101
|
+
if (optInWorkflow !== undefined) campaignData.optInWorkflow = optInWorkflow;
|
|
102
|
+
if (optInWorkflowUrls !== undefined)
|
|
103
|
+
campaignData.optInWorkflowUrls = optInWorkflowUrls;
|
|
104
|
+
if (phoneNumbers !== undefined) campaignData.phoneNumbers = phoneNumbers;
|
|
105
|
+
if (productionMessageExample !== undefined)
|
|
106
|
+
campaignData.productionMessageExample = productionMessageExample;
|
|
107
|
+
if (useCase !== undefined) campaignData.useCase = useCase;
|
|
108
|
+
if (useCaseDescription !== undefined)
|
|
109
|
+
campaignData.useCaseDescription = useCaseDescription;
|
|
110
|
+
if (webhookUrl !== undefined) campaignData.webhookUrl = webhookUrl;
|
|
111
|
+
if (businessRegistrationNumber !== undefined)
|
|
112
|
+
campaignData.businessRegistrationNumber = businessRegistrationNumber;
|
|
113
|
+
if (businessRegistrationType !== undefined)
|
|
114
|
+
campaignData.businessRegistrationType = businessRegistrationType;
|
|
115
|
+
if (businessRegistrationCountry !== undefined)
|
|
116
|
+
campaignData.businessRegistrationCountry = businessRegistrationCountry;
|
|
117
|
+
if (doingBusinessAs !== undefined)
|
|
118
|
+
campaignData.doingBusinessAs = doingBusinessAs;
|
|
119
|
+
if (entityType !== undefined) campaignData.entityType = entityType;
|
|
120
|
+
if (optInConfirmationResponse !== undefined)
|
|
121
|
+
campaignData.optInConfirmationResponse = optInConfirmationResponse;
|
|
122
|
+
if (helpMessageResponse !== undefined)
|
|
123
|
+
campaignData.helpMessageResponse = helpMessageResponse;
|
|
124
|
+
if (privacyPolicyURL !== undefined)
|
|
125
|
+
campaignData.privacyPolicyURL = privacyPolicyURL;
|
|
126
|
+
if (termsAndConditionURL !== undefined)
|
|
127
|
+
campaignData.termsAndConditionURL = termsAndConditionURL;
|
|
128
|
+
if (ageGatedContent !== undefined)
|
|
129
|
+
campaignData.ageGatedContent = ageGatedContent;
|
|
130
|
+
if (optInKeywords !== undefined) campaignData.optInKeywords = optInKeywords;
|
|
58
131
|
|
|
59
132
|
const result = await this.sdk._fetch(
|
|
60
133
|
'/messaging/campaigns/tollfree',
|
|
61
134
|
'POST',
|
|
62
|
-
|
|
135
|
+
{ body: campaignData },
|
|
63
136
|
);
|
|
64
137
|
return result;
|
|
65
138
|
}
|
|
@@ -88,27 +161,6 @@ export class TollFreeCampaignsService {
|
|
|
88
161
|
* Update toll-free campaign
|
|
89
162
|
* @param {string} campaignId - Campaign ID to update
|
|
90
163
|
* @param {Object} params - Update parameters
|
|
91
|
-
* @param {string} [params.name] - Campaign name
|
|
92
|
-
* @param {string} [params.campaignDescription] - Campaign description
|
|
93
|
-
* @param {string} [params.address1] - Business address line 1
|
|
94
|
-
* @param {string} [params.address2] - Business address line 2
|
|
95
|
-
* @param {string} [params.city] - Business city
|
|
96
|
-
* @param {string} [params.state] - Business state
|
|
97
|
-
* @param {string} [params.zip] - Business zip code
|
|
98
|
-
* @param {string} [params.pocFirstName] - Point of contact first name
|
|
99
|
-
* @param {string} [params.pocLastName] - Point of contact last name
|
|
100
|
-
* @param {string} [params.pocPhoneNumber] - Point of contact phone
|
|
101
|
-
* @param {string} [params.pocEmail] - Point of contact email
|
|
102
|
-
* @param {string} [params.businessName] - Business name
|
|
103
|
-
* @param {string} [params.website] - Business website
|
|
104
|
-
* @param {string} [params.messageVolume] - Expected message volume
|
|
105
|
-
* @param {string} [params.optInWorkflow] - Opt-in workflow description
|
|
106
|
-
* @param {Array<string>} [params.optInWorkflowUrls] - Opt-in workflow image URLs
|
|
107
|
-
* @param {Array<string>} [params.phoneNumbers] - Phone numbers for campaign
|
|
108
|
-
* @param {string} [params.productionMessageExample] - Production message example
|
|
109
|
-
* @param {string} [params.useCase] - Use case category
|
|
110
|
-
* @param {string} [params.useCaseDescription] - Use case description
|
|
111
|
-
* @param {string} [params.webhookUrl] - Webhook URL
|
|
112
164
|
* @returns {Promise<Object>} Updated campaign information
|
|
113
165
|
*/
|
|
114
166
|
async update(
|
|
@@ -135,56 +187,23 @@ export class TollFreeCampaignsService {
|
|
|
135
187
|
useCase,
|
|
136
188
|
useCaseDescription,
|
|
137
189
|
webhookUrl,
|
|
190
|
+
businessRegistrationNumber,
|
|
191
|
+
businessRegistrationType,
|
|
192
|
+
businessRegistrationCountry,
|
|
193
|
+
doingBusinessAs,
|
|
194
|
+
entityType,
|
|
195
|
+
optInConfirmationResponse,
|
|
196
|
+
helpMessageResponse,
|
|
197
|
+
privacyPolicyURL,
|
|
198
|
+
termsAndConditionURL,
|
|
199
|
+
ageGatedContent,
|
|
200
|
+
optInKeywords,
|
|
138
201
|
} = {},
|
|
139
202
|
) {
|
|
140
203
|
this.sdk.validateParams(
|
|
141
|
-
{
|
|
142
|
-
campaignId,
|
|
143
|
-
name,
|
|
144
|
-
campaignDescription,
|
|
145
|
-
address1,
|
|
146
|
-
address2,
|
|
147
|
-
city,
|
|
148
|
-
state,
|
|
149
|
-
zip,
|
|
150
|
-
pocFirstName,
|
|
151
|
-
pocLastName,
|
|
152
|
-
pocPhoneNumber,
|
|
153
|
-
pocEmail,
|
|
154
|
-
businessName,
|
|
155
|
-
website,
|
|
156
|
-
messageVolume,
|
|
157
|
-
optInWorkflow,
|
|
158
|
-
optInWorkflowUrls,
|
|
159
|
-
phoneNumbers,
|
|
160
|
-
productionMessageExample,
|
|
161
|
-
useCase,
|
|
162
|
-
useCaseDescription,
|
|
163
|
-
webhookUrl,
|
|
164
|
-
},
|
|
204
|
+
{ campaignId },
|
|
165
205
|
{
|
|
166
206
|
campaignId: { type: 'string', required: true },
|
|
167
|
-
name: { type: 'string', required: false },
|
|
168
|
-
campaignDescription: { type: 'string', required: false },
|
|
169
|
-
address1: { type: 'string', required: false },
|
|
170
|
-
address2: { type: 'string', required: false },
|
|
171
|
-
city: { type: 'string', required: false },
|
|
172
|
-
state: { type: 'string', required: false },
|
|
173
|
-
zip: { type: 'string', required: false },
|
|
174
|
-
pocFirstName: { type: 'string', required: false },
|
|
175
|
-
pocLastName: { type: 'string', required: false },
|
|
176
|
-
pocPhoneNumber: { type: 'string', required: false },
|
|
177
|
-
pocEmail: { type: 'string', required: false },
|
|
178
|
-
businessName: { type: 'string', required: false },
|
|
179
|
-
website: { type: 'string', required: false },
|
|
180
|
-
messageVolume: { type: 'string', required: false },
|
|
181
|
-
optInWorkflow: { type: 'string', required: false },
|
|
182
|
-
optInWorkflowUrls: { type: 'array', required: false },
|
|
183
|
-
phoneNumbers: { type: 'array', required: false },
|
|
184
|
-
productionMessageExample: { type: 'string', required: false },
|
|
185
|
-
useCase: { type: 'string', required: false },
|
|
186
|
-
useCaseDescription: { type: 'string', required: false },
|
|
187
|
-
webhookUrl: { type: 'string', required: false },
|
|
188
207
|
},
|
|
189
208
|
);
|
|
190
209
|
|
|
@@ -215,15 +234,31 @@ export class TollFreeCampaignsService {
|
|
|
215
234
|
if (useCaseDescription !== undefined)
|
|
216
235
|
updateData.useCaseDescription = useCaseDescription;
|
|
217
236
|
if (webhookUrl !== undefined) updateData.webhookUrl = webhookUrl;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
237
|
+
if (businessRegistrationNumber !== undefined)
|
|
238
|
+
updateData.businessRegistrationNumber = businessRegistrationNumber;
|
|
239
|
+
if (businessRegistrationType !== undefined)
|
|
240
|
+
updateData.businessRegistrationType = businessRegistrationType;
|
|
241
|
+
if (businessRegistrationCountry !== undefined)
|
|
242
|
+
updateData.businessRegistrationCountry = businessRegistrationCountry;
|
|
243
|
+
if (doingBusinessAs !== undefined)
|
|
244
|
+
updateData.doingBusinessAs = doingBusinessAs;
|
|
245
|
+
if (entityType !== undefined) updateData.entityType = entityType;
|
|
246
|
+
if (optInConfirmationResponse !== undefined)
|
|
247
|
+
updateData.optInConfirmationResponse = optInConfirmationResponse;
|
|
248
|
+
if (helpMessageResponse !== undefined)
|
|
249
|
+
updateData.helpMessageResponse = helpMessageResponse;
|
|
250
|
+
if (privacyPolicyURL !== undefined)
|
|
251
|
+
updateData.privacyPolicyURL = privacyPolicyURL;
|
|
252
|
+
if (termsAndConditionURL !== undefined)
|
|
253
|
+
updateData.termsAndConditionURL = termsAndConditionURL;
|
|
254
|
+
if (ageGatedContent !== undefined)
|
|
255
|
+
updateData.ageGatedContent = ageGatedContent;
|
|
256
|
+
if (optInKeywords !== undefined) updateData.optInKeywords = optInKeywords;
|
|
222
257
|
|
|
223
258
|
const result = await this.sdk._fetch(
|
|
224
259
|
`/messaging/campaigns/tollfree/${campaignId}`,
|
|
225
260
|
'PUT',
|
|
226
|
-
|
|
261
|
+
{ body: updateData },
|
|
227
262
|
);
|
|
228
263
|
return result;
|
|
229
264
|
}
|
|
@@ -250,7 +285,7 @@ export class TollFreeCampaignsService {
|
|
|
250
285
|
* @param {number} [params.limit=50] - Items per page
|
|
251
286
|
* @param {string} [params.name] - Filter by campaign name
|
|
252
287
|
* @param {string} [params.status] - Filter by status
|
|
253
|
-
* @param {string} [params.operatorType='contains'] - Filter operator
|
|
288
|
+
* @param {string} [params.operatorType='contains'] - Filter operator
|
|
254
289
|
* @returns {Promise<Array>} List of campaigns
|
|
255
290
|
*/
|
|
256
291
|
async list({ page, limit, name, status, operatorType } = {}) {
|
|
@@ -285,6 +320,124 @@ export class TollFreeCampaignsService {
|
|
|
285
320
|
return result;
|
|
286
321
|
}
|
|
287
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Submit a draft toll-free campaign for verification
|
|
325
|
+
* @param {string} campaignId - Campaign ID to submit
|
|
326
|
+
* @param {Object} params - Submit parameters
|
|
327
|
+
* @param {boolean} params.termsAndConditions - Must be true to accept T&C
|
|
328
|
+
* @returns {Promise<Object>} Submission result
|
|
329
|
+
*/
|
|
330
|
+
async submit(campaignId, { termsAndConditions } = {}) {
|
|
331
|
+
this.sdk.validateParams(
|
|
332
|
+
{ campaignId, termsAndConditions },
|
|
333
|
+
{
|
|
334
|
+
campaignId: { type: 'string', required: true },
|
|
335
|
+
termsAndConditions: { type: 'boolean', required: true },
|
|
336
|
+
},
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
const result = await this.sdk._fetch(
|
|
340
|
+
`/messaging/campaigns/tollfree/${campaignId}/submit`,
|
|
341
|
+
'POST',
|
|
342
|
+
{ body: { termsAndConditions } },
|
|
343
|
+
);
|
|
344
|
+
return result;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Duplicate an existing campaign as a new Draft
|
|
349
|
+
* @param {string} campaignId - Source campaign ID
|
|
350
|
+
* @param {Object} [params] - Optional parameters
|
|
351
|
+
* @param {string} [params.name] - Name for the new campaign
|
|
352
|
+
* @returns {Promise<Object>} New draft campaign details
|
|
353
|
+
*/
|
|
354
|
+
async duplicate(campaignId, { name } = {}) {
|
|
355
|
+
this.sdk.validateParams(
|
|
356
|
+
{ campaignId },
|
|
357
|
+
{
|
|
358
|
+
campaignId: { type: 'string', required: true },
|
|
359
|
+
},
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
const body = {};
|
|
363
|
+
if (name !== undefined) body.name = name;
|
|
364
|
+
|
|
365
|
+
const result = await this.sdk._fetch(
|
|
366
|
+
`/messaging/campaigns/tollfree/${campaignId}/duplicate`,
|
|
367
|
+
'POST',
|
|
368
|
+
{ body },
|
|
369
|
+
);
|
|
370
|
+
return result;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* List phone numbers assigned to a campaign
|
|
375
|
+
* @param {string} campaignId - Campaign ID
|
|
376
|
+
* @returns {Promise<Array>} List of phone numbers
|
|
377
|
+
*/
|
|
378
|
+
async listPhoneNumbers(campaignId) {
|
|
379
|
+
this.sdk.validateParams(
|
|
380
|
+
{ campaignId },
|
|
381
|
+
{
|
|
382
|
+
campaignId: { type: 'string', required: true },
|
|
383
|
+
},
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
const result = await this.sdk._fetch(
|
|
387
|
+
`/messaging/campaigns/tollfree/${campaignId}/phoneNumbers`,
|
|
388
|
+
'GET',
|
|
389
|
+
);
|
|
390
|
+
return result;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Add phone number to campaign
|
|
395
|
+
* @param {string} campaignId - Campaign ID
|
|
396
|
+
* @param {Object} params - Phone number data
|
|
397
|
+
* @param {string} params.phoneNumber - Phone number to add
|
|
398
|
+
* @returns {Promise<Object>} Result
|
|
399
|
+
*/
|
|
400
|
+
async addPhoneNumber(campaignId, { phoneNumber }) {
|
|
401
|
+
this.sdk.validateParams(
|
|
402
|
+
{ campaignId, phoneNumber },
|
|
403
|
+
{
|
|
404
|
+
campaignId: { type: 'string', required: true },
|
|
405
|
+
phoneNumber: { type: 'string', required: true },
|
|
406
|
+
},
|
|
407
|
+
);
|
|
408
|
+
|
|
409
|
+
const result = await this.sdk._fetch(
|
|
410
|
+
`/messaging/campaigns/tollfree/${campaignId}/phoneNumber`,
|
|
411
|
+
'POST',
|
|
412
|
+
{ body: { phoneNumber } },
|
|
413
|
+
);
|
|
414
|
+
return result;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Remove phone number from campaign
|
|
419
|
+
* @param {string} campaignId - Campaign ID
|
|
420
|
+
* @param {Object} params - Phone number data
|
|
421
|
+
* @param {string} params.phoneNumber - Phone number to remove
|
|
422
|
+
* @returns {Promise<Object>} Result
|
|
423
|
+
*/
|
|
424
|
+
async removePhoneNumber(campaignId, { phoneNumber }) {
|
|
425
|
+
this.sdk.validateParams(
|
|
426
|
+
{ campaignId, phoneNumber },
|
|
427
|
+
{
|
|
428
|
+
campaignId: { type: 'string', required: true },
|
|
429
|
+
phoneNumber: { type: 'string', required: true },
|
|
430
|
+
},
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
const result = await this.sdk._fetch(
|
|
434
|
+
`/messaging/campaigns/tollfree/${campaignId}/phoneNumber`,
|
|
435
|
+
'DELETE',
|
|
436
|
+
{ body: { phoneNumber } },
|
|
437
|
+
);
|
|
438
|
+
return result;
|
|
439
|
+
}
|
|
440
|
+
|
|
288
441
|
async getPhoneNumberCampaignStatus(phoneNumber) {
|
|
289
442
|
this.sdk.validateParams(
|
|
290
443
|
{ phoneNumber },
|
package/services/notes.js
CHANGED
|
@@ -37,6 +37,7 @@ export class NotesService {
|
|
|
37
37
|
content_binary,
|
|
38
38
|
content_json,
|
|
39
39
|
version,
|
|
40
|
+
isPublic,
|
|
40
41
|
}) {
|
|
41
42
|
this.sdk.validateParams(
|
|
42
43
|
{
|
|
@@ -47,6 +48,7 @@ export class NotesService {
|
|
|
47
48
|
content_binary,
|
|
48
49
|
content_json,
|
|
49
50
|
version,
|
|
51
|
+
isPublic,
|
|
50
52
|
},
|
|
51
53
|
{
|
|
52
54
|
title: { type: 'string', required: false },
|
|
@@ -56,6 +58,7 @@ export class NotesService {
|
|
|
56
58
|
content_binary: { type: 'array', required: false },
|
|
57
59
|
content_json: { type: 'object', required: false },
|
|
58
60
|
version: { type: 'number', required: false },
|
|
61
|
+
isPublic: { type: 'boolean', required: false },
|
|
59
62
|
},
|
|
60
63
|
);
|
|
61
64
|
|
|
@@ -68,6 +71,7 @@ export class NotesService {
|
|
|
68
71
|
content_binary,
|
|
69
72
|
content_json,
|
|
70
73
|
version,
|
|
74
|
+
isPublic,
|
|
71
75
|
},
|
|
72
76
|
};
|
|
73
77
|
|
|
@@ -77,10 +81,10 @@ export class NotesService {
|
|
|
77
81
|
|
|
78
82
|
async update(
|
|
79
83
|
noteId,
|
|
80
|
-
{ title, content_html, content_binary, content_json, version },
|
|
84
|
+
{ title, content_html, content_binary, content_json, version, isPublic },
|
|
81
85
|
) {
|
|
82
86
|
this.sdk.validateParams(
|
|
83
|
-
{ noteId, title, content_html, content_binary, content_json, version },
|
|
87
|
+
{ noteId, title, content_html, content_binary, content_json, version, isPublic },
|
|
84
88
|
{
|
|
85
89
|
noteId: { type: 'string', required: true },
|
|
86
90
|
title: { type: 'string', required: false },
|
|
@@ -88,6 +92,7 @@ export class NotesService {
|
|
|
88
92
|
content_binary: { type: 'array', required: false },
|
|
89
93
|
content_json: { type: 'object', required: false },
|
|
90
94
|
version: { type: 'number', required: false },
|
|
95
|
+
isPublic: { type: 'boolean', required: false },
|
|
91
96
|
},
|
|
92
97
|
);
|
|
93
98
|
|
|
@@ -98,6 +103,7 @@ export class NotesService {
|
|
|
98
103
|
content_binary,
|
|
99
104
|
content_json,
|
|
100
105
|
version,
|
|
106
|
+
isPublic,
|
|
101
107
|
},
|
|
102
108
|
};
|
|
103
109
|
|
|
@@ -128,4 +134,23 @@ export class NotesService {
|
|
|
128
134
|
const result = await this.sdk._fetch(`/notes/${noteId}`, 'GET');
|
|
129
135
|
return result;
|
|
130
136
|
}
|
|
137
|
+
|
|
138
|
+
async search({ query, relatedId, limit, isPublic }) {
|
|
139
|
+
this.sdk.validateParams(
|
|
140
|
+
{ query, relatedId, limit, isPublic },
|
|
141
|
+
{
|
|
142
|
+
query: { type: 'string', required: true },
|
|
143
|
+
relatedId: { type: 'string', required: false },
|
|
144
|
+
limit: { type: 'number', required: false },
|
|
145
|
+
isPublic: { type: 'boolean', required: false },
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const params = {
|
|
150
|
+
body: { query, relatedId, limit, isPublic },
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const result = await this.sdk._fetch('/notes/search', 'POST', params);
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
131
156
|
}
|
package/services/objects.js
CHANGED
|
@@ -45,9 +45,13 @@ export class ObjectsService {
|
|
|
45
45
|
}
|
|
46
46
|
} else if (typeof arg1 === 'object') {
|
|
47
47
|
id = arg1.id;
|
|
48
|
-
query
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
if (arg1.query) {
|
|
49
|
+
query = { ...arg1.query };
|
|
50
|
+
} else {
|
|
51
|
+
query = { ...arg1 };
|
|
52
|
+
if (query.id) {
|
|
53
|
+
delete query.id;
|
|
54
|
+
}
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
|
|
@@ -63,7 +67,9 @@ export class ObjectsService {
|
|
|
63
67
|
);
|
|
64
68
|
|
|
65
69
|
const params = { query };
|
|
70
|
+
|
|
66
71
|
const result = await this.sdk._fetch(`/object/${id}`, 'GET', params);
|
|
72
|
+
// console.log(`sdk.objects.byId :: params :: `, params, result);
|
|
67
73
|
return result;
|
|
68
74
|
}
|
|
69
75
|
|
|
@@ -97,6 +103,7 @@ export class ObjectsService {
|
|
|
97
103
|
previousId = null,
|
|
98
104
|
orderByDirection = 'DESC',
|
|
99
105
|
expandDetails = false,
|
|
106
|
+
meta = {},
|
|
100
107
|
} = args[0];
|
|
101
108
|
|
|
102
109
|
this.sdk.validateParams(
|
|
@@ -109,6 +116,7 @@ export class ObjectsService {
|
|
|
109
116
|
previousId,
|
|
110
117
|
orderByDirection,
|
|
111
118
|
expandDetails,
|
|
119
|
+
meta,
|
|
112
120
|
},
|
|
113
121
|
{
|
|
114
122
|
object: { type: 'string', required: true },
|
|
@@ -119,6 +127,7 @@ export class ObjectsService {
|
|
|
119
127
|
previousId: { type: 'string', required: false },
|
|
120
128
|
orderByDirection: { type: 'string', required: false },
|
|
121
129
|
expandDetails: { type: 'boolean', required: false },
|
|
130
|
+
meta: { type: 'object', required: false },
|
|
122
131
|
},
|
|
123
132
|
);
|
|
124
133
|
|
|
@@ -157,6 +166,31 @@ export class ObjectsService {
|
|
|
157
166
|
throw new Error('Invalid arguments for query method');
|
|
158
167
|
}
|
|
159
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Query objects using UOQL v2 (SQL-like syntax).
|
|
171
|
+
*
|
|
172
|
+
* Usage:
|
|
173
|
+
* sdk.objects.queryV2({ query: "SELECT firstName, lastName FROM people WHERE companyId = '123' LIMIT 10" })
|
|
174
|
+
*
|
|
175
|
+
* @param {object} args
|
|
176
|
+
* @param {string} args.query - UOQL query string
|
|
177
|
+
* @param {boolean} [args.expandDetails=false] - Whether to expand related details
|
|
178
|
+
* @returns {Promise} Query results with pagination
|
|
179
|
+
*/
|
|
180
|
+
async queryV2({ query, expandDetails = false, isPublic = false }) {
|
|
181
|
+
this.sdk.validateParams(
|
|
182
|
+
{ query },
|
|
183
|
+
{
|
|
184
|
+
query: { type: 'string', required: true },
|
|
185
|
+
},
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
const body = { query, expandDetails };
|
|
189
|
+
if (isPublic) body.isPublic = isPublic;
|
|
190
|
+
const params = { body };
|
|
191
|
+
return await this.sdk._fetch('/object/query/v2', 'POST', params);
|
|
192
|
+
}
|
|
193
|
+
|
|
160
194
|
/**
|
|
161
195
|
* Update an object record by ID
|
|
162
196
|
*
|
|
@@ -328,6 +362,14 @@ export class ObjectsService {
|
|
|
328
362
|
return result;
|
|
329
363
|
}
|
|
330
364
|
|
|
365
|
+
async botSchema() {
|
|
366
|
+
const result = await this.sdk._fetch(
|
|
367
|
+
'/object/manage/bot-schema',
|
|
368
|
+
'GET',
|
|
369
|
+
);
|
|
370
|
+
return result;
|
|
371
|
+
}
|
|
372
|
+
|
|
331
373
|
async describe(object) {
|
|
332
374
|
this.sdk.validateParams(
|
|
333
375
|
{ object },
|
|
@@ -775,6 +817,37 @@ export class ObjectsService {
|
|
|
775
817
|
return result;
|
|
776
818
|
}
|
|
777
819
|
|
|
820
|
+
async modifyObject({
|
|
821
|
+
objectName,
|
|
822
|
+
isBotAccessible = null,
|
|
823
|
+
isPublicBot = null,
|
|
824
|
+
description = null,
|
|
825
|
+
}) {
|
|
826
|
+
this.sdk.validateParams(
|
|
827
|
+
{ objectName, isBotAccessible, isPublicBot, description },
|
|
828
|
+
{
|
|
829
|
+
objectName: { type: 'string', required: true },
|
|
830
|
+
isBotAccessible: { type: 'boolean', required: false },
|
|
831
|
+
isPublicBot: { type: 'boolean', required: false },
|
|
832
|
+
description: { type: 'string', required: false },
|
|
833
|
+
},
|
|
834
|
+
);
|
|
835
|
+
|
|
836
|
+
const body = {};
|
|
837
|
+
if (isBotAccessible !== null) body.isBotAccessible = isBotAccessible;
|
|
838
|
+
if (isPublicBot !== null) body.isPublicBot = isPublicBot;
|
|
839
|
+
if (description !== null) body.description = description;
|
|
840
|
+
|
|
841
|
+
const params = { body };
|
|
842
|
+
|
|
843
|
+
const result = await this.sdk._fetch(
|
|
844
|
+
`/object/manage/${objectName}`,
|
|
845
|
+
'PUT',
|
|
846
|
+
params,
|
|
847
|
+
);
|
|
848
|
+
return result;
|
|
849
|
+
}
|
|
850
|
+
|
|
778
851
|
async modifyColumn({
|
|
779
852
|
objectName,
|
|
780
853
|
columnName,
|
|
@@ -783,6 +856,10 @@ export class ObjectsService {
|
|
|
783
856
|
defaultValue = null,
|
|
784
857
|
isEncrypted = null,
|
|
785
858
|
isRequired = null,
|
|
859
|
+
isBotAccessible = null,
|
|
860
|
+
isPublicBot = null,
|
|
861
|
+
isStandard = null,
|
|
862
|
+
description = null,
|
|
786
863
|
}) {
|
|
787
864
|
this.sdk.validateParams(
|
|
788
865
|
{
|
|
@@ -793,6 +870,10 @@ export class ObjectsService {
|
|
|
793
870
|
defaultValue,
|
|
794
871
|
isEncrypted,
|
|
795
872
|
isRequired,
|
|
873
|
+
isBotAccessible,
|
|
874
|
+
isPublicBot,
|
|
875
|
+
isStandard,
|
|
876
|
+
description,
|
|
796
877
|
},
|
|
797
878
|
{
|
|
798
879
|
objectName: { type: 'string', required: true },
|
|
@@ -802,6 +883,10 @@ export class ObjectsService {
|
|
|
802
883
|
defaultValue: { type: 'string', required: false },
|
|
803
884
|
isEncrypted: { type: 'boolean', required: false },
|
|
804
885
|
isRequired: { type: 'boolean', required: false },
|
|
886
|
+
isBotAccessible: { type: 'boolean', required: false },
|
|
887
|
+
isPublicBot: { type: 'boolean', required: false },
|
|
888
|
+
isStandard: { type: 'boolean', required: false },
|
|
889
|
+
description: { type: 'string', required: false },
|
|
805
890
|
},
|
|
806
891
|
);
|
|
807
892
|
|
|
@@ -811,6 +896,10 @@ export class ObjectsService {
|
|
|
811
896
|
if (defaultValue !== null) body.defaultValue = defaultValue;
|
|
812
897
|
if (isEncrypted !== null) body.isEncrypted = isEncrypted;
|
|
813
898
|
if (isRequired !== null) body.isRequired = isRequired;
|
|
899
|
+
if (isBotAccessible !== null) body.isBotAccessible = isBotAccessible;
|
|
900
|
+
if (isPublicBot !== null) body.isPublicBot = isPublicBot;
|
|
901
|
+
if (isStandard !== null) body.isStandard = isStandard;
|
|
902
|
+
if (description !== null) body.description = description;
|
|
814
903
|
|
|
815
904
|
const params = { body };
|
|
816
905
|
|