@sentdm/sentdm 0.3.5
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/CHANGELOG.md +103 -0
- package/LICENSE +201 -0
- package/README.md +393 -0
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +200 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +200 -0
- package/client.d.ts.map +1 -0
- package/client.js +486 -0
- package/client.js.map +1 -0
- package/client.mjs +482 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +6 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/index.js +30 -0
- package/index.js.map +1 -0
- package/index.mjs +7 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +35 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +32 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +75 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +75 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +87 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +81 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +11 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +137 -0
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/contacts.d.mts +103 -0
- package/resources/contacts.d.mts.map +1 -0
- package/resources/contacts.d.ts +103 -0
- package/resources/contacts.d.ts.map +1 -0
- package/resources/contacts.js +33 -0
- package/resources/contacts.js.map +1 -0
- package/resources/contacts.mjs +29 -0
- package/resources/contacts.mjs.map +1 -0
- package/resources/index.d.mts +6 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +6 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +15 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +7 -0
- package/resources/index.mjs.map +1 -0
- package/resources/messages.d.mts +222 -0
- package/resources/messages.d.mts.map +1 -0
- package/resources/messages.d.ts +222 -0
- package/resources/messages.d.ts.map +1 -0
- package/resources/messages.js +90 -0
- package/resources/messages.js.map +1 -0
- package/resources/messages.mjs +86 -0
- package/resources/messages.mjs.map +1 -0
- package/resources/number-lookup.d.mts +59 -0
- package/resources/number-lookup.d.mts.map +1 -0
- package/resources/number-lookup.d.ts +59 -0
- package/resources/number-lookup.d.ts.map +1 -0
- package/resources/number-lookup.js +17 -0
- package/resources/number-lookup.js.map +1 -0
- package/resources/number-lookup.mjs +13 -0
- package/resources/number-lookup.mjs.map +1 -0
- package/resources/organizations/index.d.mts +3 -0
- package/resources/organizations/index.d.mts.map +1 -0
- package/resources/organizations/index.d.ts +3 -0
- package/resources/organizations/index.d.ts.map +1 -0
- package/resources/organizations/index.js +9 -0
- package/resources/organizations/index.js.map +1 -0
- package/resources/organizations/index.mjs +4 -0
- package/resources/organizations/index.mjs.map +1 -0
- package/resources/organizations/organizations.d.mts +63 -0
- package/resources/organizations/organizations.d.mts.map +1 -0
- package/resources/organizations/organizations.d.ts +63 -0
- package/resources/organizations/organizations.d.ts.map +1 -0
- package/resources/organizations/organizations.js +46 -0
- package/resources/organizations/organizations.js.map +1 -0
- package/resources/organizations/organizations.mjs +41 -0
- package/resources/organizations/organizations.mjs.map +1 -0
- package/resources/organizations/users.d.mts +126 -0
- package/resources/organizations/users.d.mts.map +1 -0
- package/resources/organizations/users.d.ts +126 -0
- package/resources/organizations/users.d.ts.map +1 -0
- package/resources/organizations/users.js +95 -0
- package/resources/organizations/users.js.map +1 -0
- package/resources/organizations/users.mjs +91 -0
- package/resources/organizations/users.mjs.map +1 -0
- package/resources/organizations.d.mts +2 -0
- package/resources/organizations.d.mts.map +1 -0
- package/resources/organizations.d.ts +2 -0
- package/resources/organizations.d.ts.map +1 -0
- package/resources/organizations.js +6 -0
- package/resources/organizations.js.map +1 -0
- package/resources/organizations.mjs +3 -0
- package/resources/organizations.mjs.map +1 -0
- package/resources/templates.d.mts +333 -0
- package/resources/templates.d.mts.map +1 -0
- package/resources/templates.d.ts +333 -0
- package/resources/templates.d.ts.map +1 -0
- package/resources/templates.js +84 -0
- package/resources/templates.js.map +1 -0
- package/resources/templates.mjs +80 -0
- package/resources/templates.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +832 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/resource.ts +11 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/index.ts +22 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +50 -0
- package/src/internal/request-options.ts +91 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +128 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +2 -0
- package/src/resources/contacts.ts +142 -0
- package/src/resources/index.ts +38 -0
- package/src/resources/messages.ts +283 -0
- package/src/resources/number-lookup.ts +80 -0
- package/src/resources/organizations/index.ts +18 -0
- package/src/resources/organizations/organizations.ts +116 -0
- package/src/resources/organizations/users.ts +189 -0
- package/src/resources/organizations.ts +3 -0
- package/src/resources/templates.ts +430 -0
- package/src/resources.ts +1 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import * as TemplatesAPI from "./templates.mjs";
|
|
3
|
+
import { APIPromise } from "../core/api-promise.mjs";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
5
|
+
export declare class Templates extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new message template for the authenticated customer with comprehensive
|
|
8
|
+
* template definitions including headers, body, footer, and interactive buttons.
|
|
9
|
+
* Supports automatic metadata generation using AI (display name, language,
|
|
10
|
+
* category). Optionally submits the template for WhatsApp review. The customer ID
|
|
11
|
+
* is extracted from the authentication token.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const templateResponse = await client.templates.create({
|
|
16
|
+
* definition: { body: {} },
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
create(body: TemplateCreateParams, options?: RequestOptions): APIPromise<TemplateResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves a specific message template by its unique identifier for the
|
|
23
|
+
* authenticated customer with comprehensive template definitions including
|
|
24
|
+
* headers, body, footer, and interactive buttons. The customer ID is extracted
|
|
25
|
+
* from the authentication token.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const templateResponse = await client.templates.retrieve(
|
|
30
|
+
* '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
31
|
+
* );
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<TemplateResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves all message templates available for the authenticated customer with
|
|
37
|
+
* comprehensive template definitions including headers, body, footer, and
|
|
38
|
+
* interactive buttons. Supports advanced filtering by search term, status, and
|
|
39
|
+
* category, plus pagination. The customer ID is extracted from the authentication
|
|
40
|
+
* token.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const templates = await client.templates.list({
|
|
45
|
+
* page: 0,
|
|
46
|
+
* pageSize: 0,
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
list(query: TemplateListParams, options?: RequestOptions): APIPromise<TemplateListResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Deletes a specific message template by its unique identifier for the
|
|
53
|
+
* authenticated customer with smart deletion strategy. Deletion behavior: - If
|
|
54
|
+
* template has NO messages: Permanently deleted from database (hard delete). - If
|
|
55
|
+
* template has messages: Marked as deleted but preserved for message history (soft
|
|
56
|
+
* delete with snapshot). The template must exist and belong to the authenticated
|
|
57
|
+
* customer to be deleted successfully. The customer ID is extracted from the
|
|
58
|
+
* authentication token.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* await client.templates.delete(
|
|
63
|
+
* '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
64
|
+
* );
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
delete(id: string, options?: RequestOptions): APIPromise<void>;
|
|
68
|
+
}
|
|
69
|
+
export interface TemplateBodyContent {
|
|
70
|
+
template?: string;
|
|
71
|
+
type?: string | null;
|
|
72
|
+
variables?: Array<TemplateVariable> | null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Complete definition of a message template including header, body, footer, and
|
|
76
|
+
* buttons
|
|
77
|
+
*/
|
|
78
|
+
export interface TemplateDefinition {
|
|
79
|
+
/**
|
|
80
|
+
* Required template body with content for different channels (multi-channel,
|
|
81
|
+
* SMS-specific, or WhatsApp-specific)
|
|
82
|
+
*/
|
|
83
|
+
body: TemplateDefinition.Body;
|
|
84
|
+
/**
|
|
85
|
+
* Configuration specific to AUTHENTICATION category templates (optional)
|
|
86
|
+
*/
|
|
87
|
+
authenticationConfig?: TemplateDefinition.AuthenticationConfig | null;
|
|
88
|
+
/**
|
|
89
|
+
* Optional list of interactive buttons (e.g., quick replies, URLs, phone numbers)
|
|
90
|
+
*/
|
|
91
|
+
buttons?: Array<TemplateDefinition.Button> | null;
|
|
92
|
+
/**
|
|
93
|
+
* The version of the template definition format
|
|
94
|
+
*/
|
|
95
|
+
definitionVersion?: string | null;
|
|
96
|
+
/**
|
|
97
|
+
* Optional template footer with optional variables
|
|
98
|
+
*/
|
|
99
|
+
footer?: TemplateDefinition.Footer | null;
|
|
100
|
+
/**
|
|
101
|
+
* Optional template header with optional variables
|
|
102
|
+
*/
|
|
103
|
+
header?: TemplateDefinition.Header | null;
|
|
104
|
+
}
|
|
105
|
+
export declare namespace TemplateDefinition {
|
|
106
|
+
/**
|
|
107
|
+
* Required template body with content for different channels (multi-channel,
|
|
108
|
+
* SMS-specific, or WhatsApp-specific)
|
|
109
|
+
*/
|
|
110
|
+
interface Body {
|
|
111
|
+
/**
|
|
112
|
+
* Content that will be used for all channels (SMS and WhatsApp) unless
|
|
113
|
+
* channel-specific content is provided
|
|
114
|
+
*/
|
|
115
|
+
multiChannel?: TemplatesAPI.TemplateBodyContent | null;
|
|
116
|
+
/**
|
|
117
|
+
* SMS-specific content that overrides multi-channel content for SMS messages
|
|
118
|
+
*/
|
|
119
|
+
sms?: TemplatesAPI.TemplateBodyContent | null;
|
|
120
|
+
/**
|
|
121
|
+
* WhatsApp-specific content that overrides multi-channel content for WhatsApp
|
|
122
|
+
* messages
|
|
123
|
+
*/
|
|
124
|
+
whatsapp?: TemplatesAPI.TemplateBodyContent | null;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Configuration specific to AUTHENTICATION category templates (optional)
|
|
128
|
+
*/
|
|
129
|
+
interface AuthenticationConfig {
|
|
130
|
+
/**
|
|
131
|
+
* Whether to add the security recommendation text: "For your security, do not
|
|
132
|
+
* share this code."
|
|
133
|
+
*/
|
|
134
|
+
addSecurityRecommendation?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Code expiration time in minutes (1-90). If set, adds footer: "This code expires
|
|
137
|
+
* in X minutes."
|
|
138
|
+
*/
|
|
139
|
+
codeExpirationMinutes?: number | null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Interactive button in a message template
|
|
143
|
+
*/
|
|
144
|
+
interface Button {
|
|
145
|
+
/**
|
|
146
|
+
* The unique identifier of the button (1-based index)
|
|
147
|
+
*/
|
|
148
|
+
id?: number;
|
|
149
|
+
/**
|
|
150
|
+
* Properties specific to the button type
|
|
151
|
+
*/
|
|
152
|
+
props?: Button.Props;
|
|
153
|
+
/**
|
|
154
|
+
* The type of button (e.g., QUICK_REPLY, URL, PHONE_NUMBER, VOICE_CALL, COPY_CODE)
|
|
155
|
+
*/
|
|
156
|
+
type?: string;
|
|
157
|
+
}
|
|
158
|
+
namespace Button {
|
|
159
|
+
/**
|
|
160
|
+
* Properties specific to the button type
|
|
161
|
+
*/
|
|
162
|
+
interface Props {
|
|
163
|
+
activeFor?: number | null;
|
|
164
|
+
autofillText?: string | null;
|
|
165
|
+
countryCode?: string | null;
|
|
166
|
+
offerCode?: string | null;
|
|
167
|
+
otpType?: string | null;
|
|
168
|
+
packageName?: string | null;
|
|
169
|
+
phoneNumber?: string | null;
|
|
170
|
+
quickReplyType?: string | null;
|
|
171
|
+
signatureHash?: string | null;
|
|
172
|
+
text?: string | null;
|
|
173
|
+
url?: string | null;
|
|
174
|
+
urlType?: string | null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Optional template footer with optional variables
|
|
179
|
+
*/
|
|
180
|
+
interface Footer {
|
|
181
|
+
/**
|
|
182
|
+
* The footer template text with optional variable placeholders
|
|
183
|
+
*/
|
|
184
|
+
template?: string;
|
|
185
|
+
/**
|
|
186
|
+
* The type of footer (typically "text")
|
|
187
|
+
*/
|
|
188
|
+
type?: string | null;
|
|
189
|
+
/**
|
|
190
|
+
* List of variables used in the footer template
|
|
191
|
+
*/
|
|
192
|
+
variables?: Array<TemplatesAPI.TemplateVariable> | null;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Optional template header with optional variables
|
|
196
|
+
*/
|
|
197
|
+
interface Header {
|
|
198
|
+
/**
|
|
199
|
+
* The header template text with optional variable placeholders (e.g., "Welcome to
|
|
200
|
+
* {{0:variable}}")
|
|
201
|
+
*/
|
|
202
|
+
template?: string;
|
|
203
|
+
/**
|
|
204
|
+
* The type of header (e.g., "text", "image", "video", "document")
|
|
205
|
+
*/
|
|
206
|
+
type?: string | null;
|
|
207
|
+
/**
|
|
208
|
+
* List of variables used in the header template
|
|
209
|
+
*/
|
|
210
|
+
variables?: Array<TemplatesAPI.TemplateVariable> | null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Represents a message template with comprehensive metadata including definition
|
|
215
|
+
* structure
|
|
216
|
+
*/
|
|
217
|
+
export interface TemplateResponse {
|
|
218
|
+
/**
|
|
219
|
+
* The unique identifier of the template
|
|
220
|
+
*/
|
|
221
|
+
id?: string;
|
|
222
|
+
/**
|
|
223
|
+
* The template category (e.g., MARKETING, UTILITY, AUTHENTICATION)
|
|
224
|
+
*/
|
|
225
|
+
category?: string;
|
|
226
|
+
/**
|
|
227
|
+
* The date and time when the template was created
|
|
228
|
+
*/
|
|
229
|
+
createdAt?: string;
|
|
230
|
+
/**
|
|
231
|
+
* The complete template definition including header, body, footer, and buttons
|
|
232
|
+
*/
|
|
233
|
+
definition?: TemplateDefinition;
|
|
234
|
+
/**
|
|
235
|
+
* The display name of the template (auto-generated if not provided)
|
|
236
|
+
*/
|
|
237
|
+
displayName?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Indicates whether the template is published and available for use
|
|
240
|
+
*/
|
|
241
|
+
isPublished?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* The template language code (e.g., en_US, es_ES)
|
|
244
|
+
*/
|
|
245
|
+
language?: string;
|
|
246
|
+
/**
|
|
247
|
+
* The approval status of the template (e.g., APPROVED, PENDING, REJECTED, DRAFT)
|
|
248
|
+
*/
|
|
249
|
+
status?: string;
|
|
250
|
+
/**
|
|
251
|
+
* The date and time when the template was last updated
|
|
252
|
+
*/
|
|
253
|
+
updatedAt?: string | null;
|
|
254
|
+
/**
|
|
255
|
+
* The WhatsApp Business API template ID from Meta
|
|
256
|
+
*/
|
|
257
|
+
whatsappTemplateId?: string;
|
|
258
|
+
/**
|
|
259
|
+
* The WhatsApp template name as registered with Meta
|
|
260
|
+
*/
|
|
261
|
+
whatsappTemplateName?: string;
|
|
262
|
+
}
|
|
263
|
+
export interface TemplateVariable {
|
|
264
|
+
id?: number;
|
|
265
|
+
name?: string;
|
|
266
|
+
props?: TemplateVariable.Props;
|
|
267
|
+
type?: string;
|
|
268
|
+
}
|
|
269
|
+
export declare namespace TemplateVariable {
|
|
270
|
+
interface Props {
|
|
271
|
+
alt?: string | null;
|
|
272
|
+
mediaType?: string | null;
|
|
273
|
+
sample?: string | null;
|
|
274
|
+
shortUrl?: string | null;
|
|
275
|
+
url?: string | null;
|
|
276
|
+
variableType?: string | null;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
export interface TemplateListResponse {
|
|
280
|
+
items?: Array<TemplateResponse>;
|
|
281
|
+
page?: number;
|
|
282
|
+
pageSize?: number;
|
|
283
|
+
totalCount?: number;
|
|
284
|
+
totalPages?: number;
|
|
285
|
+
}
|
|
286
|
+
export interface TemplateCreateParams {
|
|
287
|
+
/**
|
|
288
|
+
* Template definition containing header, body, footer, and buttons
|
|
289
|
+
*/
|
|
290
|
+
definition: TemplateDefinition;
|
|
291
|
+
/**
|
|
292
|
+
* The template category (e.g., MARKETING, UTILITY, AUTHENTICATION). Can only be
|
|
293
|
+
* set when creating a new template. If not provided, will be auto-generated using
|
|
294
|
+
* AI.
|
|
295
|
+
*/
|
|
296
|
+
category?: string | null;
|
|
297
|
+
/**
|
|
298
|
+
* The template language code (e.g., en_US, es_ES). Can only be set when creating a
|
|
299
|
+
* new template. If not provided, will be auto-detected using AI.
|
|
300
|
+
*/
|
|
301
|
+
language?: string | null;
|
|
302
|
+
/**
|
|
303
|
+
* When false, the template will be saved as draft. When true, the template will be
|
|
304
|
+
* submitted for review.
|
|
305
|
+
*/
|
|
306
|
+
submitForReview?: boolean;
|
|
307
|
+
}
|
|
308
|
+
export interface TemplateListParams {
|
|
309
|
+
/**
|
|
310
|
+
* The page number (zero-indexed). Default is 0.
|
|
311
|
+
*/
|
|
312
|
+
page: number;
|
|
313
|
+
/**
|
|
314
|
+
* The number of items per page (1-1000). Default is 100.
|
|
315
|
+
*/
|
|
316
|
+
pageSize: number;
|
|
317
|
+
/**
|
|
318
|
+
* Optional filter by template category (e.g., MARKETING, UTILITY, AUTHENTICATION)
|
|
319
|
+
*/
|
|
320
|
+
category?: string | null;
|
|
321
|
+
/**
|
|
322
|
+
* Optional search term to filter templates by name or content
|
|
323
|
+
*/
|
|
324
|
+
search?: string | null;
|
|
325
|
+
/**
|
|
326
|
+
* Optional filter by template status (e.g., APPROVED, PENDING, REJECTED, DRAFT)
|
|
327
|
+
*/
|
|
328
|
+
status?: string | null;
|
|
329
|
+
}
|
|
330
|
+
export declare namespace Templates {
|
|
331
|
+
export { type TemplateBodyContent as TemplateBodyContent, type TemplateDefinition as TemplateDefinition, type TemplateResponse as TemplateResponse, type TemplateVariable as TemplateVariable, type TemplateListResponse as TemplateListResponse, type TemplateCreateParams as TemplateCreateParams, type TemplateListParams as TemplateListParams, };
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=templates.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.mts","sourceRoot":"","sources":["../src/resources/templates.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC;IAI1F;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC;IAI5E;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAI3F;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAM/D;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC;IAE9B;;OAEG;IACH,oBAAoB,CAAC,EAAE,kBAAkB,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAEtE;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,MAAM,CAAC,GA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AEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import * as TemplatesAPI from "./templates.js";
|
|
3
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
5
|
+
export declare class Templates extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new message template for the authenticated customer with comprehensive
|
|
8
|
+
* template definitions including headers, body, footer, and interactive buttons.
|
|
9
|
+
* Supports automatic metadata generation using AI (display name, language,
|
|
10
|
+
* category). Optionally submits the template for WhatsApp review. The customer ID
|
|
11
|
+
* is extracted from the authentication token.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const templateResponse = await client.templates.create({
|
|
16
|
+
* definition: { body: {} },
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
create(body: TemplateCreateParams, options?: RequestOptions): APIPromise<TemplateResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves a specific message template by its unique identifier for the
|
|
23
|
+
* authenticated customer with comprehensive template definitions including
|
|
24
|
+
* headers, body, footer, and interactive buttons. The customer ID is extracted
|
|
25
|
+
* from the authentication token.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const templateResponse = await client.templates.retrieve(
|
|
30
|
+
* '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
31
|
+
* );
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<TemplateResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves all message templates available for the authenticated customer with
|
|
37
|
+
* comprehensive template definitions including headers, body, footer, and
|
|
38
|
+
* interactive buttons. Supports advanced filtering by search term, status, and
|
|
39
|
+
* category, plus pagination. The customer ID is extracted from the authentication
|
|
40
|
+
* token.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const templates = await client.templates.list({
|
|
45
|
+
* page: 0,
|
|
46
|
+
* pageSize: 0,
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
list(query: TemplateListParams, options?: RequestOptions): APIPromise<TemplateListResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Deletes a specific message template by its unique identifier for the
|
|
53
|
+
* authenticated customer with smart deletion strategy. Deletion behavior: - If
|
|
54
|
+
* template has NO messages: Permanently deleted from database (hard delete). - If
|
|
55
|
+
* template has messages: Marked as deleted but preserved for message history (soft
|
|
56
|
+
* delete with snapshot). The template must exist and belong to the authenticated
|
|
57
|
+
* customer to be deleted successfully. The customer ID is extracted from the
|
|
58
|
+
* authentication token.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* await client.templates.delete(
|
|
63
|
+
* '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
64
|
+
* );
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
delete(id: string, options?: RequestOptions): APIPromise<void>;
|
|
68
|
+
}
|
|
69
|
+
export interface TemplateBodyContent {
|
|
70
|
+
template?: string;
|
|
71
|
+
type?: string | null;
|
|
72
|
+
variables?: Array<TemplateVariable> | null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Complete definition of a message template including header, body, footer, and
|
|
76
|
+
* buttons
|
|
77
|
+
*/
|
|
78
|
+
export interface TemplateDefinition {
|
|
79
|
+
/**
|
|
80
|
+
* Required template body with content for different channels (multi-channel,
|
|
81
|
+
* SMS-specific, or WhatsApp-specific)
|
|
82
|
+
*/
|
|
83
|
+
body: TemplateDefinition.Body;
|
|
84
|
+
/**
|
|
85
|
+
* Configuration specific to AUTHENTICATION category templates (optional)
|
|
86
|
+
*/
|
|
87
|
+
authenticationConfig?: TemplateDefinition.AuthenticationConfig | null;
|
|
88
|
+
/**
|
|
89
|
+
* Optional list of interactive buttons (e.g., quick replies, URLs, phone numbers)
|
|
90
|
+
*/
|
|
91
|
+
buttons?: Array<TemplateDefinition.Button> | null;
|
|
92
|
+
/**
|
|
93
|
+
* The version of the template definition format
|
|
94
|
+
*/
|
|
95
|
+
definitionVersion?: string | null;
|
|
96
|
+
/**
|
|
97
|
+
* Optional template footer with optional variables
|
|
98
|
+
*/
|
|
99
|
+
footer?: TemplateDefinition.Footer | null;
|
|
100
|
+
/**
|
|
101
|
+
* Optional template header with optional variables
|
|
102
|
+
*/
|
|
103
|
+
header?: TemplateDefinition.Header | null;
|
|
104
|
+
}
|
|
105
|
+
export declare namespace TemplateDefinition {
|
|
106
|
+
/**
|
|
107
|
+
* Required template body with content for different channels (multi-channel,
|
|
108
|
+
* SMS-specific, or WhatsApp-specific)
|
|
109
|
+
*/
|
|
110
|
+
interface Body {
|
|
111
|
+
/**
|
|
112
|
+
* Content that will be used for all channels (SMS and WhatsApp) unless
|
|
113
|
+
* channel-specific content is provided
|
|
114
|
+
*/
|
|
115
|
+
multiChannel?: TemplatesAPI.TemplateBodyContent | null;
|
|
116
|
+
/**
|
|
117
|
+
* SMS-specific content that overrides multi-channel content for SMS messages
|
|
118
|
+
*/
|
|
119
|
+
sms?: TemplatesAPI.TemplateBodyContent | null;
|
|
120
|
+
/**
|
|
121
|
+
* WhatsApp-specific content that overrides multi-channel content for WhatsApp
|
|
122
|
+
* messages
|
|
123
|
+
*/
|
|
124
|
+
whatsapp?: TemplatesAPI.TemplateBodyContent | null;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Configuration specific to AUTHENTICATION category templates (optional)
|
|
128
|
+
*/
|
|
129
|
+
interface AuthenticationConfig {
|
|
130
|
+
/**
|
|
131
|
+
* Whether to add the security recommendation text: "For your security, do not
|
|
132
|
+
* share this code."
|
|
133
|
+
*/
|
|
134
|
+
addSecurityRecommendation?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Code expiration time in minutes (1-90). If set, adds footer: "This code expires
|
|
137
|
+
* in X minutes."
|
|
138
|
+
*/
|
|
139
|
+
codeExpirationMinutes?: number | null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Interactive button in a message template
|
|
143
|
+
*/
|
|
144
|
+
interface Button {
|
|
145
|
+
/**
|
|
146
|
+
* The unique identifier of the button (1-based index)
|
|
147
|
+
*/
|
|
148
|
+
id?: number;
|
|
149
|
+
/**
|
|
150
|
+
* Properties specific to the button type
|
|
151
|
+
*/
|
|
152
|
+
props?: Button.Props;
|
|
153
|
+
/**
|
|
154
|
+
* The type of button (e.g., QUICK_REPLY, URL, PHONE_NUMBER, VOICE_CALL, COPY_CODE)
|
|
155
|
+
*/
|
|
156
|
+
type?: string;
|
|
157
|
+
}
|
|
158
|
+
namespace Button {
|
|
159
|
+
/**
|
|
160
|
+
* Properties specific to the button type
|
|
161
|
+
*/
|
|
162
|
+
interface Props {
|
|
163
|
+
activeFor?: number | null;
|
|
164
|
+
autofillText?: string | null;
|
|
165
|
+
countryCode?: string | null;
|
|
166
|
+
offerCode?: string | null;
|
|
167
|
+
otpType?: string | null;
|
|
168
|
+
packageName?: string | null;
|
|
169
|
+
phoneNumber?: string | null;
|
|
170
|
+
quickReplyType?: string | null;
|
|
171
|
+
signatureHash?: string | null;
|
|
172
|
+
text?: string | null;
|
|
173
|
+
url?: string | null;
|
|
174
|
+
urlType?: string | null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Optional template footer with optional variables
|
|
179
|
+
*/
|
|
180
|
+
interface Footer {
|
|
181
|
+
/**
|
|
182
|
+
* The footer template text with optional variable placeholders
|
|
183
|
+
*/
|
|
184
|
+
template?: string;
|
|
185
|
+
/**
|
|
186
|
+
* The type of footer (typically "text")
|
|
187
|
+
*/
|
|
188
|
+
type?: string | null;
|
|
189
|
+
/**
|
|
190
|
+
* List of variables used in the footer template
|
|
191
|
+
*/
|
|
192
|
+
variables?: Array<TemplatesAPI.TemplateVariable> | null;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Optional template header with optional variables
|
|
196
|
+
*/
|
|
197
|
+
interface Header {
|
|
198
|
+
/**
|
|
199
|
+
* The header template text with optional variable placeholders (e.g., "Welcome to
|
|
200
|
+
* {{0:variable}}")
|
|
201
|
+
*/
|
|
202
|
+
template?: string;
|
|
203
|
+
/**
|
|
204
|
+
* The type of header (e.g., "text", "image", "video", "document")
|
|
205
|
+
*/
|
|
206
|
+
type?: string | null;
|
|
207
|
+
/**
|
|
208
|
+
* List of variables used in the header template
|
|
209
|
+
*/
|
|
210
|
+
variables?: Array<TemplatesAPI.TemplateVariable> | null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Represents a message template with comprehensive metadata including definition
|
|
215
|
+
* structure
|
|
216
|
+
*/
|
|
217
|
+
export interface TemplateResponse {
|
|
218
|
+
/**
|
|
219
|
+
* The unique identifier of the template
|
|
220
|
+
*/
|
|
221
|
+
id?: string;
|
|
222
|
+
/**
|
|
223
|
+
* The template category (e.g., MARKETING, UTILITY, AUTHENTICATION)
|
|
224
|
+
*/
|
|
225
|
+
category?: string;
|
|
226
|
+
/**
|
|
227
|
+
* The date and time when the template was created
|
|
228
|
+
*/
|
|
229
|
+
createdAt?: string;
|
|
230
|
+
/**
|
|
231
|
+
* The complete template definition including header, body, footer, and buttons
|
|
232
|
+
*/
|
|
233
|
+
definition?: TemplateDefinition;
|
|
234
|
+
/**
|
|
235
|
+
* The display name of the template (auto-generated if not provided)
|
|
236
|
+
*/
|
|
237
|
+
displayName?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Indicates whether the template is published and available for use
|
|
240
|
+
*/
|
|
241
|
+
isPublished?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* The template language code (e.g., en_US, es_ES)
|
|
244
|
+
*/
|
|
245
|
+
language?: string;
|
|
246
|
+
/**
|
|
247
|
+
* The approval status of the template (e.g., APPROVED, PENDING, REJECTED, DRAFT)
|
|
248
|
+
*/
|
|
249
|
+
status?: string;
|
|
250
|
+
/**
|
|
251
|
+
* The date and time when the template was last updated
|
|
252
|
+
*/
|
|
253
|
+
updatedAt?: string | null;
|
|
254
|
+
/**
|
|
255
|
+
* The WhatsApp Business API template ID from Meta
|
|
256
|
+
*/
|
|
257
|
+
whatsappTemplateId?: string;
|
|
258
|
+
/**
|
|
259
|
+
* The WhatsApp template name as registered with Meta
|
|
260
|
+
*/
|
|
261
|
+
whatsappTemplateName?: string;
|
|
262
|
+
}
|
|
263
|
+
export interface TemplateVariable {
|
|
264
|
+
id?: number;
|
|
265
|
+
name?: string;
|
|
266
|
+
props?: TemplateVariable.Props;
|
|
267
|
+
type?: string;
|
|
268
|
+
}
|
|
269
|
+
export declare namespace TemplateVariable {
|
|
270
|
+
interface Props {
|
|
271
|
+
alt?: string | null;
|
|
272
|
+
mediaType?: string | null;
|
|
273
|
+
sample?: string | null;
|
|
274
|
+
shortUrl?: string | null;
|
|
275
|
+
url?: string | null;
|
|
276
|
+
variableType?: string | null;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
export interface TemplateListResponse {
|
|
280
|
+
items?: Array<TemplateResponse>;
|
|
281
|
+
page?: number;
|
|
282
|
+
pageSize?: number;
|
|
283
|
+
totalCount?: number;
|
|
284
|
+
totalPages?: number;
|
|
285
|
+
}
|
|
286
|
+
export interface TemplateCreateParams {
|
|
287
|
+
/**
|
|
288
|
+
* Template definition containing header, body, footer, and buttons
|
|
289
|
+
*/
|
|
290
|
+
definition: TemplateDefinition;
|
|
291
|
+
/**
|
|
292
|
+
* The template category (e.g., MARKETING, UTILITY, AUTHENTICATION). Can only be
|
|
293
|
+
* set when creating a new template. If not provided, will be auto-generated using
|
|
294
|
+
* AI.
|
|
295
|
+
*/
|
|
296
|
+
category?: string | null;
|
|
297
|
+
/**
|
|
298
|
+
* The template language code (e.g., en_US, es_ES). Can only be set when creating a
|
|
299
|
+
* new template. If not provided, will be auto-detected using AI.
|
|
300
|
+
*/
|
|
301
|
+
language?: string | null;
|
|
302
|
+
/**
|
|
303
|
+
* When false, the template will be saved as draft. When true, the template will be
|
|
304
|
+
* submitted for review.
|
|
305
|
+
*/
|
|
306
|
+
submitForReview?: boolean;
|
|
307
|
+
}
|
|
308
|
+
export interface TemplateListParams {
|
|
309
|
+
/**
|
|
310
|
+
* The page number (zero-indexed). Default is 0.
|
|
311
|
+
*/
|
|
312
|
+
page: number;
|
|
313
|
+
/**
|
|
314
|
+
* The number of items per page (1-1000). Default is 100.
|
|
315
|
+
*/
|
|
316
|
+
pageSize: number;
|
|
317
|
+
/**
|
|
318
|
+
* Optional filter by template category (e.g., MARKETING, UTILITY, AUTHENTICATION)
|
|
319
|
+
*/
|
|
320
|
+
category?: string | null;
|
|
321
|
+
/**
|
|
322
|
+
* Optional search term to filter templates by name or content
|
|
323
|
+
*/
|
|
324
|
+
search?: string | null;
|
|
325
|
+
/**
|
|
326
|
+
* Optional filter by template status (e.g., APPROVED, PENDING, REJECTED, DRAFT)
|
|
327
|
+
*/
|
|
328
|
+
status?: string | null;
|
|
329
|
+
}
|
|
330
|
+
export declare namespace Templates {
|
|
331
|
+
export { type TemplateBodyContent as TemplateBodyContent, type TemplateDefinition as TemplateDefinition, type TemplateResponse as TemplateResponse, type TemplateVariable as TemplateVariable, type TemplateListResponse as TemplateListResponse, type TemplateCreateParams as TemplateCreateParams, type TemplateListParams as TemplateListParams, };
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/resources/templates.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,YAAY;OACjB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC;IAI1F;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC;IAI5E;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAI3F;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAM/D;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;CAC5C;AAED;;;GA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