@sentdm/sentdm 0.7.2 → 0.15.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.
Files changed (161) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/README.md +71 -34
  3. package/client.d.mts +49 -21
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +49 -21
  6. package/client.d.ts.map +1 -1
  7. package/client.js +52 -38
  8. package/client.js.map +1 -1
  9. package/client.mjs +52 -38
  10. package/client.mjs.map +1 -1
  11. package/internal/tslib.js +17 -17
  12. package/internal/utils/log.d.mts.map +1 -1
  13. package/internal/utils/log.d.ts.map +1 -1
  14. package/internal/utils/log.js +0 -1
  15. package/internal/utils/log.js.map +1 -1
  16. package/internal/utils/log.mjs +0 -1
  17. package/internal/utils/log.mjs.map +1 -1
  18. package/internal/utils/query.d.mts +5 -0
  19. package/internal/utils/query.d.mts.map +1 -0
  20. package/internal/utils/query.d.ts +5 -0
  21. package/internal/utils/query.d.ts.map +1 -0
  22. package/internal/utils/query.js +23 -0
  23. package/internal/utils/query.js.map +1 -0
  24. package/internal/utils/query.mjs +20 -0
  25. package/internal/utils/query.mjs.map +1 -0
  26. package/internal/utils.d.mts +1 -0
  27. package/internal/utils.d.ts +1 -0
  28. package/internal/utils.js +1 -0
  29. package/internal/utils.js.map +1 -1
  30. package/internal/utils.mjs +1 -0
  31. package/package.json +7 -1
  32. package/resources/contacts.d.mts +243 -49
  33. package/resources/contacts.d.mts.map +1 -1
  34. package/resources/contacts.d.ts +243 -49
  35. package/resources/contacts.d.ts.map +1 -1
  36. package/resources/contacts.js +112 -15
  37. package/resources/contacts.js.map +1 -1
  38. package/resources/contacts.mjs +112 -15
  39. package/resources/contacts.mjs.map +1 -1
  40. package/resources/index.d.mts +8 -4
  41. package/resources/index.d.mts.map +1 -1
  42. package/resources/index.d.ts +8 -4
  43. package/resources/index.d.ts.map +1 -1
  44. package/resources/index.js +11 -3
  45. package/resources/index.js.map +1 -1
  46. package/resources/index.mjs +5 -1
  47. package/resources/index.mjs.map +1 -1
  48. package/resources/me.d.mts +269 -0
  49. package/resources/me.d.mts.map +1 -0
  50. package/resources/me.d.ts +269 -0
  51. package/resources/me.d.ts.map +1 -0
  52. package/resources/me.js +40 -0
  53. package/resources/me.js.map +1 -0
  54. package/resources/me.mjs +36 -0
  55. package/resources/me.mjs.map +1 -0
  56. package/resources/messages.d.mts +239 -133
  57. package/resources/messages.d.mts.map +1 -1
  58. package/resources/messages.d.ts +239 -133
  59. package/resources/messages.d.ts.map +1 -1
  60. package/resources/messages.js +42 -50
  61. package/resources/messages.js.map +1 -1
  62. package/resources/messages.mjs +42 -50
  63. package/resources/messages.mjs.map +1 -1
  64. package/resources/numbers.d.mts +70 -0
  65. package/resources/numbers.d.mts.map +1 -0
  66. package/resources/numbers.d.ts +70 -0
  67. package/resources/numbers.d.ts.map +1 -0
  68. package/resources/numbers.js +36 -0
  69. package/resources/numbers.js.map +1 -0
  70. package/resources/numbers.mjs +32 -0
  71. package/resources/numbers.mjs.map +1 -0
  72. package/resources/profiles/campaigns.d.mts +339 -0
  73. package/resources/profiles/campaigns.d.mts.map +1 -0
  74. package/resources/profiles/campaigns.d.ts +339 -0
  75. package/resources/profiles/campaigns.d.ts.map +1 -0
  76. package/resources/profiles/campaigns.js +148 -0
  77. package/resources/profiles/campaigns.js.map +1 -0
  78. package/resources/profiles/campaigns.mjs +144 -0
  79. package/resources/profiles/campaigns.mjs.map +1 -0
  80. package/resources/profiles/index.d.mts +3 -0
  81. package/resources/profiles/index.d.mts.map +1 -0
  82. package/resources/profiles/index.d.ts +3 -0
  83. package/resources/profiles/index.d.ts.map +1 -0
  84. package/resources/profiles/index.js +9 -0
  85. package/resources/profiles/index.js.map +1 -0
  86. package/resources/profiles/index.mjs +4 -0
  87. package/resources/profiles/index.mjs.map +1 -0
  88. package/resources/profiles/profiles.d.mts +967 -0
  89. package/resources/profiles/profiles.d.mts.map +1 -0
  90. package/resources/profiles/profiles.d.ts +967 -0
  91. package/resources/profiles/profiles.d.ts.map +1 -0
  92. package/resources/profiles/profiles.js +227 -0
  93. package/resources/profiles/profiles.js.map +1 -0
  94. package/resources/profiles/profiles.mjs +222 -0
  95. package/resources/profiles/profiles.mjs.map +1 -0
  96. package/resources/profiles.d.mts +2 -0
  97. package/resources/profiles.d.mts.map +1 -0
  98. package/resources/profiles.d.ts +2 -0
  99. package/resources/profiles.d.ts.map +1 -0
  100. package/resources/profiles.js +6 -0
  101. package/resources/profiles.js.map +1 -0
  102. package/resources/profiles.mjs +3 -0
  103. package/resources/profiles.mjs.map +1 -0
  104. package/resources/templates.d.mts +327 -191
  105. package/resources/templates.d.mts.map +1 -1
  106. package/resources/templates.d.ts +327 -191
  107. package/resources/templates.d.ts.map +1 -1
  108. package/resources/templates.js +80 -35
  109. package/resources/templates.js.map +1 -1
  110. package/resources/templates.mjs +80 -35
  111. package/resources/templates.mjs.map +1 -1
  112. package/resources/users.d.mts +251 -0
  113. package/resources/users.d.mts.map +1 -0
  114. package/resources/users.d.ts +251 -0
  115. package/resources/users.d.ts.map +1 -0
  116. package/resources/users.js +124 -0
  117. package/resources/users.js.map +1 -0
  118. package/resources/users.mjs +120 -0
  119. package/resources/users.mjs.map +1 -0
  120. package/resources/webhooks.d.mts +639 -0
  121. package/resources/webhooks.d.mts.map +1 -0
  122. package/resources/webhooks.d.ts +639 -0
  123. package/resources/webhooks.d.ts.map +1 -0
  124. package/resources/webhooks.js +237 -0
  125. package/resources/webhooks.js.map +1 -0
  126. package/resources/webhooks.mjs +233 -0
  127. package/resources/webhooks.mjs.map +1 -0
  128. package/src/client.ts +228 -80
  129. package/src/internal/utils/log.ts +0 -1
  130. package/src/internal/utils/query.ts +23 -0
  131. package/src/internal/utils.ts +1 -0
  132. package/src/resources/contacts.ts +335 -57
  133. package/src/resources/index.ts +81 -12
  134. package/src/resources/me.ts +333 -0
  135. package/src/resources/messages.ts +306 -147
  136. package/src/resources/numbers.ts +102 -0
  137. package/src/resources/profiles/campaigns.ts +501 -0
  138. package/src/resources/profiles/index.ts +38 -0
  139. package/src/resources/profiles/profiles.ts +1302 -0
  140. package/src/resources/profiles.ts +3 -0
  141. package/src/resources/templates.ts +424 -202
  142. package/src/resources/users.ts +366 -0
  143. package/src/resources/webhooks.ts +923 -0
  144. package/src/version.ts +1 -1
  145. package/version.d.mts +1 -1
  146. package/version.d.mts.map +1 -1
  147. package/version.d.ts +1 -1
  148. package/version.d.ts.map +1 -1
  149. package/version.js +1 -1
  150. package/version.js.map +1 -1
  151. package/version.mjs +1 -1
  152. package/version.mjs.map +1 -1
  153. package/resources/number-lookup.d.mts +0 -59
  154. package/resources/number-lookup.d.mts.map +0 -1
  155. package/resources/number-lookup.d.ts +0 -59
  156. package/resources/number-lookup.d.ts.map +0 -1
  157. package/resources/number-lookup.js +0 -17
  158. package/resources/number-lookup.js.map +0 -1
  159. package/resources/number-lookup.mjs +0 -13
  160. package/resources/number-lookup.mjs.map +0 -1
  161. package/src/resources/number-lookup.ts +0 -80
