@signalhouse-sms/sdk 1.12.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 +7 -0
- package/src/domains/Audit.js +39 -0
- package/src/domains/Brands.js +16 -0
- package/src/domains/Contracts.js +117 -0
- package/src/domains/Messages.js +23 -1
- package/src/domains/Rcs.js +104 -12
- package/src/domains/Registrations.js +62 -2
- package/src/domains/Templates.js +19 -6
- package/src/domains/Verify.js +72 -0
- package/types/SignalHouseSDK.d.ts +6 -0
- package/types/domains/Audit.d.ts +39 -0
- package/types/domains/Brands.d.ts +14 -0
- package/types/domains/Contracts.d.ts +116 -0
- package/types/domains/Messages.d.ts +27 -1
- package/types/domains/Rcs.d.ts +136 -10
- package/types/domains/Registrations.d.ts +46 -2
- package/types/domains/Templates.d.ts +34 -6
- package/types/domains/Verify.d.ts +71 -0
|
@@ -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)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** @typedef {import('../SignalHouseSDK.js').RequestOptions} RequestOptions */
|
|
2
|
+
/**
|
|
3
|
+
* @template T
|
|
4
|
+
* @typedef {import('../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Carrier phone-number checks under /verify: SIM Swap and Number Verify. Every check the carrier answers is billed to
|
|
8
|
+
* the group's wallet (402 on insufficient funds); a check the carrier cannot run for the number is a 422 and is not charged.
|
|
9
|
+
*/
|
|
10
|
+
export class Verify {
|
|
11
|
+
/**
|
|
12
|
+
* Keep the JSON client every verify request goes through.
|
|
13
|
+
* @param {any} client - The JSON request client
|
|
14
|
+
* @param {boolean} [enableAdmin] - Whether admin-scoped behaviors are enabled
|
|
15
|
+
*/
|
|
16
|
+
constructor(client: any, enableAdmin?: boolean);
|
|
17
|
+
client: any;
|
|
18
|
+
enableAdmin: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Check whether a number's SIM card changed recently, as reported by its carrier. Billed once when the check answers;
|
|
21
|
+
* 422 when the check is not available for the number (not charged)
|
|
22
|
+
* @async
|
|
23
|
+
* @roles api, admin, developer
|
|
24
|
+
* @param {Object} params - The check
|
|
25
|
+
* @param {string} params.phoneNumber - The number to check, in international format (e.g. "+12025550123")
|
|
26
|
+
* @param {number} [params.maxAge] - Lookback window in hours, 1-2400; the carrier's default when omitted
|
|
27
|
+
* @param {boolean} [params.includeSwapDate] - Also return the latest SIM change date (no extra charge; default false)
|
|
28
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
29
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, swapped, maxAge, latestSimChange?, cost }`
|
|
30
|
+
*/
|
|
31
|
+
checkSimSwap({ phoneNumber, maxAge, includeSwapDate, options }: {
|
|
32
|
+
phoneNumber: string;
|
|
33
|
+
maxAge?: number;
|
|
34
|
+
includeSwapDate?: boolean;
|
|
35
|
+
options?: RequestOptions;
|
|
36
|
+
}): Promise<SdkResponse<any>>;
|
|
37
|
+
/**
|
|
38
|
+
* Start a Number Verify check. The end user's phone must open the returned `authorizationUrl` on mobile data (Wi-Fi off)
|
|
39
|
+
* within 10 minutes; the carrier then confirms whether the phone's own number matches. Read the result with
|
|
40
|
+
* getNumberVerification. Billed only when the check is answered (VERIFIED or NOT_VERIFIED)
|
|
41
|
+
* @async
|
|
42
|
+
* @roles api, admin, developer
|
|
43
|
+
* @param {Object} params - The check
|
|
44
|
+
* @param {string} params.phoneNumber - The number to verify, in international format (e.g. "+12025550123")
|
|
45
|
+
* @param {string} [params.devicePhoneNumber] - The phone's own number, sent to the carrier as a login hint
|
|
46
|
+
* @param {string} [params.redirectUrl] - An https URL the end user's browser is sent to after the check, with `?checkId=…`
|
|
47
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
48
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, status: "PENDING", authorizationUrl, expiresAt }`
|
|
49
|
+
*/
|
|
50
|
+
startNumberVerification({ phoneNumber, devicePhoneNumber, redirectUrl, options }: {
|
|
51
|
+
phoneNumber: string;
|
|
52
|
+
devicePhoneNumber?: string;
|
|
53
|
+
redirectUrl?: string;
|
|
54
|
+
options?: RequestOptions;
|
|
55
|
+
}): Promise<SdkResponse<any>>;
|
|
56
|
+
/**
|
|
57
|
+
* Get a Number Verify check's status and result. A PENDING check past its expiresAt reads as EXPIRED
|
|
58
|
+
* @async
|
|
59
|
+
* @roles api, admin, developer, billing, user
|
|
60
|
+
* @param {Object} params - The lookup
|
|
61
|
+
* @param {string} params.checkId - The check ID (e.g. NVC…)
|
|
62
|
+
* @param {RequestOptions} [params.options] - Additional options for the request
|
|
63
|
+
* @returns {Promise<SdkResponse<any>>} A promise that resolves to `{ checkId, phoneNumber, status, devicePhoneNumberVerified, failureReason, createdAt, expiresAt, completedAt, cost }`
|
|
64
|
+
*/
|
|
65
|
+
getNumberVerification({ checkId, options }: {
|
|
66
|
+
checkId: string;
|
|
67
|
+
options?: RequestOptions;
|
|
68
|
+
}): Promise<SdkResponse<any>>;
|
|
69
|
+
}
|
|
70
|
+
export type RequestOptions = import("../SignalHouseSDK.js").RequestOptions;
|
|
71
|
+
export type SdkResponse<T> = import("../SignalHouseSDK.js").SdkResponse<T>;
|