@signalhouse-sms/sdk 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/SignalHouseSDK.js +2 -0
- package/src/domains/Brands.js +16 -0
- package/src/domains/Contracts.js +117 -0
- package/src/domains/Rcs.js +1 -1
- package/src/domains/Templates.js +19 -6
- package/types/SignalHouseSDK.d.ts +2 -0
- package/types/domains/Brands.d.ts +14 -0
- package/types/domains/Contracts.d.ts +116 -0
- package/types/domains/Rcs.d.ts +1 -1
- package/types/domains/Templates.d.ts +34 -6
package/package.json
CHANGED
package/src/SignalHouseSDK.js
CHANGED
|
@@ -48,6 +48,7 @@ import { Webhooks } from "./domains/Webhooks.js";
|
|
|
48
48
|
import { Voice } from "./domains/Voice.js";
|
|
49
49
|
import { Agents } from "./domains/Agents.js";
|
|
50
50
|
import { Audit } from "./domains/Audit.js";
|
|
51
|
+
import { Contracts } from "./domains/Contracts.js";
|
|
51
52
|
import { Verify } from "./domains/Verify.js";
|
|
52
53
|
|
|
53
54
|
export class SignalHouseSDK {
|
|
@@ -101,6 +102,7 @@ export class SignalHouseSDK {
|
|
|
101
102
|
// AI Agents domain — customer-facing agent config under /agent.
|
|
102
103
|
this.agents = new Agents(client, this.enableAdmin);
|
|
103
104
|
this.audit = new Audit(client, this.enableAdmin);
|
|
105
|
+
this.contracts = new Contracts(client, this.enableAdmin);
|
|
104
106
|
// Carrier phone-number checks (SIM Swap, Number Verify) under /verify.
|
|
105
107
|
this.verify = new Verify(client, this.enableAdmin);
|
|
106
108
|
}
|
package/src/domains/Brands.js
CHANGED
|
@@ -519,6 +519,22 @@ export class Brands {
|
|
|
519
519
|
return this.client(`/brand/appeal/${safeBrandId}`, { method: 'GET', ...options });
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
+
/**
|
|
523
|
+
* Get TCR's identity feedback for a brand: why TCR could not verify it (status UNVERIFIED)
|
|
524
|
+
* @async
|
|
525
|
+
* @roles api, admin, developer, billing, user
|
|
526
|
+
* @param {Object} params - The parameters for getting the feedback
|
|
527
|
+
* @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, record `_id`, or internal reference).
|
|
528
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
529
|
+
* @throws {Error} Throws an error if the brandId parameter is missing
|
|
530
|
+
* @returns {Promise<SdkResponse<Object>>} BrandFeedback: { brandId, category: [{ id, displayName, description, fields, errors: [{ code, message }] }] }
|
|
531
|
+
*/
|
|
532
|
+
async getBrandFeedback({ brandId, options = {} }) {
|
|
533
|
+
this.client._require({ brandId });
|
|
534
|
+
const safeBrandId = encodeURIComponent(brandId);
|
|
535
|
+
return this.client(`/brand/feedback/${safeBrandId}`, { method: 'GET', ...options });
|
|
536
|
+
}
|
|
537
|
+
|
|
522
538
|
/**
|
|
523
539
|
* Submit a brand identity status appeal with supporting documentation
|
|
524
540
|
* @async
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Contracts domain: the staff queue for pricing read from signed PandaDoc contracts. Every method lives under
|
|
9
|
+
* the admin namespace, present only when the SDK is created with `enableAdmin: true`. JS SDK only by design.
|
|
10
|
+
*/
|
|
11
|
+
export class Contracts {
|
|
12
|
+
constructor(client, enableAdmin) {
|
|
13
|
+
this.client = client;
|
|
14
|
+
this.enableAdmin = enableAdmin;
|
|
15
|
+
|
|
16
|
+
// Hidden Admin namespace INSIDE the domain
|
|
17
|
+
if (enableAdmin) {
|
|
18
|
+
this.admin = {
|
|
19
|
+
/**
|
|
20
|
+
* List contracts for the staff queue, newest first. Staff-only.
|
|
21
|
+
* @async
|
|
22
|
+
* @roles signalhouse
|
|
23
|
+
* @param {Object} [params]
|
|
24
|
+
* @param {string|string[]} [params.status] - One status, or several (an array or a comma-separated string)
|
|
25
|
+
* @param {string} [params.groupId] - Only this group's contracts, newest signed first
|
|
26
|
+
* @param {number} [params.page] - Page number (default 1)
|
|
27
|
+
* @param {number} [params.limit] - Contracts per page (default 25, max 100)
|
|
28
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
29
|
+
* @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`; each contract carries `pandadocUrl`
|
|
30
|
+
*/
|
|
31
|
+
getContracts: async ({ status, groupId, page, limit, options = {} } = {}) => {
|
|
32
|
+
const queryString = this.client._getQueryString({ status: Array.isArray(status) ? status.join(",") : status, groupId, page, limit });
|
|
33
|
+
return this.client(`/contract${queryString}`, { method: "GET", ...options });
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Get one contract: issues, diff, signers, a PandaDoc link and, when it has no group, a suggested one. Staff-only.
|
|
38
|
+
* @async
|
|
39
|
+
* @roles signalhouse
|
|
40
|
+
* @param {Object} params
|
|
41
|
+
* @param {string} params.contractId - The contract's ID
|
|
42
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
43
|
+
* @returns {Promise<SdkResponse<any>>} - The contract with `pandadocUrl` and `suggestedGroup`
|
|
44
|
+
*/
|
|
45
|
+
getContract: async ({ contractId, options = {} }) => {
|
|
46
|
+
this.client._require({ contractId });
|
|
47
|
+
return this.client(`/contract/${encodeURIComponent(contractId)}`, { method: "GET", ...options });
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Link a contract to a group by hand; the document is then read again against that group. The link resets the contract's
|
|
52
|
+
* status, so a scheduled contract loses its schedule. Staff-only.
|
|
53
|
+
* @async
|
|
54
|
+
* @roles signalhouse
|
|
55
|
+
* @param {Object} params
|
|
56
|
+
* @param {string} params.contractId - The contract's ID
|
|
57
|
+
* @param {string} params.groupId - The group the contract is for
|
|
58
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
59
|
+
* @returns {Promise<SdkResponse<any>>} - The contract after the re-read
|
|
60
|
+
*/
|
|
61
|
+
linkContractGroup: async ({ contractId, groupId, options = {} }) => {
|
|
62
|
+
this.client._require({ contractId, groupId });
|
|
63
|
+
return this.client(`/contract/${encodeURIComponent(contractId)}/link`, { method: "POST", body: { groupId }, ...options });
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Apply a contract's pricing to its group now (staff approval). A contract dated in the future is scheduled instead.
|
|
68
|
+
* Staff-only.
|
|
69
|
+
* @async
|
|
70
|
+
* @roles signalhouse
|
|
71
|
+
* @param {Object} params
|
|
72
|
+
* @param {string} params.contractId - The contract's ID
|
|
73
|
+
* @param {string} params.expectedUpdatedAt - The `updatedAt` of the contract as reviewed; a changed contract gets a 409
|
|
74
|
+
* @param {string} params.expectedGroupId - The group the contract was reviewed for
|
|
75
|
+
* @param {?number} [params.expectedPlanCharge] - The immediate charge shown from `applyPreview`, in microdollars; a plan
|
|
76
|
+
* create that would charge anything else is refused before charging
|
|
77
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
78
|
+
* @returns {Promise<SdkResponse<any>>} - The contract after the apply
|
|
79
|
+
*/
|
|
80
|
+
applyContract: async ({ contractId, expectedUpdatedAt, expectedGroupId, expectedPlanCharge, options = {} }) => {
|
|
81
|
+
this.client._require({ contractId, expectedUpdatedAt, expectedGroupId });
|
|
82
|
+
return this.client(`/contract/${encodeURIComponent(contractId)}/apply`, { method: "POST", body: { expectedUpdatedAt, expectedGroupId, ...(expectedPlanCharge !== undefined ? { expectedPlanCharge } : {}) }, ...options });
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Reject a contract so it is never applied. Staff-only.
|
|
87
|
+
* @async
|
|
88
|
+
* @roles signalhouse
|
|
89
|
+
* @param {Object} params
|
|
90
|
+
* @param {string} params.contractId - The contract's ID
|
|
91
|
+
* @param {string} params.reason - Why it is rejected
|
|
92
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
93
|
+
* @returns {Promise<SdkResponse<any>>} - The rejected contract
|
|
94
|
+
*/
|
|
95
|
+
rejectContract: async ({ contractId, reason, options = {} }) => {
|
|
96
|
+
this.client._require({ contractId, reason });
|
|
97
|
+
return this.client(`/contract/${encodeURIComponent(contractId)}/reject`, { method: "POST", body: { reason }, ...options });
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Read a contract from PandaDoc again and re-parse it. Not allowed while scheduled, or once pricing is being written or has been applied.
|
|
102
|
+
* Staff-only.
|
|
103
|
+
* @async
|
|
104
|
+
* @roles signalhouse
|
|
105
|
+
* @param {Object} params
|
|
106
|
+
* @param {string} params.contractId - The contract's ID
|
|
107
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
108
|
+
* @returns {Promise<SdkResponse<any>>} - The contract after the re-read
|
|
109
|
+
*/
|
|
110
|
+
reparseContract: async ({ contractId, options = {} }) => {
|
|
111
|
+
this.client._require({ contractId });
|
|
112
|
+
return this.client(`/contract/${encodeURIComponent(contractId)}/reparse`, { method: "POST", body: {}, ...options });
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
package/src/domains/Rcs.js
CHANGED
|
@@ -496,7 +496,7 @@ export class RcsMessages {
|
|
|
496
496
|
* @param {string} [params.expireTime] - ISO-8601 time the RCS message expires
|
|
497
497
|
* @param {RcsMessageFallback} [params.fallback] - The fallback to price; its from is optional here, and with none the leg is priced on the channel of the agent's linked campaign
|
|
498
498
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
499
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { billingClass, segments, recipientCount, rcsLeg, fallbackLeg, totals, balance, issues, warnings }; rcsLeg.mediaSurcharge is the carrier's surcharge on media over 5 MB for one recipient, and rcsLeg.cost already holds it for every recipient; rcsLeg.cost is null with the fallback mode sms_only; a message over 100 MB adds a MEDIA_TOO_LARGE issue.
|
|
499
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { billingClass, segments, recipientCount, rcsLeg, fallbackLeg, totals, balance, issues, warnings }; rcsLeg.mediaSurcharge is the carrier's surcharge on media over 5 MB for one recipient, and rcsLeg.cost already holds it for every recipient; rcsLeg.cost is null with the fallback mode sms_only; a message over 100 MB adds a MEDIA_TOO_LARGE issue, and an external media URL that redirects adds a MEDIA_REDIRECT issue.
|
|
500
500
|
*/
|
|
501
501
|
async estimate({ agentId, recipients, recipientCount, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, options = {} }) {
|
|
502
502
|
this.client._require({ agentId });
|
package/src/domains/Templates.js
CHANGED
|
@@ -11,12 +11,20 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
+
* A declared placeholder. Placeholders go in text, card titles and descriptions, button labels and fallback text. A url
|
|
15
|
+
* variable may fill a whole link or media URL, and any variable may fill a URL's path, query or fragment, percent-encoded. A
|
|
16
|
+
* dial number takes one phoneNumber variable and a calendar time one dateTime variable, each for the whole field. A calendar
|
|
17
|
+
* title and description and postbackData take text. A location's address and label take none. The send checks each filled
|
|
18
|
+
* field and blocks a recipient whose field fails with CONTENT_INVALID.
|
|
14
19
|
* @typedef {Object} RcsVariable
|
|
15
20
|
* @property {string} key - Placeholder key used as {{key}} (/^[a-z][a-z0-9_]{0,63}$/)
|
|
16
21
|
* @property {string} [label] - Display label
|
|
17
22
|
* @property {"text"|"number"|"dateTime"|"phoneNumber"|"url"} type - Value type
|
|
18
|
-
* @property {boolean} required -
|
|
19
|
-
* @property {
|
|
23
|
+
* @property {boolean} required - Without missingPolicy: whether a recipient with no value and no default is blocked
|
|
24
|
+
* @property {"default"|"block"|"drop"} [missingPolicy] - What a recipient with no value gets: the default (empty when none),
|
|
25
|
+
* a VARIABLE_MISSING block, or the send without each block that uses the variable. Omitted keeps the older rule: the
|
|
26
|
+
* default, else VARIABLE_MISSING when required, else empty. An empty value, or one of only spaces, counts as no value
|
|
27
|
+
* @property {string} [default] - Value used when none is supplied, by the default policy or with no policy
|
|
20
28
|
* @property {string} [sample] - Example value for previews
|
|
21
29
|
*/
|
|
22
30
|
|
|
@@ -117,6 +125,8 @@
|
|
|
117
125
|
* @property {"image"|"video"|"audio"|"file"} kind - Media kind
|
|
118
126
|
* @property {number|null} width - Pixel width, when known
|
|
119
127
|
* @property {number|null} height - Pixel height, when known
|
|
128
|
+
* @property {{ mms?: { url: string, bytes: number } }} variants - An image over the MMS size limit has an MMS copy, which an
|
|
129
|
+
* MMS fallback leg sends; {} otherwise
|
|
120
130
|
* @property {string} createdAt - ISO timestamp
|
|
121
131
|
*/
|
|
122
132
|
|
|
@@ -138,7 +148,8 @@
|
|
|
138
148
|
* @property {Object<string, string[]>} trafficByUseCase - The traffic types each agent use case may send
|
|
139
149
|
* @property {Object<string, string>} defaultTrafficByUseCase - The traffic type a single-purpose agent sends when a request names none
|
|
140
150
|
* @property {{ cardButtonsInline: number, suggestedActionsInline: number, linesPerField: number, charsPerLine: number }} ios - How an iPhone lays out RCS content
|
|
141
|
-
* @property {{ maxUploadBytes: number, mimeTypes: string[] }} media - Upload
|
|
151
|
+
* @property {{ maxUploadBytes: number, mimeTypes: string[], maxImageEdge: number, imageTargetBytes: number }} media - Upload
|
|
152
|
+
* constraints; an image over maxImageEdge or imageTargetBytes is compressed to both
|
|
142
153
|
* @property {{ available: boolean }} geocoding - Whether this server resolves VIEW_LOCATION addresses (geocodeAddress answers 503 when false)
|
|
143
154
|
* @property {{ provider: "infobip"|"sinch", adapterVersion: string, limits: Object<string, number>, unsupported: Array<{ feature: string, code: string, message: string }> }|null} provider - Provider-specific limits when a provider was requested
|
|
144
155
|
*/
|
|
@@ -308,7 +319,7 @@ export class Templates {
|
|
|
308
319
|
|
|
309
320
|
/**
|
|
310
321
|
* Publish a template's current draft; no draft returns 409 NO_DRAFT, a draft changed mid-publish returns 409 DRAFT_CHANGED (publish again) and an incomplete draft returns 400 TEMPLATE_INVALID
|
|
311
|
-
* A block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED, whose message names the category ("Content moderation flagged this text: spam"). The check passes when the Moderation API fails.
|
|
322
|
+
* A block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED, whose message names the category ("Content moderation flagged this text: spam"). The check passes when the Moderation API fails. An image URL with a variable is moderated at send instead, with its value filled in, and a refused image blocks the recipient with MODERATION.
|
|
312
323
|
* @async
|
|
313
324
|
* @roles api, admin, developer
|
|
314
325
|
* @param {Object} params - The parameters for publishing a template
|
|
@@ -368,7 +379,7 @@ export class Templates {
|
|
|
368
379
|
|
|
369
380
|
/**
|
|
370
381
|
* Validate an unsaved body or a stored version without writing anything
|
|
371
|
-
* Validate runs the publish checks, the content policy check included: a block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED. Saving a draft does not run that check.
|
|
382
|
+
* Validate runs the publish checks, the content policy check included: a block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED. An image URL with a variable is moderated at send instead, with its value filled in, and a refused image blocks the recipient with MODERATION. Saving a draft does not run that check.
|
|
372
383
|
* @async
|
|
373
384
|
* @roles api, admin, developer, billing, user
|
|
374
385
|
* @param {Object} params - The parameters for validation; pass exactly one of body or version
|
|
@@ -424,7 +435,9 @@ export class Templates {
|
|
|
424
435
|
}
|
|
425
436
|
|
|
426
437
|
/**
|
|
427
|
-
* Upload a media file for use in template bodies; returns its public URL.
|
|
438
|
+
* Upload a media file for use in template bodies; returns its public URL. An image over 1920 px on its longest edge or over
|
|
439
|
+
* 5,000,000 bytes is compressed to both, and one over the MMS size limit also gets an MMS copy in variants.mms. 503 when
|
|
440
|
+
* media storage is not configured
|
|
428
441
|
* @async
|
|
429
442
|
* @roles api, admin, developer
|
|
430
443
|
* @param {Object} params - The parameters for the upload
|
|
@@ -31,6 +31,7 @@ export class SignalHouseSDK {
|
|
|
31
31
|
voice: Voice;
|
|
32
32
|
agents: Agents;
|
|
33
33
|
audit: Audit;
|
|
34
|
+
contracts: Contracts;
|
|
34
35
|
verify: Verify;
|
|
35
36
|
/**
|
|
36
37
|
* Client for API requests
|
|
@@ -118,4 +119,5 @@ import { Webhooks } from "./domains/Webhooks.js";
|
|
|
118
119
|
import { Voice } from "./domains/Voice.js";
|
|
119
120
|
import { Agents } from "./domains/Agents.js";
|
|
120
121
|
import { Audit } from "./domains/Audit.js";
|
|
122
|
+
import { Contracts } from "./domains/Contracts.js";
|
|
121
123
|
import { Verify } from "./domains/Verify.js";
|
|
@@ -483,6 +483,20 @@ export class Brands {
|
|
|
483
483
|
brandId: BrandLookupId;
|
|
484
484
|
options?: RequestOptions;
|
|
485
485
|
}): Promise<SdkResponse<any[]>>;
|
|
486
|
+
/**
|
|
487
|
+
* Get TCR's identity feedback for a brand: why TCR could not verify it (status UNVERIFIED)
|
|
488
|
+
* @async
|
|
489
|
+
* @roles api, admin, developer, billing, user
|
|
490
|
+
* @param {Object} params - The parameters for getting the feedback
|
|
491
|
+
* @param {BrandLookupId} params.brandId - Brand lookup id (carrier Brand ID, record `_id`, or internal reference).
|
|
492
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
493
|
+
* @throws {Error} Throws an error if the brandId parameter is missing
|
|
494
|
+
* @returns {Promise<SdkResponse<Object>>} BrandFeedback: { brandId, category: [{ id, displayName, description, fields, errors: [{ code, message }] }] }
|
|
495
|
+
*/
|
|
496
|
+
getBrandFeedback({ brandId, options }: {
|
|
497
|
+
brandId: BrandLookupId;
|
|
498
|
+
options?: RequestOptions;
|
|
499
|
+
}): Promise<SdkResponse<any>>;
|
|
486
500
|
/**
|
|
487
501
|
* Submit a brand identity status appeal with supporting documentation
|
|
488
502
|
* @async
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Contracts domain: the staff queue for pricing read from signed PandaDoc contracts. Every method lives under
|
|
8
|
+
* the admin namespace, present only when the SDK is created with `enableAdmin: true`. JS SDK only by design.
|
|
9
|
+
*/
|
|
10
|
+
export class Contracts {
|
|
11
|
+
constructor(client: any, enableAdmin: any);
|
|
12
|
+
client: any;
|
|
13
|
+
enableAdmin: any;
|
|
14
|
+
admin: {
|
|
15
|
+
/**
|
|
16
|
+
* List contracts for the staff queue, newest first. Staff-only.
|
|
17
|
+
* @async
|
|
18
|
+
* @roles signalhouse
|
|
19
|
+
* @param {Object} [params]
|
|
20
|
+
* @param {string|string[]} [params.status] - One status, or several (an array or a comma-separated string)
|
|
21
|
+
* @param {string} [params.groupId] - Only this group's contracts, newest signed first
|
|
22
|
+
* @param {number} [params.page] - Page number (default 1)
|
|
23
|
+
* @param {number} [params.limit] - Contracts per page (default 25, max 100)
|
|
24
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
25
|
+
* @returns {Promise<SdkResponse<any>>} - `{ data, total, page, limit }`; each contract carries `pandadocUrl`
|
|
26
|
+
*/
|
|
27
|
+
getContracts: ({ status, groupId, page, limit, options }?: {
|
|
28
|
+
status?: string | string[];
|
|
29
|
+
groupId?: string;
|
|
30
|
+
page?: number;
|
|
31
|
+
limit?: number;
|
|
32
|
+
options?: RequestOptions;
|
|
33
|
+
}) => Promise<SdkResponse<any>>;
|
|
34
|
+
/**
|
|
35
|
+
* Get one contract: issues, diff, signers, a PandaDoc link and, when it has no group, a suggested one. Staff-only.
|
|
36
|
+
* @async
|
|
37
|
+
* @roles signalhouse
|
|
38
|
+
* @param {Object} params
|
|
39
|
+
* @param {string} params.contractId - The contract's ID
|
|
40
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
41
|
+
* @returns {Promise<SdkResponse<any>>} - The contract with `pandadocUrl` and `suggestedGroup`
|
|
42
|
+
*/
|
|
43
|
+
getContract: ({ contractId, options }: {
|
|
44
|
+
contractId: string;
|
|
45
|
+
options?: RequestOptions;
|
|
46
|
+
}) => Promise<SdkResponse<any>>;
|
|
47
|
+
/**
|
|
48
|
+
* Link a contract to a group by hand; the document is then read again against that group. The link resets the contract's
|
|
49
|
+
* status, so a scheduled contract loses its schedule. Staff-only.
|
|
50
|
+
* @async
|
|
51
|
+
* @roles signalhouse
|
|
52
|
+
* @param {Object} params
|
|
53
|
+
* @param {string} params.contractId - The contract's ID
|
|
54
|
+
* @param {string} params.groupId - The group the contract is for
|
|
55
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
56
|
+
* @returns {Promise<SdkResponse<any>>} - The contract after the re-read
|
|
57
|
+
*/
|
|
58
|
+
linkContractGroup: ({ contractId, groupId, options }: {
|
|
59
|
+
contractId: string;
|
|
60
|
+
groupId: string;
|
|
61
|
+
options?: RequestOptions;
|
|
62
|
+
}) => Promise<SdkResponse<any>>;
|
|
63
|
+
/**
|
|
64
|
+
* Apply a contract's pricing to its group now (staff approval). A contract dated in the future is scheduled instead.
|
|
65
|
+
* Staff-only.
|
|
66
|
+
* @async
|
|
67
|
+
* @roles signalhouse
|
|
68
|
+
* @param {Object} params
|
|
69
|
+
* @param {string} params.contractId - The contract's ID
|
|
70
|
+
* @param {string} params.expectedUpdatedAt - The `updatedAt` of the contract as reviewed; a changed contract gets a 409
|
|
71
|
+
* @param {string} params.expectedGroupId - The group the contract was reviewed for
|
|
72
|
+
* @param {?number} [params.expectedPlanCharge] - The immediate charge shown from `applyPreview`, in microdollars; a plan
|
|
73
|
+
* create that would charge anything else is refused before charging
|
|
74
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
75
|
+
* @returns {Promise<SdkResponse<any>>} - The contract after the apply
|
|
76
|
+
*/
|
|
77
|
+
applyContract: ({ contractId, expectedUpdatedAt, expectedGroupId, expectedPlanCharge, options }: {
|
|
78
|
+
contractId: string;
|
|
79
|
+
expectedUpdatedAt: string;
|
|
80
|
+
expectedGroupId: string;
|
|
81
|
+
expectedPlanCharge?: number | null;
|
|
82
|
+
options?: RequestOptions;
|
|
83
|
+
}) => Promise<SdkResponse<any>>;
|
|
84
|
+
/**
|
|
85
|
+
* Reject a contract so it is never applied. Staff-only.
|
|
86
|
+
* @async
|
|
87
|
+
* @roles signalhouse
|
|
88
|
+
* @param {Object} params
|
|
89
|
+
* @param {string} params.contractId - The contract's ID
|
|
90
|
+
* @param {string} params.reason - Why it is rejected
|
|
91
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
92
|
+
* @returns {Promise<SdkResponse<any>>} - The rejected contract
|
|
93
|
+
*/
|
|
94
|
+
rejectContract: ({ contractId, reason, options }: {
|
|
95
|
+
contractId: string;
|
|
96
|
+
reason: string;
|
|
97
|
+
options?: RequestOptions;
|
|
98
|
+
}) => Promise<SdkResponse<any>>;
|
|
99
|
+
/**
|
|
100
|
+
* Read a contract from PandaDoc again and re-parse it. Not allowed while scheduled, or once pricing is being written or has been applied.
|
|
101
|
+
* Staff-only.
|
|
102
|
+
* @async
|
|
103
|
+
* @roles signalhouse
|
|
104
|
+
* @param {Object} params
|
|
105
|
+
* @param {string} params.contractId - The contract's ID
|
|
106
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
107
|
+
* @returns {Promise<SdkResponse<any>>} - The contract after the re-read
|
|
108
|
+
*/
|
|
109
|
+
reparseContract: ({ contractId, options }: {
|
|
110
|
+
contractId: string;
|
|
111
|
+
options?: RequestOptions;
|
|
112
|
+
}) => Promise<SdkResponse<any>>;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
|
|
116
|
+
export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
|
package/types/domains/Rcs.d.ts
CHANGED
|
@@ -524,7 +524,7 @@ export class RcsMessages {
|
|
|
524
524
|
* @param {string} [params.expireTime] - ISO-8601 time the RCS message expires
|
|
525
525
|
* @param {RcsMessageFallback} [params.fallback] - The fallback to price; its from is optional here, and with none the leg is priced on the channel of the agent's linked campaign
|
|
526
526
|
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
527
|
-
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { billingClass, segments, recipientCount, rcsLeg, fallbackLeg, totals, balance, issues, warnings }; rcsLeg.mediaSurcharge is the carrier's surcharge on media over 5 MB for one recipient, and rcsLeg.cost already holds it for every recipient; rcsLeg.cost is null with the fallback mode sms_only; a message over 100 MB adds a MEDIA_TOO_LARGE issue.
|
|
527
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to { billingClass, segments, recipientCount, rcsLeg, fallbackLeg, totals, balance, issues, warnings }; rcsLeg.mediaSurcharge is the carrier's surcharge on media over 5 MB for one recipient, and rcsLeg.cost already holds it for every recipient; rcsLeg.cost is null with the fallback mode sms_only; a message over 100 MB adds a MEDIA_TOO_LARGE issue, and an external media URL that redirects adds a MEDIA_REDIRECT issue.
|
|
528
528
|
*/
|
|
529
529
|
estimate({ agentId, recipients, recipientCount, templateId, templateVersion, content, contentFormat, trafficType, ttlSeconds, expireTime, fallback, options }: {
|
|
530
530
|
agentId: string;
|
|
@@ -138,7 +138,7 @@ export class Templates {
|
|
|
138
138
|
}): Promise<SdkResponse<SavedTemplate>>;
|
|
139
139
|
/**
|
|
140
140
|
* Publish a template's current draft; no draft returns 409 NO_DRAFT, a draft changed mid-publish returns 409 DRAFT_CHANGED (publish again) and an incomplete draft returns 400 TEMPLATE_INVALID
|
|
141
|
-
* A block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED, whose message names the category ("Content moderation flagged this text: spam"). The check passes when the Moderation API fails.
|
|
141
|
+
* A block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED, whose message names the category ("Content moderation flagged this text: spam"). The check passes when the Moderation API fails. An image URL with a variable is moderated at send instead, with its value filled in, and a refused image blocks the recipient with MODERATION.
|
|
142
142
|
* @async
|
|
143
143
|
* @roles api, admin, developer
|
|
144
144
|
* @param {Object} params - The parameters for publishing a template
|
|
@@ -190,7 +190,7 @@ export class Templates {
|
|
|
190
190
|
}): Promise<SdkResponse<Page<VersionSummary>>>;
|
|
191
191
|
/**
|
|
192
192
|
* Validate an unsaved body or a stored version without writing anything
|
|
193
|
-
* Validate runs the publish checks, the content policy check included: a block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED. Saving a draft does not run that check.
|
|
193
|
+
* Validate runs the publish checks, the content policy check included: a block whose text or image the Moderation API flags is an error with code CONTENT_POLICY_FLAGGED. An image URL with a variable is moderated at send instead, with its value filled in, and a refused image blocks the recipient with MODERATION. Saving a draft does not run that check.
|
|
194
194
|
* @async
|
|
195
195
|
* @roles api, admin, developer, billing, user
|
|
196
196
|
* @param {Object} params - The parameters for validation; pass exactly one of body or version
|
|
@@ -242,7 +242,9 @@ export class Templates {
|
|
|
242
242
|
options?: RequestOptions;
|
|
243
243
|
}): Promise<SdkResponse<GeocodeResult>>;
|
|
244
244
|
/**
|
|
245
|
-
* Upload a media file for use in template bodies; returns its public URL.
|
|
245
|
+
* Upload a media file for use in template bodies; returns its public URL. An image over 1920 px on its longest edge or over
|
|
246
|
+
* 5,000,000 bytes is compressed to both, and one over the MMS size limit also gets an MMS copy in variants.mms. 503 when
|
|
247
|
+
* media storage is not configured
|
|
246
248
|
* @async
|
|
247
249
|
* @roles api, admin, developer
|
|
248
250
|
* @param {Object} params - The parameters for the upload
|
|
@@ -266,6 +268,13 @@ export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
|
|
|
266
268
|
* version when one exists, otherwise the draft; an explicit selector never falls back (404 when missing).
|
|
267
269
|
*/
|
|
268
270
|
export type VersionSelector = number | "draft" | "published";
|
|
271
|
+
/**
|
|
272
|
+
* A declared placeholder. Placeholders go in text, card titles and descriptions, button labels and fallback text. A url
|
|
273
|
+
* variable may fill a whole link or media URL, and any variable may fill a URL's path, query or fragment, percent-encoded. A
|
|
274
|
+
* dial number takes one phoneNumber variable and a calendar time one dateTime variable, each for the whole field. A calendar
|
|
275
|
+
* title and description and postbackData take text. A location's address and label take none. The send checks each filled
|
|
276
|
+
* field and blocks a recipient whose field fails with CONTENT_INVALID.
|
|
277
|
+
*/
|
|
269
278
|
export type RcsVariable = {
|
|
270
279
|
/**
|
|
271
280
|
* - Placeholder key used as {{key}} (/^[a-z][a-z0-9_]{0,63}$/)
|
|
@@ -280,11 +289,17 @@ export type RcsVariable = {
|
|
|
280
289
|
*/
|
|
281
290
|
type: "text" | "number" | "dateTime" | "phoneNumber" | "url";
|
|
282
291
|
/**
|
|
283
|
-
* -
|
|
292
|
+
* - Without missingPolicy: whether a recipient with no value and no default is blocked
|
|
284
293
|
*/
|
|
285
294
|
required: boolean;
|
|
286
295
|
/**
|
|
287
|
-
* -
|
|
296
|
+
* - What a recipient with no value gets: the default (empty when none),
|
|
297
|
+
* a VARIABLE_MISSING block, or the send without each block that uses the variable. Omitted keeps the older rule: the
|
|
298
|
+
* default, else VARIABLE_MISSING when required, else empty. An empty value, or one of only spaces, counts as no value
|
|
299
|
+
*/
|
|
300
|
+
missingPolicy?: "default" | "block" | "drop";
|
|
301
|
+
/**
|
|
302
|
+
* - Value used when none is supplied, by the default policy or with no policy
|
|
288
303
|
*/
|
|
289
304
|
default?: string;
|
|
290
305
|
/**
|
|
@@ -537,6 +552,16 @@ export type MediaAsset = {
|
|
|
537
552
|
* - Pixel height, when known
|
|
538
553
|
*/
|
|
539
554
|
height: number | null;
|
|
555
|
+
/**
|
|
556
|
+
* - An image over the MMS size limit has an MMS copy, which an
|
|
557
|
+
* MMS fallback leg sends; {} otherwise
|
|
558
|
+
*/
|
|
559
|
+
variants: {
|
|
560
|
+
mms?: {
|
|
561
|
+
url: string;
|
|
562
|
+
bytes: number;
|
|
563
|
+
};
|
|
564
|
+
};
|
|
540
565
|
/**
|
|
541
566
|
* - ISO timestamp
|
|
542
567
|
*/
|
|
@@ -624,11 +649,14 @@ export type Capabilities = {
|
|
|
624
649
|
charsPerLine: number;
|
|
625
650
|
};
|
|
626
651
|
/**
|
|
627
|
-
* - Upload
|
|
652
|
+
* - Upload
|
|
653
|
+
* constraints; an image over maxImageEdge or imageTargetBytes is compressed to both
|
|
628
654
|
*/
|
|
629
655
|
media: {
|
|
630
656
|
maxUploadBytes: number;
|
|
631
657
|
mimeTypes: string[];
|
|
658
|
+
maxImageEdge: number;
|
|
659
|
+
imageTargetBytes: number;
|
|
632
660
|
};
|
|
633
661
|
/**
|
|
634
662
|
* - Whether this server resolves VIEW_LOCATION addresses (geocodeAddress answers 503 when false)
|