@@ -2,74 +2,124 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import * as TemplatesAPI from './templates';
5
+ import * as WebhooksAPI from './webhooks';
5
6
  import { APIPromise } from '../core/api-promise';
6
7
  import { buildHeaders } from '../internal/headers';
7
8
  import { RequestOptions } from '../internal/request-options';
8
9
  import { path } from '../internal/utils/path';
9
10
 
11
+ /**
12
+ * Manage message templates with variable substitution
13
+ */
10
14
  export class Templates extends APIResource {
11
15
  /**
12
- * Creates a new message template for the authenticated customer with comprehensive
13
- * template definitions including headers, body, footer, and interactive buttons.
14
- * Supports automatic metadata generation using AI (display name, language,
15
- * category). Optionally submits the template for WhatsApp review. The customer ID
16
- * is extracted from the authentication token.
16
+ * Creates a new message template with header, body, footer, and buttons. The
17
+ * template can be submitted for review immediately or saved as draft for later
18
+ * submission.
17
19
  *
18
20
  * @example
19
21
  * ```ts
20
- * const templateResponseV2 = await client.templates.create({
21
- * definition: { body: {} },
22
- * });
22
+ * const apiResponseTemplate = await client.templates.create();
23
23
  * ```
24
24
  */
25
- create(body: TemplateCreateParams, options?: RequestOptions): APIPromise<TemplateResponseV2> {
26
- return this._client.post('/v2/templates', { body, ...options });
25
+ create(params: TemplateCreateParams, options?: RequestOptions): APIPromise<APIResponseTemplate> {
26
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
27
+ return this._client.post('/v3/templates', {
28
+ body,
29
+ ...options,
30
+ headers: buildHeaders([
31
+ {
32
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
33
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
34
+ },
35
+ options?.headers,
36
+ ]),
37
+ });
27
38
  }
28
39
 
29
40
  /**
30
- * Retrieves a specific message template by its unique identifier for the
31
- * authenticated customer with comprehensive template definitions including
32
- * headers, body, footer, and interactive buttons. The customer ID is extracted
33
- * from the authentication token.
41
+ * Retrieves a specific template by its ID. Returns template details including
42
+ * name, category, language, status, and definition.
34
43
  *
35
44
  * @example
36
45
  * ```ts
37
- * const templateResponseV2 = await client.templates.retrieve(
46
+ * const apiResponseTemplate = await client.templates.retrieve(
38
47
  * '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
39
48
  * );
40
49
  * ```
41
50
  */
42
- retrieve(id: string, options?: RequestOptions): APIPromise<TemplateResponseV2> {
43
- return this._client.get(path`/v2/templates/${id}`, options);
51
+ retrieve(
52
+ id: string,
53
+ params: TemplateRetrieveParams | null | undefined = {},
54
+ options?: RequestOptions,
55
+ ): APIPromise<APIResponseTemplate> {
56
+ const { 'x-profile-id': xProfileID } = params ?? {};
57
+ return this._client.get(path`/v3/templates/${id}`, {
58
+ ...options,
59
+ headers: buildHeaders([
60
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
61
+ options?.headers,
62
+ ]),
63
+ });
44
64
  }
45
65
 
46
66
  /**
47
- * Retrieves all message templates available for the authenticated customer with
48
- * comprehensive template definitions including headers, body, footer, and
49
- * interactive buttons. Supports advanced filtering by search term, status, and
50
- * category, plus pagination. The customer ID is extracted from the authentication
51
- * token.
67
+ * Updates an existing template's name, category, language, definition, or submits
68
+ * it for review.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const apiResponseTemplate = await client.templates.update(
73
+ * '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
74
+ * );
75
+ * ```
76
+ */
77
+ update(
78
+ id: string,
79
+ params: TemplateUpdateParams,
80
+ options?: RequestOptions,
81
+ ): APIPromise<APIResponseTemplate> {
82
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
83
+ return this._client.put(path`/v3/templates/${id}`, {
84
+ body,
85
+ ...options,
86
+ headers: buildHeaders([
87
+ {
88
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
89
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
90
+ },
91
+ options?.headers,
92
+ ]),
93
+ });
94
+ }
95
+
96
+ /**
97
+ * Retrieves a paginated list of message templates for the authenticated customer.
98
+ * Supports filtering by status, category, and search term.
52
99
  *
53
100
  * @example
54
101
  * ```ts
55
102
  * const templates = await client.templates.list({
56
103
  * page: 0,
57
- * pageSize: 0,
104
+ * page_size: 0,
58
105
  * });
59
106
  * ```
60
107
  */
61
- list(query: TemplateListParams, options?: RequestOptions): APIPromise<TemplateListResponse> {
62
- return this._client.get('/v2/templates', { query, ...options });
108
+ list(params: TemplateListParams, options?: RequestOptions): APIPromise<TemplateListResponse> {
109
+ const { 'x-profile-id': xProfileID, ...query } = params;
110
+ return this._client.get('/v3/templates', {
111
+ query,
112
+ ...options,
113
+ headers: buildHeaders([
114
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
115
+ options?.headers,
116
+ ]),
117
+ });
63
118
  }
64
119
 
65
120
  /**
66
- * Deletes a specific message template by its unique identifier for the
67
- * authenticated customer with smart deletion strategy. Deletion behavior: - If
68
- * template has NO messages: Permanently deleted from database (hard delete). - If
69
- * template has messages: Marked as deleted but preserved for message history (soft
70
- * delete with snapshot). The template must exist and belong to the authenticated
71
- * customer to be deleted successfully. The customer ID is extracted from the
72
- * authentication token.
121
+ * Deletes a template by ID. Optionally, you can also delete the template from
122
+ * WhatsApp/Meta by setting delete_from_meta=true.
73
123
  *
74
124
  * @example
75
125
  * ```ts
@@ -78,252 +128,267 @@ export class Templates extends APIResource {
78
128
  * );
79
129
  * ```
80
130
  */
81
- delete(id: string, options?: RequestOptions): APIPromise<void> {
82
- return this._client.delete(path`/v2/templates/${id}`, {
131
+ delete(id: string, params: TemplateDeleteParams, options?: RequestOptions): APIPromise<void> {
132
+ const { 'x-profile-id': xProfileID, ...body } = params;
133
+ return this._client.delete(path`/v3/templates/${id}`, {
134
+ body,
83
135
  ...options,
84
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
136
+ headers: buildHeaders([
137
+ { Accept: '*/*', ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
138
+ options?.headers,
139
+ ]),
85
140
  });
86
141
  }
87
142
  }
88
143
 
89
- export interface TemplateBodyContent {
90
- template?: string;
91
-
92
- type?: string | null;
93
-
94
- variables?: Array<TemplateVariable> | null;
95
- }
96
-
97
144
  /**
98
- * Complete definition of a message template including header, body, footer, and
99
- * buttons
145
+ * Standard API response envelope for all v3 endpoints
100
146
  */
101
- export interface TemplateDefinition {
147
+ export interface APIResponseTemplate {
102
148
  /**
103
- * Required template body with content for different channels (multi-channel,
104
- * SMS-specific, or WhatsApp-specific)
149
+ * Template response for v3 API
105
150
  */
106
- body: TemplateDefinition.Body;
151
+ data?: Template | null;
107
152
 
108
153
  /**
109
- * Configuration specific to AUTHENTICATION category templates (optional)
154
+ * Error information
110
155
  */
111
- authenticationConfig?: TemplateDefinition.AuthenticationConfig | null;
156
+ error?: WebhooksAPI.ErrorDetail | null;
112
157
 
113
158
  /**
114
- * Optional list of interactive buttons (e.g., quick replies, URLs, phone numbers)
159
+ * Request and response metadata
115
160
  */
116
- buttons?: Array<TemplateDefinition.Button> | null;
161
+ meta?: WebhooksAPI.APIMeta;
117
162
 
118
163
  /**
119
- * The version of the template definition format
164
+ * Indicates whether the request was successful
120
165
  */
121
- definitionVersion?: string | null;
166
+ success?: boolean;
167
+ }
122
168
 
169
+ /**
170
+ * Configuration for AUTHENTICATION category templates
171
+ */
172
+ export interface SentDmServicesCommonContractsPocOsAuthenticationConfig {
123
173
  /**
124
- * Optional template footer with optional variables
174
+ * Whether to add the security recommendation text: "For your security, do not
175
+ * share this code."
125
176
  */
126
- footer?: TemplateDefinition.Footer | null;
177
+ addSecurityRecommendation?: boolean;
127
178
 
128
179
  /**
129
- * Optional template header with optional variables
180
+ * Code expiration time in minutes (1-90). If set, adds footer: "This code expires
181
+ * in X minutes."
130
182
  */
131
- header?: TemplateDefinition.Header | null;
183
+ codeExpirationMinutes?: number | null;
132
184
  }
133
185
 
134
- export namespace TemplateDefinition {
186
+ /**
187
+ * Body section of a message template with channel-specific content
188
+ */
189
+ export interface SentDmServicesCommonContractsPocOsTemplateBody {
135
190
  /**
136
- * Required template body with content for different channels (multi-channel,
137
- * SMS-specific, or WhatsApp-specific)
191
+ * Content that will be used for all channels (SMS and WhatsApp) unless
192
+ * channel-specific content is provided
138
193
  */
139
- export interface Body {
140
- /**
141
- * Content that will be used for all channels (SMS and WhatsApp) unless
142
- * channel-specific content is provided
143
- */
144
- multiChannel?: TemplatesAPI.TemplateBodyContent | null;
145
-
146
- /**
147
- * SMS-specific content that overrides multi-channel content for SMS messages
148
- */
149
- sms?: TemplatesAPI.TemplateBodyContent | null;
150
-
151
- /**
152
- * WhatsApp-specific content that overrides multi-channel content for WhatsApp
153
- * messages
154
- */
155
- whatsapp?: TemplatesAPI.TemplateBodyContent | null;
156
- }
194
+ multiChannel?: TemplateBodyContent | null;
157
195
 
158
196
  /**
159
- * Configuration specific to AUTHENTICATION category templates (optional)
197
+ * SMS-specific content that overrides multi-channel content for SMS messages
160
198
  */
161
- export interface AuthenticationConfig {
162
- /**
163
- * Whether to add the security recommendation text: "For your security, do not
164
- * share this code."
165
- */
166
- addSecurityRecommendation?: boolean;
199
+ sms?: TemplateBodyContent | null;
167
200
 
168
- /**
169
- * Code expiration time in minutes (1-90). If set, adds footer: "This code expires
170
- * in X minutes."
171
- */
172
- codeExpirationMinutes?: number | null;
173
- }
201
+ /**
202
+ * WhatsApp-specific content that overrides multi-channel content for WhatsApp
203
+ * messages
204
+ */
205
+ whatsapp?: TemplateBodyContent | null;
206
+ }
174
207
 
208
+ /**
209
+ * Interactive button in a message template
210
+ */
211
+ export interface SentDmServicesCommonContractsPocOsTemplateButton {
175
212
  /**
176
- * Interactive button in a message template
213
+ * The unique identifier of the button (1-based index)
177
214
  */
178
- export interface Button {
179
- /**
180
- * The unique identifier of the button (1-based index)
181
- */
182
- id?: number;
215
+ id?: number;
183
216
 
184
- /**
185
- * Properties specific to the button type
186
- */
187
- props?: Button.Props;
217
+ /**
218
+ * Properties specific to the button type
219
+ */
220
+ props?: SentDmServicesCommonContractsPocOsTemplateButtonProps;
188
221
 
189
- /**
190
- * The type of button (e.g., QUICK_REPLY, URL, PHONE_NUMBER, VOICE_CALL, COPY_CODE)
191
- */
192
- type?: string;
193
- }
222
+ /**
223
+ * The type of button (e.g., QUICK_REPLY, URL, PHONE_NUMBER, VOICE_CALL, COPY_CODE)
224
+ */
225
+ type?: string;
226
+ }
194
227
 
195
- export namespace Button {
196
- /**
197
- * Properties specific to the button type
198
- */
199
- export interface Props {
200
- activeFor?: number | null;
228
+ export interface SentDmServicesCommonContractsPocOsTemplateButtonProps {
229
+ activeFor?: number | null;
201
230
 
202
- autofillText?: string | null;
231
+ autofillText?: string | null;
203
232
 
204
- countryCode?: string | null;
233
+ countryCode?: string | null;
205
234
 
206
- offerCode?: string | null;
235
+ offerCode?: string | null;
207
236
 
208
- otpType?: string | null;
237
+ otpType?: string | null;
209
238
 
210
- packageName?: string | null;
239
+ packageName?: string | null;
211
240
 
212
- phoneNumber?: string | null;
241
+ phoneNumber?: string | null;
213
242
 
214
- quickReplyType?: string | null;
243
+ quickReplyType?: string | null;
215
244
 
216
- signatureHash?: string | null;
245
+ signatureHash?: string | null;
217
246
 
218
- text?: string | null;
247
+ text?: string | null;
219
248
 
220
- url?: string | null;
249
+ url?: string | null;
221
250
 
222
- urlType?: string | null;
223
- }
224
- }
251
+ urlType?: string | null;
252
+ }
225
253
 
254
+ /**
255
+ * Footer section of a message template
256
+ */
257
+ export interface SentDmServicesCommonContractsPocOsTemplateFooter {
226
258
  /**
227
- * Optional template footer with optional variables
259
+ * The footer template text with optional variable placeholders
228
260
  */
229
- export interface Footer {
230
- /**
231
- * The footer template text with optional variable placeholders
232
- */
233
- template?: string;
261
+ template?: string;
234
262
 
235
- /**
236
- * The type of footer (typically "text")
237
- */
238
- type?: string | null;
263
+ /**
264
+ * The type of footer (typically "text")
265
+ */
266
+ type?: string | null;
239
267
 
240
- /**
241
- * List of variables used in the footer template
242
- */
243
- variables?: Array<TemplatesAPI.TemplateVariable> | null;
244
- }
268
+ /**
269
+ * List of variables used in the footer template
270
+ */
271
+ variables?: Array<TemplateVariable> | null;
272
+ }
245
273
 
274
+ /**
275
+ * Header section of a message template
276
+ */
277
+ export interface SentDmServicesCommonContractsPocOsTemplateHeader {
246
278
  /**
247
- * Optional template header with optional variables
279
+ * The header template text with optional variable placeholders (e.g., "Welcome to
280
+ * {{0:variable}}")
248
281
  */
249
- export interface Header {
250
- /**
251
- * The header template text with optional variable placeholders (e.g., "Welcome to
252
- * {{0:variable}}")
253
- */
254
- template?: string;
282
+ template?: string;
255
283
 
256
- /**
257
- * The type of header (e.g., "text", "image", "video", "document")
258
- */
259
- type?: string | null;
284
+ /**
285
+ * The type of header (e.g., "text", "image", "video", "document")
286
+ */
287
+ type?: string | null;
260
288
 
261
- /**
262
- * List of variables used in the header template
263
- */
264
- variables?: Array<TemplatesAPI.TemplateVariable> | null;
265
- }
289
+ /**
290
+ * List of variables used in the header template
291
+ */
292
+ variables?: Array<TemplateVariable> | null;
266
293
  }
267
294
 
268
295
  /**
269
- * Represents a message template with comprehensive metadata including definition
270
- * structure
296
+ * Template response for v3 API
271
297
  */
272
- export interface TemplateResponseV2 {
298
+ export interface Template {
273
299
  /**
274
- * The unique identifier of the template
300
+ * Unique template identifier
275
301
  */
276
302
  id?: string;
277
303
 
278
304
  /**
279
- * The template category (e.g., MARKETING, UTILITY, AUTHENTICATION)
305
+ * Template category: MARKETING, UTILITY, AUTHENTICATION
280
306
  */
281
307
  category?: string;
282
308
 
283
309
  /**
284
- * The date and time when the template was created
310
+ * Supported channels: sms, whatsapp
285
311
  */
286
- createdAt?: string;
312
+ channels?: Array<string> | null;
287
313
 
288
314
  /**
289
- * The complete template definition including header, body, footer, and buttons
315
+ * When the template was created
290
316
  */
291
- definition?: TemplateDefinition;
317
+ created_at?: string;
292
318
 
293
319
  /**
294
- * The display name of the template (auto-generated if not provided)
320
+ * Whether the template is published and active
295
321
  */
296
- displayName?: string;
322
+ is_published?: boolean;
297
323
 
298
324
  /**
299
- * Indicates whether the template is published and available for use
325
+ * Template language code (e.g., en_US)
300
326
  */
301
- isPublished?: boolean;
327
+ language?: string;
302
328
 
303
329
  /**
304
- * The template language code (e.g., en_US, es_ES)
330
+ * Template display name
305
331
  */
306
- language?: string;
332
+ name?: string;
307
333
 
308
334
  /**
309
- * The approval status of the template (e.g., APPROVED, PENDING, REJECTED, DRAFT)
335
+ * Template status: APPROVED, PENDING, REJECTED
310
336
  */
311
337
  status?: string;
312
338
 
313
339
  /**
314
- * The date and time when the template was last updated
340
+ * When the template was last updated
315
341
  */
316
- updatedAt?: string | null;
342
+ updated_at?: string | null;
317
343
 
318
344
  /**
319
- * The WhatsApp Business API template ID from Meta
345
+ * Template variables for personalization
320
346
  */
321
- whatsappTemplateId?: string;
347
+ variables?: Array<string> | null;
348
+ }
349
+
350
+ export interface TemplateBodyContent {
351
+ template?: string;
352
+
353
+ type?: string | null;
322
354
 
355
+ variables?: Array<TemplateVariable> | null;
356
+ }
357
+
358
+ /**
359
+ * Complete definition of a message template including header, body, footer, and
360
+ * buttons
361
+ */
362
+ export interface TemplateDefinition {
323
363
  /**
324
- * The WhatsApp template name as registered with Meta
364
+ * Body section of a message template with channel-specific content
325
365
  */
326
- whatsappTemplateName?: string;
366
+ body: SentDmServicesCommonContractsPocOsTemplateBody;
367
+
368
+ /**
369
+ * Configuration for AUTHENTICATION category templates
370
+ */
371
+ authenticationConfig?: SentDmServicesCommonContractsPocOsAuthenticationConfig | null;
372
+
373
+ /**
374
+ * Optional list of interactive buttons (e.g., quick replies, URLs, phone numbers)
375
+ */
376
+ buttons?: Array<SentDmServicesCommonContractsPocOsTemplateButton> | null;
377
+
378
+ /**
379
+ * The version of the template definition format
380
+ */
381
+ definitionVersion?: string | null;
382
+
383
+ /**
384
+ * Footer section of a message template
385
+ */
386
+ footer?: SentDmServicesCommonContractsPocOsTemplateFooter | null;
387
+
388
+ /**
389
+ * Header section of a message template
390
+ */
391
+ header?: SentDmServicesCommonContractsPocOsTemplateHeader | null;
327
392
  }
328
393
 
329
394
  export interface TemplateVariable {
@@ -342,6 +407,8 @@ export namespace TemplateVariable {
342
407
 
343
408
  mediaType?: string | null;
344
409
 
410
+ regex?: string | null;
411
+
345
412
  sample?: string | null;
346
413
 
347
414
  shortUrl?: string | null;
@@ -352,79 +419,234 @@ export namespace TemplateVariable {
352
419
  }
353
420
  }
354
421
 
422
+ /**
423
+ * Standard API response envelope for all v3 endpoints
424
+ */
355
425
  export interface TemplateListResponse {
356
- items?: Array<TemplateResponseV2>;
426
+ /**
427
+ * Paginated list of templates
428
+ */
429
+ data?: TemplateListResponse.Data | null;
357
430
 
358
- page?: number;
431
+ /**
432
+ * Error information
433
+ */
434
+ error?: WebhooksAPI.ErrorDetail | null;
435
+
436
+ /**
437
+ * Request and response metadata
438
+ */
439
+ meta?: WebhooksAPI.APIMeta;
359
440
 
360
- pageSize?: number;
441
+ /**
442
+ * Indicates whether the request was successful
443
+ */
444
+ success?: boolean;
445
+ }
361
446
 
362
- totalCount?: number;
447
+ export namespace TemplateListResponse {
448
+ /**
449
+ * Paginated list of templates
450
+ */
451
+ export interface Data {
452
+ /**
453
+ * Pagination metadata for list responses
454
+ */
455
+ pagination?: WebhooksAPI.PaginationMeta;
363
456
 
364
- totalPages?: number;
457
+ /**
458
+ * List of templates
459
+ */
460
+ templates?: Array<TemplatesAPI.Template>;
461
+ }
365
462
  }
366
463
 
367
464
  export interface TemplateCreateParams {
368
465
  /**
369
- * Template definition containing header, body, footer, and buttons
466
+ * Body param: Template category: MARKETING, UTILITY, AUTHENTICATION (optional,
467
+ * auto-detected if not provided)
468
+ */
469
+ category?: string | null;
470
+
471
+ /**
472
+ * Body param: Source of template creation (default: from-api)
370
473
  */
371
- definition: TemplateDefinition;
474
+ creation_source?: string | null;
372
475
 
373
476
  /**
374
- * The template category (e.g., MARKETING, UTILITY, AUTHENTICATION). Can only be
375
- * set when creating a new template. If not provided, will be auto-generated using
376
- * AI.
477
+ * Body param: Complete definition of a message template including header, body,
478
+ * footer, and buttons
479
+ */
480
+ definition?: TemplateDefinition;
481
+
482
+ /**
483
+ * Body param: Template language code (e.g., en_US) (optional, auto-detected if not
484
+ * provided)
485
+ */
486
+ language?: string | null;
487
+
488
+ /**
489
+ * Body param: Sandbox flag - when true, the operation is simulated without side
490
+ * effects Useful for testing integrations without actual execution
491
+ */
492
+ sandbox?: boolean;
493
+
494
+ /**
495
+ * Body param: Whether to submit the template for review after creation (default:
496
+ * false)
497
+ */
498
+ submit_for_review?: boolean;
499
+
500
+ /**
501
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
502
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
503
+ * hours per key per customer.
504
+ */
505
+ 'Idempotency-Key'?: string;
506
+
507
+ /**
508
+ * Header param: Profile UUID to scope the request to a child profile. Only
509
+ * organization API keys can use this header. The profile must belong to the
510
+ * calling organization.
511
+ */
512
+ 'x-profile-id'?: string;
513
+ }
514
+
515
+ export interface TemplateRetrieveParams {
516
+ /**
517
+ * Profile UUID to scope the request to a child profile. Only organization API keys
518
+ * can use this header. The profile must belong to the calling organization.
519
+ */
520
+ 'x-profile-id'?: string;
521
+ }
522
+
523
+ export interface TemplateUpdateParams {
524
+ /**
525
+ * Body param: Template category: MARKETING, UTILITY, AUTHENTICATION
377
526
  */
378
527
  category?: string | null;
379
528
 
380
529
  /**
381
- * The template language code (e.g., en_US, es_ES). Can only be set when creating a
382
- * new template. If not provided, will be auto-detected using AI.
530
+ * Body param: Complete definition of a message template including header, body,
531
+ * footer, and buttons
532
+ */
533
+ definition?: TemplateDefinition | null;
534
+
535
+ /**
536
+ * Body param: Template language code (e.g., en_US)
383
537
  */
384
538
  language?: string | null;
385
539
 
386
540
  /**
387
- * When false, the template will be saved as draft. When true, the template will be
388
- * submitted for review.
541
+ * Body param: Template display name
389
542
  */
390
- submitForReview?: boolean;
543
+ name?: string | null;
544
+
545
+ /**
546
+ * Body param: Sandbox flag - when true, the operation is simulated without side
547
+ * effects Useful for testing integrations without actual execution
548
+ */
549
+ sandbox?: boolean;
550
+
551
+ /**
552
+ * Body param: Whether to submit the template for review after updating (default:
553
+ * false)
554
+ */
555
+ submit_for_review?: boolean;
556
+
557
+ /**
558
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
559
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
560
+ * hours per key per customer.
561
+ */
562
+ 'Idempotency-Key'?: string;
563
+
564
+ /**
565
+ * Header param: Profile UUID to scope the request to a child profile. Only
566
+ * organization API keys can use this header. The profile must belong to the
567
+ * calling organization.
568
+ */
569
+ 'x-profile-id'?: string;
391
570
  }
392
571
 
393
572
  export interface TemplateListParams {
394
573
  /**
395
- * The page number (zero-indexed). Default is 0.
574
+ * Query param: Page number (1-indexed)
396
575
  */
397
576
  page: number;
398
577
 
399
578
  /**
400
- * The number of items per page (1-1000). Default is 100.
579
+ * Query param: Number of items per page
401
580
  */
402
- pageSize: number;
581
+ page_size: number;
403
582
 
404
583
  /**
405
- * Optional filter by template category (e.g., MARKETING, UTILITY, AUTHENTICATION)
584
+ * Query param: Optional category filter: MARKETING, UTILITY, AUTHENTICATION
406
585
  */
407
586
  category?: string | null;
408
587
 
409
588
  /**
410
- * Optional search term to filter templates by name or content
589
+ * Query param: Optional filter by welcome playground flag
590
+ */
591
+ is_welcome_playground?: boolean | null;
592
+
593
+ /**
594
+ * Query param: Optional search term for filtering templates
411
595
  */
412
596
  search?: string | null;
413
597
 
414
598
  /**
415
- * Optional filter by template status (e.g., APPROVED, PENDING, REJECTED, DRAFT)
599
+ * Query param: Optional status filter: APPROVED, PENDING, REJECTED
416
600
  */
417
601
  status?: string | null;
602
+
603
+ /**
604
+ * Header param: Profile UUID to scope the request to a child profile. Only
605
+ * organization API keys can use this header. The profile must belong to the
606
+ * calling organization.
607
+ */
608
+ 'x-profile-id'?: string;
609
+ }
610
+
611
+ export interface TemplateDeleteParams {
612
+ /**
613
+ * Body param: Whether to also delete the template from WhatsApp/Meta (optional,
614
+ * defaults to false)
615
+ */
616
+ delete_from_meta?: boolean | null;
617
+
618
+ /**
619
+ * Body param: Sandbox flag - when true, the operation is simulated without side
620
+ * effects Useful for testing integrations without actual execution
621
+ */
622
+ sandbox?: boolean;
623
+
624
+ /**
625
+ * Header param: Profile UUID to scope the request to a child profile. Only
626
+ * organization API keys can use this header. The profile must belong to the
627
+ * calling organization.
628
+ */
629
+ 'x-profile-id'?: string;
418
630
  }
419
631
 
420
632
  export declare namespace Templates {
421
633
  export {
634
+ type APIResponseTemplate as APIResponseTemplate,
635
+ type SentDmServicesCommonContractsPocOsAuthenticationConfig as SentDmServicesCommonContractsPocOsAuthenticationConfig,
636
+ type SentDmServicesCommonContractsPocOsTemplateBody as SentDmServicesCommonContractsPocOsTemplateBody,
637
+ type SentDmServicesCommonContractsPocOsTemplateButton as SentDmServicesCommonContractsPocOsTemplateButton,
638
+ type SentDmServicesCommonContractsPocOsTemplateButtonProps as SentDmServicesCommonContractsPocOsTemplateButtonProps,
639
+ type SentDmServicesCommonContractsPocOsTemplateFooter as SentDmServicesCommonContractsPocOsTemplateFooter,
640
+ type SentDmServicesCommonContractsPocOsTemplateHeader as SentDmServicesCommonContractsPocOsTemplateHeader,
641
+ type Template as Template,
422
642
  type TemplateBodyContent as TemplateBodyContent,
423
643
  type TemplateDefinition as TemplateDefinition,
424
- type TemplateResponseV2 as TemplateResponseV2,
425
644
  type TemplateVariable as TemplateVariable,
426
645
  type TemplateListResponse as TemplateListResponse,
427
646
  type TemplateCreateParams as TemplateCreateParams,
647
+ type TemplateRetrieveParams as TemplateRetrieveParams,
648
+ type TemplateUpdateParams as TemplateUpdateParams,
428
649
  type TemplateListParams as TemplateListParams,
650
+ type TemplateDeleteParams as TemplateDeleteParams,
429
651
  };
430
652
  }