@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.
Files changed (379) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/LICENSE +201 -0
  3. package/README.md +393 -0
  4. package/api-promise.d.mts +2 -0
  5. package/api-promise.d.mts.map +1 -0
  6. package/api-promise.d.ts +2 -0
  7. package/api-promise.d.ts.map +1 -0
  8. package/api-promise.js +6 -0
  9. package/api-promise.js.map +1 -0
  10. package/api-promise.mjs +2 -0
  11. package/api-promise.mjs.map +1 -0
  12. package/client.d.mts +200 -0
  13. package/client.d.mts.map +1 -0
  14. package/client.d.ts +200 -0
  15. package/client.d.ts.map +1 -0
  16. package/client.js +486 -0
  17. package/client.js.map +1 -0
  18. package/client.mjs +482 -0
  19. package/client.mjs.map +1 -0
  20. package/core/api-promise.d.mts +46 -0
  21. package/core/api-promise.d.mts.map +1 -0
  22. package/core/api-promise.d.ts +46 -0
  23. package/core/api-promise.d.ts.map +1 -0
  24. package/core/api-promise.js +74 -0
  25. package/core/api-promise.js.map +1 -0
  26. package/core/api-promise.mjs +70 -0
  27. package/core/api-promise.mjs.map +1 -0
  28. package/core/error.d.mts +46 -0
  29. package/core/error.d.mts.map +1 -0
  30. package/core/error.d.ts +46 -0
  31. package/core/error.d.ts.map +1 -0
  32. package/core/error.js +113 -0
  33. package/core/error.js.map +1 -0
  34. package/core/error.mjs +97 -0
  35. package/core/error.mjs.map +1 -0
  36. package/core/resource.d.mts +6 -0
  37. package/core/resource.d.mts.map +1 -0
  38. package/core/resource.d.ts +6 -0
  39. package/core/resource.d.ts.map +1 -0
  40. package/core/resource.js +11 -0
  41. package/core/resource.js.map +1 -0
  42. package/core/resource.mjs +7 -0
  43. package/core/resource.mjs.map +1 -0
  44. package/core/uploads.d.mts +3 -0
  45. package/core/uploads.d.mts.map +1 -0
  46. package/core/uploads.d.ts +3 -0
  47. package/core/uploads.d.ts.map +1 -0
  48. package/core/uploads.js +6 -0
  49. package/core/uploads.js.map +1 -0
  50. package/core/uploads.mjs +2 -0
  51. package/core/uploads.mjs.map +1 -0
  52. package/error.d.mts +2 -0
  53. package/error.d.mts.map +1 -0
  54. package/error.d.ts +2 -0
  55. package/error.d.ts.map +1 -0
  56. package/error.js +6 -0
  57. package/error.js.map +1 -0
  58. package/error.mjs +2 -0
  59. package/error.mjs.map +1 -0
  60. package/index.d.mts +6 -0
  61. package/index.d.mts.map +1 -0
  62. package/index.d.ts +6 -0
  63. package/index.d.ts.map +1 -0
  64. package/index.js +30 -0
  65. package/index.js.map +1 -0
  66. package/index.mjs +7 -0
  67. package/index.mjs.map +1 -0
  68. package/internal/builtin-types.d.mts +73 -0
  69. package/internal/builtin-types.d.mts.map +1 -0
  70. package/internal/builtin-types.d.ts +73 -0
  71. package/internal/builtin-types.d.ts.map +1 -0
  72. package/internal/builtin-types.js +4 -0
  73. package/internal/builtin-types.js.map +1 -0
  74. package/internal/builtin-types.mjs +3 -0
  75. package/internal/builtin-types.mjs.map +1 -0
  76. package/internal/detect-platform.d.mts +15 -0
  77. package/internal/detect-platform.d.mts.map +1 -0
  78. package/internal/detect-platform.d.ts +15 -0
  79. package/internal/detect-platform.d.ts.map +1 -0
  80. package/internal/detect-platform.js +162 -0
  81. package/internal/detect-platform.js.map +1 -0
  82. package/internal/detect-platform.mjs +157 -0
  83. package/internal/detect-platform.mjs.map +1 -0
  84. package/internal/errors.d.mts +3 -0
  85. package/internal/errors.d.mts.map +1 -0
  86. package/internal/errors.d.ts +3 -0
  87. package/internal/errors.d.ts.map +1 -0
  88. package/internal/errors.js +41 -0
  89. package/internal/errors.js.map +1 -0
  90. package/internal/errors.mjs +36 -0
  91. package/internal/errors.mjs.map +1 -0
  92. package/internal/headers.d.mts +20 -0
  93. package/internal/headers.d.mts.map +1 -0
  94. package/internal/headers.d.ts +20 -0
  95. package/internal/headers.d.ts.map +1 -0
  96. package/internal/headers.js +79 -0
  97. package/internal/headers.js.map +1 -0
  98. package/internal/headers.mjs +74 -0
  99. package/internal/headers.mjs.map +1 -0
  100. package/internal/parse.d.mts +12 -0
  101. package/internal/parse.d.mts.map +1 -0
  102. package/internal/parse.d.ts +12 -0
  103. package/internal/parse.d.ts.map +1 -0
  104. package/internal/parse.js +35 -0
  105. package/internal/parse.js.map +1 -0
  106. package/internal/parse.mjs +32 -0
  107. package/internal/parse.mjs.map +1 -0
  108. package/internal/request-options.d.mts +75 -0
  109. package/internal/request-options.d.mts.map +1 -0
  110. package/internal/request-options.d.ts +75 -0
  111. package/internal/request-options.d.ts.map +1 -0
  112. package/internal/request-options.js +14 -0
  113. package/internal/request-options.js.map +1 -0
  114. package/internal/request-options.mjs +10 -0
  115. package/internal/request-options.mjs.map +1 -0
  116. package/internal/shim-types.d.mts +17 -0
  117. package/internal/shim-types.d.mts.map +1 -0
  118. package/internal/shim-types.d.ts +17 -0
  119. package/internal/shim-types.d.ts.map +1 -0
  120. package/internal/shim-types.js +4 -0
  121. package/internal/shim-types.js.map +1 -0
  122. package/internal/shim-types.mjs +3 -0
  123. package/internal/shim-types.mjs.map +1 -0
  124. package/internal/shims.d.mts +20 -0
  125. package/internal/shims.d.mts.map +1 -0
  126. package/internal/shims.d.ts +20 -0
  127. package/internal/shims.d.ts.map +1 -0
  128. package/internal/shims.js +92 -0
  129. package/internal/shims.js.map +1 -0
  130. package/internal/shims.mjs +85 -0
  131. package/internal/shims.mjs.map +1 -0
  132. package/internal/to-file.d.mts +45 -0
  133. package/internal/to-file.d.mts.map +1 -0
  134. package/internal/to-file.d.ts +45 -0
  135. package/internal/to-file.d.ts.map +1 -0
  136. package/internal/to-file.js +91 -0
  137. package/internal/to-file.js.map +1 -0
  138. package/internal/to-file.mjs +88 -0
  139. package/internal/to-file.mjs.map +1 -0
  140. package/internal/tslib.js +81 -0
  141. package/internal/tslib.mjs +17 -0
  142. package/internal/types.d.mts +69 -0
  143. package/internal/types.d.mts.map +1 -0
  144. package/internal/types.d.ts +69 -0
  145. package/internal/types.d.ts.map +1 -0
  146. package/internal/types.js +4 -0
  147. package/internal/types.js.map +1 -0
  148. package/internal/types.mjs +3 -0
  149. package/internal/types.mjs.map +1 -0
  150. package/internal/uploads.d.mts +42 -0
  151. package/internal/uploads.d.mts.map +1 -0
  152. package/internal/uploads.d.ts +42 -0
  153. package/internal/uploads.d.ts.map +1 -0
  154. package/internal/uploads.js +141 -0
  155. package/internal/uploads.js.map +1 -0
  156. package/internal/uploads.mjs +131 -0
  157. package/internal/uploads.mjs.map +1 -0
  158. package/internal/utils/base64.d.mts +3 -0
  159. package/internal/utils/base64.d.mts.map +1 -0
  160. package/internal/utils/base64.d.ts +3 -0
  161. package/internal/utils/base64.d.ts.map +1 -0
  162. package/internal/utils/base64.js +38 -0
  163. package/internal/utils/base64.js.map +1 -0
  164. package/internal/utils/base64.mjs +33 -0
  165. package/internal/utils/base64.mjs.map +1 -0
  166. package/internal/utils/bytes.d.mts +4 -0
  167. package/internal/utils/bytes.d.mts.map +1 -0
  168. package/internal/utils/bytes.d.ts +4 -0
  169. package/internal/utils/bytes.d.ts.map +1 -0
  170. package/internal/utils/bytes.js +31 -0
  171. package/internal/utils/bytes.js.map +1 -0
  172. package/internal/utils/bytes.mjs +26 -0
  173. package/internal/utils/bytes.mjs.map +1 -0
  174. package/internal/utils/env.d.mts +9 -0
  175. package/internal/utils/env.d.mts.map +1 -0
  176. package/internal/utils/env.d.ts +9 -0
  177. package/internal/utils/env.d.ts.map +1 -0
  178. package/internal/utils/env.js +22 -0
  179. package/internal/utils/env.js.map +1 -0
  180. package/internal/utils/env.mjs +18 -0
  181. package/internal/utils/env.mjs.map +1 -0
  182. package/internal/utils/log.d.mts +37 -0
  183. package/internal/utils/log.d.mts.map +1 -0
  184. package/internal/utils/log.d.ts +37 -0
  185. package/internal/utils/log.d.ts.map +1 -0
  186. package/internal/utils/log.js +87 -0
  187. package/internal/utils/log.js.map +1 -0
  188. package/internal/utils/log.mjs +81 -0
  189. package/internal/utils/log.mjs.map +1 -0
  190. package/internal/utils/path.d.mts +15 -0
  191. package/internal/utils/path.d.mts.map +1 -0
  192. package/internal/utils/path.d.ts +15 -0
  193. package/internal/utils/path.d.ts.map +1 -0
  194. package/internal/utils/path.js +79 -0
  195. package/internal/utils/path.js.map +1 -0
  196. package/internal/utils/path.mjs +74 -0
  197. package/internal/utils/path.mjs.map +1 -0
  198. package/internal/utils/sleep.d.mts +2 -0
  199. package/internal/utils/sleep.d.mts.map +1 -0
  200. package/internal/utils/sleep.d.ts +2 -0
  201. package/internal/utils/sleep.d.ts.map +1 -0
  202. package/internal/utils/sleep.js +7 -0
  203. package/internal/utils/sleep.js.map +1 -0
  204. package/internal/utils/sleep.mjs +3 -0
  205. package/internal/utils/sleep.mjs.map +1 -0
  206. package/internal/utils/uuid.d.mts +5 -0
  207. package/internal/utils/uuid.d.mts.map +1 -0
  208. package/internal/utils/uuid.d.ts +5 -0
  209. package/internal/utils/uuid.d.ts.map +1 -0
  210. package/internal/utils/uuid.js +19 -0
  211. package/internal/utils/uuid.js.map +1 -0
  212. package/internal/utils/uuid.mjs +15 -0
  213. package/internal/utils/uuid.mjs.map +1 -0
  214. package/internal/utils/values.d.mts +18 -0
  215. package/internal/utils/values.d.mts.map +1 -0
  216. package/internal/utils/values.d.ts +18 -0
  217. package/internal/utils/values.d.ts.map +1 -0
  218. package/internal/utils/values.js +112 -0
  219. package/internal/utils/values.js.map +1 -0
  220. package/internal/utils/values.mjs +94 -0
  221. package/internal/utils/values.mjs.map +1 -0
  222. package/internal/utils.d.mts +7 -0
  223. package/internal/utils.d.mts.map +1 -0
  224. package/internal/utils.d.ts +7 -0
  225. package/internal/utils.d.ts.map +1 -0
  226. package/internal/utils.js +11 -0
  227. package/internal/utils.js.map +1 -0
  228. package/internal/utils.mjs +8 -0
  229. package/internal/utils.mjs.map +1 -0
  230. package/package.json +137 -0
  231. package/resource.d.mts +2 -0
  232. package/resource.d.mts.map +1 -0
  233. package/resource.d.ts +2 -0
  234. package/resource.d.ts.map +1 -0
  235. package/resource.js +6 -0
  236. package/resource.js.map +1 -0
  237. package/resource.mjs +2 -0
  238. package/resource.mjs.map +1 -0
  239. package/resources/contacts.d.mts +103 -0
  240. package/resources/contacts.d.mts.map +1 -0
  241. package/resources/contacts.d.ts +103 -0
  242. package/resources/contacts.d.ts.map +1 -0
  243. package/resources/contacts.js +33 -0
  244. package/resources/contacts.js.map +1 -0
  245. package/resources/contacts.mjs +29 -0
  246. package/resources/contacts.mjs.map +1 -0
  247. package/resources/index.d.mts +6 -0
  248. package/resources/index.d.mts.map +1 -0
  249. package/resources/index.d.ts +6 -0
  250. package/resources/index.d.ts.map +1 -0
  251. package/resources/index.js +15 -0
  252. package/resources/index.js.map +1 -0
  253. package/resources/index.mjs +7 -0
  254. package/resources/index.mjs.map +1 -0
  255. package/resources/messages.d.mts +222 -0
  256. package/resources/messages.d.mts.map +1 -0
  257. package/resources/messages.d.ts +222 -0
  258. package/resources/messages.d.ts.map +1 -0
  259. package/resources/messages.js +90 -0
  260. package/resources/messages.js.map +1 -0
  261. package/resources/messages.mjs +86 -0
  262. package/resources/messages.mjs.map +1 -0
  263. package/resources/number-lookup.d.mts +59 -0
  264. package/resources/number-lookup.d.mts.map +1 -0
  265. package/resources/number-lookup.d.ts +59 -0
  266. package/resources/number-lookup.d.ts.map +1 -0
  267. package/resources/number-lookup.js +17 -0
  268. package/resources/number-lookup.js.map +1 -0
  269. package/resources/number-lookup.mjs +13 -0
  270. package/resources/number-lookup.mjs.map +1 -0
  271. package/resources/organizations/index.d.mts +3 -0
  272. package/resources/organizations/index.d.mts.map +1 -0
  273. package/resources/organizations/index.d.ts +3 -0
  274. package/resources/organizations/index.d.ts.map +1 -0
  275. package/resources/organizations/index.js +9 -0
  276. package/resources/organizations/index.js.map +1 -0
  277. package/resources/organizations/index.mjs +4 -0
  278. package/resources/organizations/index.mjs.map +1 -0
  279. package/resources/organizations/organizations.d.mts +63 -0
  280. package/resources/organizations/organizations.d.mts.map +1 -0
  281. package/resources/organizations/organizations.d.ts +63 -0
  282. package/resources/organizations/organizations.d.ts.map +1 -0
  283. package/resources/organizations/organizations.js +46 -0
  284. package/resources/organizations/organizations.js.map +1 -0
  285. package/resources/organizations/organizations.mjs +41 -0
  286. package/resources/organizations/organizations.mjs.map +1 -0
  287. package/resources/organizations/users.d.mts +126 -0
  288. package/resources/organizations/users.d.mts.map +1 -0
  289. package/resources/organizations/users.d.ts +126 -0
  290. package/resources/organizations/users.d.ts.map +1 -0
  291. package/resources/organizations/users.js +95 -0
  292. package/resources/organizations/users.js.map +1 -0
  293. package/resources/organizations/users.mjs +91 -0
  294. package/resources/organizations/users.mjs.map +1 -0
  295. package/resources/organizations.d.mts +2 -0
  296. package/resources/organizations.d.mts.map +1 -0
  297. package/resources/organizations.d.ts +2 -0
  298. package/resources/organizations.d.ts.map +1 -0
  299. package/resources/organizations.js +6 -0
  300. package/resources/organizations.js.map +1 -0
  301. package/resources/organizations.mjs +3 -0
  302. package/resources/organizations.mjs.map +1 -0
  303. package/resources/templates.d.mts +333 -0
  304. package/resources/templates.d.mts.map +1 -0
  305. package/resources/templates.d.ts +333 -0
  306. package/resources/templates.d.ts.map +1 -0
  307. package/resources/templates.js +84 -0
  308. package/resources/templates.js.map +1 -0
  309. package/resources/templates.mjs +80 -0
  310. package/resources/templates.mjs.map +1 -0
  311. package/resources.d.mts +2 -0
  312. package/resources.d.mts.map +1 -0
  313. package/resources.d.ts +2 -0
  314. package/resources.d.ts.map +1 -0
  315. package/resources.js +5 -0
  316. package/resources.js.map +1 -0
  317. package/resources.mjs +2 -0
  318. package/resources.mjs.map +1 -0
  319. package/src/api-promise.ts +2 -0
  320. package/src/client.ts +832 -0
  321. package/src/core/README.md +3 -0
  322. package/src/core/api-promise.ts +92 -0
  323. package/src/core/error.ts +130 -0
  324. package/src/core/resource.ts +11 -0
  325. package/src/core/uploads.ts +2 -0
  326. package/src/error.ts +2 -0
  327. package/src/index.ts +22 -0
  328. package/src/internal/README.md +3 -0
  329. package/src/internal/builtin-types.ts +93 -0
  330. package/src/internal/detect-platform.ts +196 -0
  331. package/src/internal/errors.ts +33 -0
  332. package/src/internal/headers.ts +97 -0
  333. package/src/internal/parse.ts +50 -0
  334. package/src/internal/request-options.ts +91 -0
  335. package/src/internal/shim-types.ts +26 -0
  336. package/src/internal/shims.ts +107 -0
  337. package/src/internal/to-file.ts +154 -0
  338. package/src/internal/types.ts +95 -0
  339. package/src/internal/uploads.ts +187 -0
  340. package/src/internal/utils/base64.ts +40 -0
  341. package/src/internal/utils/bytes.ts +32 -0
  342. package/src/internal/utils/env.ts +18 -0
  343. package/src/internal/utils/log.ts +128 -0
  344. package/src/internal/utils/path.ts +88 -0
  345. package/src/internal/utils/sleep.ts +3 -0
  346. package/src/internal/utils/uuid.ts +17 -0
  347. package/src/internal/utils/values.ts +105 -0
  348. package/src/internal/utils.ts +8 -0
  349. package/src/lib/.keep +4 -0
  350. package/src/resource.ts +2 -0
  351. package/src/resources/contacts.ts +142 -0
  352. package/src/resources/index.ts +38 -0
  353. package/src/resources/messages.ts +283 -0
  354. package/src/resources/number-lookup.ts +80 -0
  355. package/src/resources/organizations/index.ts +18 -0
  356. package/src/resources/organizations/organizations.ts +116 -0
  357. package/src/resources/organizations/users.ts +189 -0
  358. package/src/resources/organizations.ts +3 -0
  359. package/src/resources/templates.ts +430 -0
  360. package/src/resources.ts +1 -0
  361. package/src/tsconfig.json +11 -0
  362. package/src/uploads.ts +2 -0
  363. package/src/version.ts +1 -0
  364. package/uploads.d.mts +2 -0
  365. package/uploads.d.mts.map +1 -0
  366. package/uploads.d.ts +2 -0
  367. package/uploads.d.ts.map +1 -0
  368. package/uploads.js +6 -0
  369. package/uploads.js.map +1 -0
  370. package/uploads.mjs +2 -0
  371. package/uploads.mjs.map +1 -0
  372. package/version.d.mts +2 -0
  373. package/version.d.mts.map +1 -0
  374. package/version.d.ts +2 -0
  375. package/version.d.ts.map +1 -0
  376. package/version.js +5 -0
  377. package/version.js.map +1 -0
  378. package/version.mjs +2 -0
  379. 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,E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AK,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.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