tnzapi-ts 3.0.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 (363) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2203 -0
  3. package/dist/Api/Actions/AbortApi.d.ts +17 -0
  4. package/dist/Api/Actions/AbortApi.js +78 -0
  5. package/dist/Api/Actions/PacingApi.d.ts +17 -0
  6. package/dist/Api/Actions/PacingApi.js +84 -0
  7. package/dist/Api/Actions/RescheduleApi.d.ts +17 -0
  8. package/dist/Api/Actions/RescheduleApi.js +84 -0
  9. package/dist/Api/Actions/ResubmitApi.d.ts +17 -0
  10. package/dist/Api/Actions/ResubmitApi.js +86 -0
  11. package/dist/Api/Actions/dtos/AbortApiRequestDTO.d.ts +4 -0
  12. package/dist/Api/Actions/dtos/AbortApiRequestDTO.js +14 -0
  13. package/dist/Api/Actions/dtos/ActionApiResponseDTO.d.ts +8 -0
  14. package/dist/Api/Actions/dtos/ActionApiResponseDTO.js +14 -0
  15. package/dist/Api/Actions/dtos/ActionBaseRequestDTO.d.ts +5 -0
  16. package/dist/Api/Actions/dtos/ActionBaseRequestDTO.js +7 -0
  17. package/dist/Api/Actions/dtos/PacingApiRequestDTO.d.ts +5 -0
  18. package/dist/Api/Actions/dtos/PacingApiRequestDTO.js +15 -0
  19. package/dist/Api/Actions/dtos/RescheduleApiRequestDTO.d.ts +5 -0
  20. package/dist/Api/Actions/dtos/RescheduleApiRequestDTO.js +14 -0
  21. package/dist/Api/Actions/dtos/ResubmitApiRequestDTO.d.ts +5 -0
  22. package/dist/Api/Actions/dtos/ResubmitApiRequestDTO.js +14 -0
  23. package/dist/Api/Actions/dtos/index.d.ts +6 -0
  24. package/dist/Api/Actions/dtos/index.js +22 -0
  25. package/dist/Api/Actions/helpers/MapApiResponse.d.ts +3 -0
  26. package/dist/Api/Actions/helpers/MapApiResponse.js +16 -0
  27. package/dist/Api/Actions/helpers/index.d.ts +1 -0
  28. package/dist/Api/Actions/helpers/index.js +17 -0
  29. package/dist/Api/Actions/index.d.ts +12 -0
  30. package/dist/Api/Actions/index.js +17 -0
  31. package/dist/Api/Actions/interfaces/IActionArgs.d.ts +19 -0
  32. package/dist/Api/Actions/interfaces/IActionArgs.js +2 -0
  33. package/dist/Api/Actions/interfaces/index.d.ts +1 -0
  34. package/dist/Api/Actions/interfaces/index.js +17 -0
  35. package/dist/Api/Addressbook/ContactGroups/ContactGroupCreateApi.d.ts +14 -0
  36. package/dist/Api/Addressbook/ContactGroups/ContactGroupCreateApi.js +84 -0
  37. package/dist/Api/Addressbook/ContactGroups/ContactGroupDeleteApi.d.ts +14 -0
  38. package/dist/Api/Addressbook/ContactGroups/ContactGroupDeleteApi.js +84 -0
  39. package/dist/Api/Addressbook/ContactGroups/ContactGroupDetailApi.d.ts +14 -0
  40. package/dist/Api/Addressbook/ContactGroups/ContactGroupDetailApi.js +84 -0
  41. package/dist/Api/Addressbook/ContactGroups/ContactGroupListApi.d.ts +14 -0
  42. package/dist/Api/Addressbook/ContactGroups/ContactGroupListApi.js +79 -0
  43. package/dist/Api/Addressbook/ContactGroups/dtos/BaseListApiRequestDTO.d.ts +4 -0
  44. package/dist/Api/Addressbook/ContactGroups/dtos/BaseListApiRequestDTO.js +7 -0
  45. package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupApiRequestDTO.d.ts +9 -0
  46. package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupApiRequestDTO.js +19 -0
  47. package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupApiResponseDTO.d.ts +8 -0
  48. package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupApiResponseDTO.js +14 -0
  49. package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupBaseRequestDTO.d.ts +6 -0
  50. package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupBaseRequestDTO.js +7 -0
  51. package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupListApiRequestDTO.d.ts +4 -0
  52. package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupListApiRequestDTO.js +14 -0
  53. package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupListApiResponseDTO.d.ts +12 -0
  54. package/dist/Api/Addressbook/ContactGroups/dtos/ContactGroupListApiResponseDTO.js +14 -0
  55. package/dist/Api/Addressbook/ContactGroups/dtos/index.d.ts +6 -0
  56. package/dist/Api/Addressbook/ContactGroups/dtos/index.js +22 -0
  57. package/dist/Api/Addressbook/ContactGroups/helpers/MapApiResponse.d.ts +3 -0
  58. package/dist/Api/Addressbook/ContactGroups/helpers/MapApiResponse.js +24 -0
  59. package/dist/Api/Addressbook/ContactGroups/helpers/MapListApiResponse.d.ts +3 -0
  60. package/dist/Api/Addressbook/ContactGroups/helpers/MapListApiResponse.js +28 -0
  61. package/dist/Api/Addressbook/ContactGroups/helpers/index.d.ts +2 -0
  62. package/dist/Api/Addressbook/ContactGroups/helpers/index.js +18 -0
  63. package/dist/Api/Addressbook/ContactGroups/index.d.ts +11 -0
  64. package/dist/Api/Addressbook/ContactGroups/index.js +21 -0
  65. package/dist/Api/Addressbook/Contacts/ContactCreateApi.d.ts +17 -0
  66. package/dist/Api/Addressbook/Contacts/ContactCreateApi.js +76 -0
  67. package/dist/Api/Addressbook/Contacts/ContactDeleteApi.d.ts +17 -0
  68. package/dist/Api/Addressbook/Contacts/ContactDeleteApi.js +82 -0
  69. package/dist/Api/Addressbook/Contacts/ContactDetailApi.d.ts +17 -0
  70. package/dist/Api/Addressbook/Contacts/ContactDetailApi.js +78 -0
  71. package/dist/Api/Addressbook/Contacts/ContactListApi.d.ts +17 -0
  72. package/dist/Api/Addressbook/Contacts/ContactListApi.js +78 -0
  73. package/dist/Api/Addressbook/Contacts/ContactUpdateApi.d.ts +17 -0
  74. package/dist/Api/Addressbook/Contacts/ContactUpdateApi.js +81 -0
  75. package/dist/Api/Addressbook/Contacts/dtos/ContactApiRequestDTO.d.ts +7 -0
  76. package/dist/Api/Addressbook/Contacts/dtos/ContactApiRequestDTO.js +22 -0
  77. package/dist/Api/Addressbook/Contacts/dtos/ContactApiResponseDTO.d.ts +6 -0
  78. package/dist/Api/Addressbook/Contacts/dtos/ContactApiResponseDTO.js +14 -0
  79. package/dist/Api/Addressbook/Contacts/dtos/ContactListApiRequestDTO.d.ts +4 -0
  80. package/dist/Api/Addressbook/Contacts/dtos/ContactListApiRequestDTO.js +17 -0
  81. package/dist/Api/Addressbook/Contacts/dtos/ContactListApiResponseDTO.d.ts +10 -0
  82. package/dist/Api/Addressbook/Contacts/dtos/ContactListApiResponseDTO.js +19 -0
  83. package/dist/Api/Addressbook/Contacts/dtos/index.d.ts +4 -0
  84. package/dist/Api/Addressbook/Contacts/dtos/index.js +20 -0
  85. package/dist/Api/Addressbook/Contacts/helpers/MapApiResponse.d.ts +3 -0
  86. package/dist/Api/Addressbook/Contacts/helpers/MapApiResponse.js +20 -0
  87. package/dist/Api/Addressbook/Contacts/helpers/MapListApiResponse.d.ts +3 -0
  88. package/dist/Api/Addressbook/Contacts/helpers/MapListApiResponse.js +16 -0
  89. package/dist/Api/Addressbook/Contacts/helpers/index.d.ts +2 -0
  90. package/dist/Api/Addressbook/Contacts/helpers/index.js +18 -0
  91. package/dist/Api/Addressbook/Contacts/index.d.ts +12 -0
  92. package/dist/Api/Addressbook/Contacts/index.js +24 -0
  93. package/dist/Api/Addressbook/Contacts/models/ContactModel.d.ts +37 -0
  94. package/dist/Api/Addressbook/Contacts/models/ContactModel.js +11 -0
  95. package/dist/Api/Addressbook/Contacts/models/index.d.ts +1 -0
  96. package/dist/Api/Addressbook/Contacts/models/index.js +17 -0
  97. package/dist/Api/Addressbook/GroupContacts/GroupContactCreateApi.d.ts +14 -0
  98. package/dist/Api/Addressbook/GroupContacts/GroupContactCreateApi.js +84 -0
  99. package/dist/Api/Addressbook/GroupContacts/GroupContactDeleteApi.d.ts +14 -0
  100. package/dist/Api/Addressbook/GroupContacts/GroupContactDeleteApi.js +84 -0
  101. package/dist/Api/Addressbook/GroupContacts/GroupContactDetailApi.d.ts +14 -0
  102. package/dist/Api/Addressbook/GroupContacts/GroupContactDetailApi.js +84 -0
  103. package/dist/Api/Addressbook/GroupContacts/GroupContactListApi.d.ts +14 -0
  104. package/dist/Api/Addressbook/GroupContacts/GroupContactListApi.js +83 -0
  105. package/dist/Api/Addressbook/GroupContacts/dtos/BaseListApiRequestDTO.d.ts +7 -0
  106. package/dist/Api/Addressbook/GroupContacts/dtos/BaseListApiRequestDTO.js +7 -0
  107. package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactApiRequestDTO.d.ts +7 -0
  108. package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactApiRequestDTO.js +14 -0
  109. package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactApiResponseDTO.d.ts +8 -0
  110. package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactApiResponseDTO.js +14 -0
  111. package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactBaseRequestDTO.d.ts +7 -0
  112. package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactBaseRequestDTO.js +7 -0
  113. package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactListApiRequestDTO.d.ts +4 -0
  114. package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactListApiRequestDTO.js +14 -0
  115. package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactListApiResponseDTO.d.ts +12 -0
  116. package/dist/Api/Addressbook/GroupContacts/dtos/GroupContactListApiResponseDTO.js +14 -0
  117. package/dist/Api/Addressbook/GroupContacts/dtos/index.d.ts +6 -0
  118. package/dist/Api/Addressbook/GroupContacts/dtos/index.js +22 -0
  119. package/dist/Api/Addressbook/GroupContacts/helpers/MapApiResponse.d.ts +3 -0
  120. package/dist/Api/Addressbook/GroupContacts/helpers/MapApiResponse.js +24 -0
  121. package/dist/Api/Addressbook/GroupContacts/helpers/MapListApiResponse.d.ts +3 -0
  122. package/dist/Api/Addressbook/GroupContacts/helpers/MapListApiResponse.js +28 -0
  123. package/dist/Api/Addressbook/GroupContacts/helpers/index.d.ts +2 -0
  124. package/dist/Api/Addressbook/GroupContacts/helpers/index.js +18 -0
  125. package/dist/Api/Addressbook/GroupContacts/index.d.ts +11 -0
  126. package/dist/Api/Addressbook/GroupContacts/index.js +21 -0
  127. package/dist/Api/Addressbook/Groups/GroupCreateApi.d.ts +17 -0
  128. package/dist/Api/Addressbook/Groups/GroupCreateApi.js +87 -0
  129. package/dist/Api/Addressbook/Groups/GroupDeleteApi.d.ts +17 -0
  130. package/dist/Api/Addressbook/Groups/GroupDeleteApi.js +78 -0
  131. package/dist/Api/Addressbook/Groups/GroupDetailApi.d.ts +17 -0
  132. package/dist/Api/Addressbook/Groups/GroupDetailApi.js +78 -0
  133. package/dist/Api/Addressbook/Groups/GroupListApi.d.ts +17 -0
  134. package/dist/Api/Addressbook/Groups/GroupListApi.js +78 -0
  135. package/dist/Api/Addressbook/Groups/GroupUpdateApi.d.ts +17 -0
  136. package/dist/Api/Addressbook/Groups/GroupUpdateApi.js +89 -0
  137. package/dist/Api/Addressbook/Groups/dtos/GroupApiRequestDTO.d.ts +5 -0
  138. package/dist/Api/Addressbook/Groups/dtos/GroupApiRequestDTO.js +22 -0
  139. package/dist/Api/Addressbook/Groups/dtos/GroupApiResponseDTO.d.ts +6 -0
  140. package/dist/Api/Addressbook/Groups/dtos/GroupApiResponseDTO.js +14 -0
  141. package/dist/Api/Addressbook/Groups/dtos/GroupListApiRequestDTO.d.ts +4 -0
  142. package/dist/Api/Addressbook/Groups/dtos/GroupListApiRequestDTO.js +14 -0
  143. package/dist/Api/Addressbook/Groups/dtos/GroupListApiResponseDTO.d.ts +10 -0
  144. package/dist/Api/Addressbook/Groups/dtos/GroupListApiResponseDTO.js +14 -0
  145. package/dist/Api/Addressbook/Groups/dtos/index.d.ts +4 -0
  146. package/dist/Api/Addressbook/Groups/dtos/index.js +20 -0
  147. package/dist/Api/Addressbook/Groups/helpers/MapApiResponse.d.ts +3 -0
  148. package/dist/Api/Addressbook/Groups/helpers/MapApiResponse.js +20 -0
  149. package/dist/Api/Addressbook/Groups/helpers/MapListApiResponse.d.ts +3 -0
  150. package/dist/Api/Addressbook/Groups/helpers/MapListApiResponse.js +24 -0
  151. package/dist/Api/Addressbook/Groups/helpers/index.d.ts +2 -0
  152. package/dist/Api/Addressbook/Groups/helpers/index.js +18 -0
  153. package/dist/Api/Addressbook/Groups/index.d.ts +12 -0
  154. package/dist/Api/Addressbook/Groups/index.js +24 -0
  155. package/dist/Api/Addressbook/Groups/models/GroupModel.d.ts +14 -0
  156. package/dist/Api/Addressbook/Groups/models/GroupModel.js +17 -0
  157. package/dist/Api/Addressbook/Groups/models/index.d.ts +1 -0
  158. package/dist/Api/Addressbook/Groups/models/index.js +17 -0
  159. package/dist/Api/Addressbook/index.d.ts +12 -0
  160. package/dist/Api/Addressbook/index.js +17 -0
  161. package/dist/Api/Addressbook/interfaces/IContactArgs.d.ts +45 -0
  162. package/dist/Api/Addressbook/interfaces/IContactArgs.js +2 -0
  163. package/dist/Api/Addressbook/interfaces/IContactGroupArgs.d.ts +15 -0
  164. package/dist/Api/Addressbook/interfaces/IContactGroupArgs.js +2 -0
  165. package/dist/Api/Addressbook/interfaces/IGroupArgs.d.ts +24 -0
  166. package/dist/Api/Addressbook/interfaces/IGroupArgs.js +2 -0
  167. package/dist/Api/Addressbook/interfaces/IGroupContactArgs.d.ts +16 -0
  168. package/dist/Api/Addressbook/interfaces/IGroupContactArgs.js +2 -0
  169. package/dist/Api/Addressbook/interfaces/index.d.ts +4 -0
  170. package/dist/Api/Addressbook/interfaces/index.js +20 -0
  171. package/dist/Api/Messaging/BaseMessagingApi.d.ts +28 -0
  172. package/dist/Api/Messaging/BaseMessagingApi.js +152 -0
  173. package/dist/Api/Messaging/EmailApi.d.ts +21 -0
  174. package/dist/Api/Messaging/EmailApi.js +47 -0
  175. package/dist/Api/Messaging/FaxApi.d.ts +18 -0
  176. package/dist/Api/Messaging/FaxApi.js +47 -0
  177. package/dist/Api/Messaging/RCSApi.d.ts +21 -0
  178. package/dist/Api/Messaging/RCSApi.js +44 -0
  179. package/dist/Api/Messaging/SMSApi.d.ts +21 -0
  180. package/dist/Api/Messaging/SMSApi.js +44 -0
  181. package/dist/Api/Messaging/TTSApi.d.ts +22 -0
  182. package/dist/Api/Messaging/TTSApi.js +67 -0
  183. package/dist/Api/Messaging/VoiceApi.d.ts +24 -0
  184. package/dist/Api/Messaging/VoiceApi.js +95 -0
  185. package/dist/Api/Messaging/WhatsAppApi.d.ts +21 -0
  186. package/dist/Api/Messaging/WhatsAppApi.js +44 -0
  187. package/dist/Api/Messaging/WorkflowApi.d.ts +21 -0
  188. package/dist/Api/Messaging/WorkflowApi.js +41 -0
  189. package/dist/Api/Messaging/dtos/EmailApiRequestDTO.d.ts +13 -0
  190. package/dist/Api/Messaging/dtos/EmailApiRequestDTO.js +15 -0
  191. package/dist/Api/Messaging/dtos/FaxApiRequestDTO.d.ts +13 -0
  192. package/dist/Api/Messaging/dtos/FaxApiRequestDTO.js +15 -0
  193. package/dist/Api/Messaging/dtos/MessagingApiSuccessResponseDTO.d.ts +7 -0
  194. package/dist/Api/Messaging/dtos/MessagingApiSuccessResponseDTO.js +14 -0
  195. package/dist/Api/Messaging/dtos/MessagingBaseRequestDTO.d.ts +33 -0
  196. package/dist/Api/Messaging/dtos/MessagingBaseRequestDTO.js +9 -0
  197. package/dist/Api/Messaging/dtos/RCSApiRequestDTO.d.ts +9 -0
  198. package/dist/Api/Messaging/dtos/RCSApiRequestDTO.js +15 -0
  199. package/dist/Api/Messaging/dtos/SMSApiRequestDTO.d.ts +11 -0
  200. package/dist/Api/Messaging/dtos/SMSApiRequestDTO.js +16 -0
  201. package/dist/Api/Messaging/dtos/TTSApiRequestDTO.d.ts +20 -0
  202. package/dist/Api/Messaging/dtos/TTSApiRequestDTO.js +18 -0
  203. package/dist/Api/Messaging/dtos/VoiceApiRequestDTO.d.ts +20 -0
  204. package/dist/Api/Messaging/dtos/VoiceApiRequestDTO.js +36 -0
  205. package/dist/Api/Messaging/dtos/WhatsAppApiRequestDTO.d.ts +8 -0
  206. package/dist/Api/Messaging/dtos/WhatsAppApiRequestDTO.js +15 -0
  207. package/dist/Api/Messaging/dtos/WorkflowApiRequestDTO.d.ts +5 -0
  208. package/dist/Api/Messaging/dtos/WorkflowApiRequestDTO.js +14 -0
  209. package/dist/Api/Messaging/dtos/index.d.ts +10 -0
  210. package/dist/Api/Messaging/dtos/index.js +26 -0
  211. package/dist/Api/Messaging/helpers/AddRecipient.d.ts +3 -0
  212. package/dist/Api/Messaging/helpers/AddRecipient.js +19 -0
  213. package/dist/Api/Messaging/helpers/MapApiResponse.d.ts +3 -0
  214. package/dist/Api/Messaging/helpers/MapApiResponse.js +17 -0
  215. package/dist/Api/Messaging/helpers/index.d.ts +2 -0
  216. package/dist/Api/Messaging/helpers/index.js +18 -0
  217. package/dist/Api/Messaging/index.d.ts +20 -0
  218. package/dist/Api/Messaging/index.js +25 -0
  219. package/dist/Api/Messaging/interfaces/IEmailArgs.d.ts +50 -0
  220. package/dist/Api/Messaging/interfaces/IEmailArgs.js +2 -0
  221. package/dist/Api/Messaging/interfaces/IFaxArgs.d.ts +49 -0
  222. package/dist/Api/Messaging/interfaces/IFaxArgs.js +2 -0
  223. package/dist/Api/Messaging/interfaces/IMessagingDestination.d.ts +9 -0
  224. package/dist/Api/Messaging/interfaces/IMessagingDestination.js +2 -0
  225. package/dist/Api/Messaging/interfaces/IRCSArgs.d.ts +43 -0
  226. package/dist/Api/Messaging/interfaces/IRCSArgs.js +2 -0
  227. package/dist/Api/Messaging/interfaces/ISMSArgs.d.ts +48 -0
  228. package/dist/Api/Messaging/interfaces/ISMSArgs.js +2 -0
  229. package/dist/Api/Messaging/interfaces/ITTSArgs.d.ts +61 -0
  230. package/dist/Api/Messaging/interfaces/ITTSArgs.js +2 -0
  231. package/dist/Api/Messaging/interfaces/IVoiceArgs.d.ts +67 -0
  232. package/dist/Api/Messaging/interfaces/IVoiceArgs.js +2 -0
  233. package/dist/Api/Messaging/interfaces/IWhatsAppArgs.d.ts +44 -0
  234. package/dist/Api/Messaging/interfaces/IWhatsAppArgs.js +2 -0
  235. package/dist/Api/Messaging/interfaces/IWorkflowArgs.d.ts +41 -0
  236. package/dist/Api/Messaging/interfaces/IWorkflowArgs.js +2 -0
  237. package/dist/Api/Messaging/interfaces/index.d.ts +9 -0
  238. package/dist/Api/Messaging/interfaces/index.js +25 -0
  239. package/dist/Api/Messaging/models/CommonModel.d.ts +17 -0
  240. package/dist/Api/Messaging/models/CommonModel.js +6 -0
  241. package/dist/Api/Messaging/models/EmailModel.d.ts +20 -0
  242. package/dist/Api/Messaging/models/EmailModel.js +17 -0
  243. package/dist/Api/Messaging/models/FaxModel.d.ts +20 -0
  244. package/dist/Api/Messaging/models/FaxModel.js +17 -0
  245. package/dist/Api/Messaging/models/IMessagingModel.d.ts +6 -0
  246. package/dist/Api/Messaging/models/IMessagingModel.js +2 -0
  247. package/dist/Api/Messaging/models/RCSModel.d.ts +16 -0
  248. package/dist/Api/Messaging/models/RCSModel.js +17 -0
  249. package/dist/Api/Messaging/models/SMSModel.d.ts +18 -0
  250. package/dist/Api/Messaging/models/SMSModel.js +17 -0
  251. package/dist/Api/Messaging/models/TTSModel.d.ts +28 -0
  252. package/dist/Api/Messaging/models/TTSModel.js +22 -0
  253. package/dist/Api/Messaging/models/VoiceModel.d.ts +31 -0
  254. package/dist/Api/Messaging/models/VoiceModel.js +23 -0
  255. package/dist/Api/Messaging/models/WhatsAppModel.d.ts +15 -0
  256. package/dist/Api/Messaging/models/WhatsAppModel.js +17 -0
  257. package/dist/Api/Messaging/models/WorkflowModel.d.ts +14 -0
  258. package/dist/Api/Messaging/models/WorkflowModel.js +17 -0
  259. package/dist/Api/Messaging/models/index.d.ts +10 -0
  260. package/dist/Api/Messaging/models/index.js +26 -0
  261. package/dist/Api/OptOut/OptOutCreateApi.d.ts +17 -0
  262. package/dist/Api/OptOut/OptOutCreateApi.js +49 -0
  263. package/dist/Api/OptOut/OptOutDeleteApi.d.ts +17 -0
  264. package/dist/Api/OptOut/OptOutDeleteApi.js +47 -0
  265. package/dist/Api/OptOut/OptOutDetailApi.d.ts +17 -0
  266. package/dist/Api/OptOut/OptOutDetailApi.js +47 -0
  267. package/dist/Api/OptOut/OptOutListApi.d.ts +17 -0
  268. package/dist/Api/OptOut/OptOutListApi.js +62 -0
  269. package/dist/Api/OptOut/dtos/OptOutApiRequestDTO.d.ts +4 -0
  270. package/dist/Api/OptOut/dtos/OptOutApiRequestDTO.js +14 -0
  271. package/dist/Api/OptOut/dtos/OptOutApiResponseDTO.d.ts +20 -0
  272. package/dist/Api/OptOut/dtos/OptOutApiResponseDTO.js +14 -0
  273. package/dist/Api/OptOut/dtos/OptOutListApiRequestDTO.d.ts +8 -0
  274. package/dist/Api/OptOut/dtos/OptOutListApiRequestDTO.js +14 -0
  275. package/dist/Api/OptOut/dtos/OptOutListApiResponseDTO.d.ts +10 -0
  276. package/dist/Api/OptOut/dtos/OptOutListApiResponseDTO.js +17 -0
  277. package/dist/Api/OptOut/dtos/index.d.ts +4 -0
  278. package/dist/Api/OptOut/dtos/index.js +20 -0
  279. package/dist/Api/OptOut/index.d.ts +11 -0
  280. package/dist/Api/OptOut/index.js +21 -0
  281. package/dist/Api/OptOut/interfaces/IOptOutArgs.d.ts +22 -0
  282. package/dist/Api/OptOut/interfaces/IOptOutArgs.js +2 -0
  283. package/dist/Api/OptOut/interfaces/index.d.ts +1 -0
  284. package/dist/Api/OptOut/interfaces/index.js +17 -0
  285. package/dist/Api/OptOut/models/OptOutModel.d.ts +11 -0
  286. package/dist/Api/OptOut/models/OptOutModel.js +12 -0
  287. package/dist/Api/OptOut/models/index.d.ts +1 -0
  288. package/dist/Api/OptOut/models/index.js +17 -0
  289. package/dist/Api/Reports/SMSReceivedApi.d.ts +18 -0
  290. package/dist/Api/Reports/SMSReceivedApi.js +92 -0
  291. package/dist/Api/Reports/SMSReplyApi.d.ts +18 -0
  292. package/dist/Api/Reports/SMSReplyApi.js +62 -0
  293. package/dist/Api/Reports/StatusApi.d.ts +18 -0
  294. package/dist/Api/Reports/StatusApi.js +76 -0
  295. package/dist/Api/Reports/dtos/RecipientDTO.d.ts +24 -0
  296. package/dist/Api/Reports/dtos/RecipientDTO.js +12 -0
  297. package/dist/Api/Reports/dtos/SMSReceivedApiRequestDTO.d.ts +7 -0
  298. package/dist/Api/Reports/dtos/SMSReceivedApiRequestDTO.js +17 -0
  299. package/dist/Api/Reports/dtos/SMSReceivedApiResponseDTO.d.ts +6 -0
  300. package/dist/Api/Reports/dtos/SMSReceivedApiResponseDTO.js +15 -0
  301. package/dist/Api/Reports/dtos/SMSReceivedDTO.d.ts +14 -0
  302. package/dist/Api/Reports/dtos/SMSReceivedDTO.js +12 -0
  303. package/dist/Api/Reports/dtos/SMSReplyApiRequestDTO.d.ts +5 -0
  304. package/dist/Api/Reports/dtos/SMSReplyApiRequestDTO.js +14 -0
  305. package/dist/Api/Reports/dtos/SMSReplyApiResponseDTO.d.ts +23 -0
  306. package/dist/Api/Reports/dtos/SMSReplyApiResponseDTO.js +24 -0
  307. package/dist/Api/Reports/dtos/SMSReplyRecipientDTO.d.ts +6 -0
  308. package/dist/Api/Reports/dtos/SMSReplyRecipientDTO.js +19 -0
  309. package/dist/Api/Reports/dtos/SMSReplyRecipientSMSReplyDTO.d.ts +9 -0
  310. package/dist/Api/Reports/dtos/SMSReplyRecipientSMSReplyDTO.js +12 -0
  311. package/dist/Api/Reports/dtos/StatusApiRequestDTO.d.ts +6 -0
  312. package/dist/Api/Reports/dtos/StatusApiRequestDTO.js +14 -0
  313. package/dist/Api/Reports/dtos/StatusApiResponseDTO.d.ts +27 -0
  314. package/dist/Api/Reports/dtos/StatusApiResponseDTO.js +15 -0
  315. package/dist/Api/Reports/dtos/index.d.ts +10 -0
  316. package/dist/Api/Reports/dtos/index.js +26 -0
  317. package/dist/Api/Reports/index.d.ts +10 -0
  318. package/dist/Api/Reports/index.js +15 -0
  319. package/dist/Api/Reports/interfaces/IReportsArgs.d.ts +18 -0
  320. package/dist/Api/Reports/interfaces/IReportsArgs.js +2 -0
  321. package/dist/Api/Reports/interfaces/index.d.ts +1 -0
  322. package/dist/Api/Reports/interfaces/index.js +17 -0
  323. package/dist/Common/IHttpClient.d.ts +6 -0
  324. package/dist/Common/IHttpClient.js +2 -0
  325. package/dist/Common/NodeHttpClient.d.ts +10 -0
  326. package/dist/Common/NodeHttpClient.js +24 -0
  327. package/dist/Common/Result.d.ts +6 -0
  328. package/dist/Common/Result.js +13 -0
  329. package/dist/Common/ValidationResult.d.ts +4 -0
  330. package/dist/Common/ValidationResult.js +2 -0
  331. package/dist/Common/dtos/CommonApiRequestDTO.d.ts +3 -0
  332. package/dist/Common/dtos/CommonApiRequestDTO.js +7 -0
  333. package/dist/Common/dtos/CommonApiResponseDTO.d.ts +4 -0
  334. package/dist/Common/dtos/CommonApiResponseDTO.js +10 -0
  335. package/dist/Common/dtos/CommonListApiRequestDTO.d.ts +6 -0
  336. package/dist/Common/dtos/CommonListApiRequestDTO.js +12 -0
  337. package/dist/Common/dtos/CommonListApiResponseDTO.d.ts +8 -0
  338. package/dist/Common/dtos/CommonListApiResponseDTO.js +14 -0
  339. package/dist/Common/dtos/ErrorResponseDTO.d.ts +6 -0
  340. package/dist/Common/dtos/ErrorResponseDTO.js +15 -0
  341. package/dist/Common/dtos/index.d.ts +5 -0
  342. package/dist/Common/dtos/index.js +21 -0
  343. package/dist/Common/enums/MessagingEnums.d.ts +45 -0
  344. package/dist/Common/enums/MessagingEnums.js +56 -0
  345. package/dist/Common/index.d.ts +7 -0
  346. package/dist/Common/index.js +23 -0
  347. package/dist/Common/isSuccessResult.d.ts +1 -0
  348. package/dist/Common/isSuccessResult.js +9 -0
  349. package/dist/Functions/FileHandler.d.ts +6 -0
  350. package/dist/Functions/FileHandler.js +57 -0
  351. package/dist/Functions/HttpRequest.d.ts +10 -0
  352. package/dist/Functions/HttpRequest.js +156 -0
  353. package/dist/Functions/Mapper.d.ts +1 -0
  354. package/dist/Functions/Mapper.js +23 -0
  355. package/dist/Functions/UsefulStuff.d.ts +20 -0
  356. package/dist/Functions/UsefulStuff.js +136 -0
  357. package/dist/Functions/index.d.ts +5 -0
  358. package/dist/Functions/index.js +48 -0
  359. package/dist/index.d.ts +17 -0
  360. package/dist/index.js +43 -0
  361. package/dist/interfaces.d.ts +4 -0
  362. package/dist/interfaces.js +2 -0
  363. package/package.json +47 -0
package/README.md ADDED
@@ -0,0 +1,2203 @@
1
+ # tnzapi-ts
2
+
3
+ ## TypeScript Client Library for TNZ REST API v3.00
4
+
5
+ A TypeScript client library for the [TNZ REST API](https://www.tnz.co.nz/docs/restapi), covering messaging (SMS, Email, Fax, TTS, Voice, WhatsApp, RCS, Workflow), reports, actions, addressbook, and opt-out management.
6
+
7
+ All HTTP communication uses Node.js built-in `http`/`https` modules.
8
+
9
+ ---
10
+
11
+ ## Table of Contents
12
+
13
+ - [Installation](#installation)
14
+ - [Supported Environments & Frameworks](#supported-environments--frameworks)
15
+ - [Configuration](#configuration)
16
+ - [Quick Start](#quick-start)
17
+ - [Messaging](#messaging)
18
+ - [SMS](#send-sms)
19
+ - [Email](#send-email)
20
+ - [Fax](#send-fax)
21
+ - [TTS (Text-to-Speech)](#make-a-tts-call)
22
+ - [Voice (Audio File)](#make-a-voice-call-audio-file)
23
+ - [WhatsApp](#send-whatsapp-message)
24
+ - [RCS](#send-rcs-message)
25
+ - [Workflow](#send-workflow-message)
26
+ - [📄 Detailed channel docs](docs/messaging.md)
27
+ - [Using Addressbook Destinations](#using-addressbook-destinations)
28
+ - [Builder API (AddRecipient, AddAttachment)](#builder-api-addrecipient-addattachment)
29
+ - [Scheduled Sending](#scheduled-sending)
30
+ - [Webhooks](#webhooks)
31
+ - [Reports](#reports)
32
+ - [Message Status](#get-message-status)
33
+ - [SMS Reply](#get-sms-replies)
34
+ - [SMS Received](#get-sms-received-list)
35
+ - [Actions](#actions)
36
+ - [Abort](#abort-a-job)
37
+ - [Reschedule](#reschedule-a-job)
38
+ - [Resubmit](#resubmit-a-failed-job)
39
+ - [Pacing](#adjust-pacing)
40
+ - [Opt-Out Management](#opt-out-management)
41
+ - [Addressbook](#addressbook)
42
+ - [Contacts](#contacts)
43
+ - [Groups](#groups)
44
+ - [Contact Groups](#contact-groups)
45
+ - [Group Contacts](#group-contacts)
46
+ - [Response Structure](#response-structure)
47
+ - [Error Handling](#error-handling)
48
+ - [TypeScript Types Reference](#typescript-types-reference)
49
+
50
+ ---
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ npm install tnzapi-ts
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Supported Environments & Frameworks
61
+
62
+ ### Runtime
63
+
64
+ `tnzapi-ts` is a **Node.js library** — it talks to the TNZ API using Node's built-in `http`/`https` modules and reads local files via `fs` (for attachments). It does **not** run in a browser: bundlers targeting the browser (webpack/Vite/CRA browser builds, plain `<script>` tags) can't resolve these Node built-ins.
65
+
66
+ - **Node.js:** 14.x or later (LTS recommended). The compiled output uses native optional chaining (`?.`), which requires Node 14+.
67
+ - **Module format:** CommonJS (`require`/`module.exports`) with generated `.d.ts` declarations. Also works from ESM projects (`"type": "module"` in `package.json`) via Node's standard CommonJS interop — `import { TNZAPI } from 'tnzapi-ts'` works either way.
68
+ - **TypeScript:** No minimum enforced; developed and tested against TypeScript 5.4+. Plain JavaScript projects (CommonJS or ESM) can use the library too — types are optional, not required.
69
+
70
+ ### Frameworks
71
+
72
+ Because it's Node-only, `tnzapi-ts` works in any framework or runtime that executes JavaScript/TypeScript **server-side**:
73
+
74
+ | Framework / Runtime | Supported | Notes |
75
+ |---|---|---|
76
+ | Node.js (plain scripts, `ts-node`) | ✅ | |
77
+ | Express | ✅ | |
78
+ | Fastify | ✅ | |
79
+ | Koa | ✅ | |
80
+ | NestJS | ✅ | |
81
+ | Next.js | ✅ (server only) | API Routes, Route Handlers, Server Components, Server Actions. **Not** Client Components (`"use client"`) — those execute in the browser. |
82
+ | Remix / React Router (framework mode) | ✅ (server only) | Loaders and actions only, not browser-rendered components |
83
+ | AWS Lambda / Azure Functions / Google Cloud Functions | ✅ | Node.js runtime required |
84
+ | Electron | ✅ (main process only) | Not the renderer process, unless `nodeIntegration` is enabled |
85
+ | Browser (client-side React/Vue/Angular, plain `<script>`) | ❌ | No `fs`/`http`/`https` in the browser — bundling will fail or require broken polyfills |
86
+
87
+ ---
88
+
89
+ ## Configuration
90
+
91
+ ### Credentials
92
+
93
+ Obtain your **Auth Token** from the TNZ Dashboard › Users › API › Auth Token.
94
+
95
+ There are two ways to provide your credentials:
96
+
97
+ ---
98
+
99
+ **Option 1 — Environment file (recommended)**
100
+
101
+ Create a `.env` file in your project root (or copy from the example):
102
+
103
+ ```bash
104
+ cp .env.example .env
105
+ ```
106
+
107
+ `.env` contents:
108
+
109
+ ```
110
+ TNZ_AUTH_TOKEN=your-auth-token-here
111
+ ```
112
+
113
+ Then instantiate with no arguments — the token is read automatically:
114
+
115
+ ```typescript
116
+ import { TNZAPI } from 'tnzapi-ts';
117
+
118
+ const client = new TNZAPI();
119
+ ```
120
+
121
+ If `TNZ_AUTH_TOKEN` is not set, the constructor throws immediately:
122
+
123
+ ```
124
+ Error: TNZ AuthToken is required. Pass it as AuthToken or set the TNZ_AUTH_TOKEN environment variable.
125
+ ```
126
+
127
+ ---
128
+
129
+ **Option 2 — Pass directly to the constructor**
130
+
131
+ ```typescript
132
+ import { TNZAPI } from 'tnzapi-ts';
133
+
134
+ const client = new TNZAPI({
135
+ AuthToken: "your-auth-token-here"
136
+ });
137
+ ```
138
+
139
+ Both styles are equivalent — the constructor falls back to `TNZ_AUTH_TOKEN` only when `AuthToken` is not passed.
140
+
141
+ ---
142
+
143
+ **Custom API URL (e.g. staging or local dev):**
144
+
145
+ ```typescript
146
+ const client = new TNZAPI({
147
+ AuthToken: "your-auth-token-here",
148
+ URL: "https://staging-api.tnz.co.nz/api/v3.00"
149
+ });
150
+ ```
151
+
152
+ Or via environment variable:
153
+
154
+ ```
155
+ TNZ_API_URL=https://staging-api.tnz.co.nz/api/v3.00
156
+ ```
157
+
158
+ ### Environment Variables
159
+
160
+ | Variable | Required | Default | Description |
161
+ |----------|----------|---------|-------------|
162
+ | `TNZ_AUTH_TOKEN` | Yes\* | — | Bearer token from TNZ Dashboard |
163
+ | `TNZ_API_URL` | No | `https://api.tnz.co.nz/api/v3.00` | Override the base API URL |
164
+ | `TNZ_IGNORE_SSL` | No | — | Set to `true` to bypass SSL verification (local dev with self-signed certs) |
165
+
166
+ \* Required unless passed directly to the constructor.
167
+
168
+ ---
169
+
170
+ ## Quick Start
171
+
172
+ ```typescript
173
+ import { TNZAPI } from 'tnzapi-ts';
174
+
175
+ // Reads TNZ_AUTH_TOKEN from environment automatically
176
+ const client = new TNZAPI();
177
+
178
+ // Send an SMS
179
+ const result = await client.Messaging.SMS.SendMessage({
180
+ Message: "Hello from tnzapi-ts!",
181
+ Destinations: [
182
+ { ToNumber: "+64211234567" },
183
+ { ToNumber: "+64251234567" }
184
+ ]
185
+ });
186
+
187
+ console.log(result.Result); // "Success"
188
+ console.log(result.MessageID); // "ID-abc123..."
189
+ ```
190
+
191
+ ---
192
+
193
+ ## Messaging
194
+
195
+ All messaging methods return `Promise<MessagingApiSuccessResponseDTO | ErrorResponseDTO>`.
196
+
197
+ **Success response shape:**
198
+ ```typescript
199
+ {
200
+ Result: "Success",
201
+ MessageID: string, // Use this to track / report on the message
202
+ JobNum?: string,
203
+ Status?: string
204
+ }
205
+ ```
206
+
207
+ ### Common Parameters
208
+
209
+ All messaging calls accept these optional parameters:
210
+
211
+ | Parameter | Type | Description |
212
+ |-----------|------|-------------|
213
+ | `Reference` | `string` | Your internal reference (visible in reports) |
214
+ | `MessageID` | `string` | Force a specific message ID (must be unique) |
215
+ | `SendTime` | `string` | Schedule send time — `YYYY-MM-DD HH:mm` or ISO 8601 |
216
+ | `Timezone` | `string` | Timezone for `SendTime` (e.g. `"New Zealand"`) |
217
+ | `SubAccount` | `string` | Sub-account code |
218
+ | `Department` | `string` | Department code |
219
+ | `ChargeCode` | `string` | Charge code for billing |
220
+ | `ReportTo` | `string` | Email address to receive delivery reports |
221
+ | `NotificationType` | `NotificationType` | Delivery notification type (`None`, `Webhook`, `Email`) |
222
+ | `WebhookCallbackURL` | `string` | Webhook URL for status updates |
223
+ | `WebhookCallbackFormat` | `"JSON"` \| `"XML"` \| `"POST"` \| `"GET"` | Required when `WebhookCallbackURL` is set |
224
+ | `Mode` | `"Test"` | Use `"Test"` to validate without sending |
225
+
226
+ ---
227
+
228
+ ### Send SMS
229
+
230
+ → [Full parameter reference](docs/sms.md)
231
+
232
+ ```typescript
233
+ import { TNZAPI } from 'tnzapi-ts';
234
+
235
+ const client = new TNZAPI();
236
+
237
+ const result = await client.Messaging.SMS.SendMessage({
238
+ Message: "Hello! Your code is 1234.",
239
+ Destinations: [
240
+ { ToNumber: "+64211234567" },
241
+ { ToNumber: "+64221234567" }
242
+ ]
243
+ });
244
+
245
+ console.log(result.MessageID); // Track this for status reports
246
+ ```
247
+
248
+ **SMS-specific parameters:**
249
+
250
+ | Parameter | Type | Description |
251
+ |-----------|------|-------------|
252
+ | `Message` | `string` | The SMS body (required unless `TemplateID` is set) |
253
+ | `TemplateID` | `string (uuid)` | Pre-built template ID (alternative to `Message`) |
254
+ | `Destinations` | `ISMSDestination[]` | **Required.** Recipients |
255
+ | `ToNumber` | `string` | Single-recipient shorthand (alternative to `Destinations`); comma-separated for multiple |
256
+ | `GroupID` | `string` | Single-group shorthand (alternative to `Destinations`); comma-separated for multiple |
257
+ | `ContactID` | `string` | Single-contact shorthand (alternative to `Destinations`); comma-separated for multiple |
258
+ | `FallbackMode` | `SMSFallbackMode` | Fallback channel (`None`, `RCS`, `WAPP`, `Voice`) |
259
+ | `SMSEmailReply` | `string` | Email to receive SMS replies |
260
+ | `CharacterConversion` | `boolean` | Convert non-GSM characters |
261
+
262
+ **Single-recipient shorthand:**
263
+ ```typescript
264
+ const result = await client.Messaging.SMS.SendMessage({
265
+ Message: "Hello! Your code is 1234.",
266
+ ToNumber: "+64211234567"
267
+ });
268
+ ```
269
+
270
+ **With scheduling and webhook:**
271
+ ```typescript
272
+ import { WebhookCallbackFormat } from 'tnzapi-ts';
273
+
274
+ const result = await client.Messaging.SMS.SendMessage({
275
+ Reference: "promo-2030-01",
276
+ Message: "Your appointment is tomorrow at 9am.",
277
+ SendTime: "2030-06-01 08:00",
278
+ Timezone: "New Zealand",
279
+ Destinations: [
280
+ { ToNumber: "+64271234567" },
281
+ { ToNumber: "+64281234567" }
282
+ ],
283
+ WebhookCallbackURL: "https://yourapp.com/webhooks/sms",
284
+ WebhookCallbackFormat: WebhookCallbackFormat.JSON
285
+ });
286
+ ```
287
+
288
+ **Test mode (validates without sending):**
289
+ ```typescript
290
+ const result = await client.Messaging.SMS.SendMessage({
291
+ Message: "Test",
292
+ Mode: "Test",
293
+ Destinations: [
294
+ { ToNumber: "+64291234567" },
295
+ { ToNumber: "+64211234568" }
296
+ ]
297
+ });
298
+ ```
299
+
300
+ ---
301
+
302
+ ### Send Email
303
+
304
+ → [Full parameter reference](docs/email.md)
305
+
306
+ ```typescript
307
+ import { TNZAPI } from 'tnzapi-ts';
308
+
309
+ const client = new TNZAPI();
310
+
311
+ const result = await client.Messaging.Email.SendMessage({
312
+ FromEmail: "noreply@yourcompany.com",
313
+ EmailSubject: "Your monthly statement",
314
+ MessagePlain: "Please find your statement attached.",
315
+ Destinations: [
316
+ { EmailAddress: "alice@example.com" },
317
+ { EmailAddress: "bob@example.com" }
318
+ ]
319
+ });
320
+ ```
321
+
322
+ **Email-specific parameters:**
323
+
324
+ | Parameter | Type | Description |
325
+ |-----------|------|-------------|
326
+ | `EmailSubject` | `string` | **Required.** Email subject line |
327
+ | `MessagePlain` | `string` | Plain-text body (required if `MessageHTML`/`TemplateID` not set) |
328
+ | `MessageHTML` | `string` | HTML body (alternative to `MessagePlain`) |
329
+ | `TemplateID` | `string (uuid)` | Pre-built template ID (alternative to message body) |
330
+ | `Destinations` | `IEmailDestination[]` | **Required.** Recipients |
331
+ | `EmailAddress` | `string` | Single-recipient shorthand (alternative to `Destinations`); comma-separated for multiple |
332
+ | `GroupID` | `string` | Single-group shorthand (alternative to `Destinations`); comma-separated for multiple |
333
+ | `ContactID` | `string` | Single-contact shorthand (alternative to `Destinations`); comma-separated for multiple |
334
+ | `FromEmail` | `string` | Sender email address |
335
+ | `SMTPFrom` | `string` | Legacy/alternate sender field (rarely needed — prefer `FromEmail`) |
336
+ | `From` | `string` | Legacy/alternate sender field (rarely needed — prefer `FromEmail`) |
337
+ | `ReplyTo` | `string` | Reply-to email address |
338
+ | `CCEmail` | `string` | CC email address |
339
+ | `BCCEmail` | `string` | BCC email address |
340
+ | `Attachments` | `string[]` | Paths to local files to attach |
341
+
342
+ **Single-recipient shorthand:**
343
+ ```typescript
344
+ const result = await client.Messaging.Email.SendMessage({
345
+ EmailSubject: "Your monthly statement",
346
+ MessagePlain: "Please find your statement attached.",
347
+ EmailAddress: "customer@example.com"
348
+ });
349
+ ```
350
+
351
+ **With HTML body and attachment:**
352
+ ```typescript
353
+ const result = await client.Messaging.Email.SendMessage({
354
+ FromEmail: "noreply@yourcompany.com",
355
+ EmailSubject: "Invoice #1001",
356
+ MessageHTML: "<h1>Invoice</h1><p>Please find your invoice attached.</p>",
357
+ MessagePlain: "Invoice attached.",
358
+ Attachments: ["/path/to/invoice-1001.pdf"],
359
+ Destinations: [
360
+ { EmailAddress: "carol@example.com" },
361
+ { EmailAddress: "dave@example.com" }
362
+ ]
363
+ });
364
+ ```
365
+
366
+ ---
367
+
368
+ ### Send Fax
369
+
370
+ → [Full parameter reference](docs/fax.md)
371
+
372
+ ```typescript
373
+ import { TNZAPI } from 'tnzapi-ts';
374
+
375
+ const client = new TNZAPI();
376
+
377
+ const result = await client.Messaging.Fax.SendMessage({
378
+ Destinations: [
379
+ { ToNumber: "+6491234567" },
380
+ { ToNumber: "+6492345678" }
381
+ ],
382
+ Attachments: ["/path/to/document.pdf"]
383
+ });
384
+ ```
385
+
386
+ **Fax-specific parameters:**
387
+
388
+ | Parameter | Type | Description |
389
+ |-----------|------|-------------|
390
+ | `Destinations` | `IFaxDestination[]` | **Required.** Fax numbers |
391
+ | `ToNumber` | `string` | Single-recipient shorthand (alternative to `Destinations`); comma-separated for multiple |
392
+ | `GroupID` | `string` | Single-group shorthand (alternative to `Destinations`); comma-separated for multiple |
393
+ | `ContactID` | `string` | Single-contact shorthand (alternative to `Destinations`); comma-separated for multiple |
394
+ | `TemplateID` | `string (uuid)` | Pre-built template ID (alternative to `Attachments`) |
395
+ | `Attachments` | `string[]` | Paths to local PDF/image files |
396
+ | `Resolution` | `FaxResolution` | Fax resolution (`Low` or `High`) |
397
+ | `CallerID` | `string` | Caller ID displayed to the recipient's fax machine |
398
+ | `CSID` | `string` | Fax header identifier string |
399
+ | `RetryAttempts` | `number` | Number of retry attempts |
400
+ | `RetryPeriod` | `number` | Minutes between retries |
401
+ | `WatermarkFolder` | `string` | TNZ watermark folder name |
402
+ | `WatermarkFirstPage` | `string` | Watermark file applied to first page |
403
+ | `WatermarkAllPages` | `string` | Watermark file applied to all pages |
404
+
405
+ **Single-recipient shorthand:**
406
+ ```typescript
407
+ const result = await client.Messaging.Fax.SendMessage({
408
+ ToNumber: "+6491234567",
409
+ Attachments: ["/path/to/document.pdf"]
410
+ });
411
+ ```
412
+
413
+ **With retry settings and watermark:**
414
+ ```typescript
415
+ import { FaxResolution } from 'tnzapi-ts';
416
+
417
+ const result = await client.Messaging.Fax.SendMessage({
418
+ Reference: "contract-signed",
419
+ Resolution: FaxResolution.High,
420
+ RetryAttempts: 5,
421
+ RetryPeriod: 10,
422
+ Destinations: [
423
+ { ToNumber: "+6441234567" },
424
+ { ToNumber: "+6431234567" }
425
+ ],
426
+ Attachments: ["/path/to/contract.pdf"]
427
+ });
428
+ ```
429
+
430
+ ---
431
+
432
+ ### Make a TTS Call
433
+
434
+ → [Full parameter reference](docs/tts.md)
435
+
436
+ Text-to-Speech: the API reads your message aloud to the called party.
437
+
438
+ ```typescript
439
+ import { TNZAPI } from 'tnzapi-ts';
440
+
441
+ const client = new TNZAPI();
442
+
443
+ const result = await client.Messaging.TTS.SendMessage({
444
+ MessageToPeople: "Hello, this is a reminder that your appointment is tomorrow at 9am. Press 1 to confirm.",
445
+ Destinations: [
446
+ { MainPhone: "+64211234567" },
447
+ { MainPhone: "+64221234567" }
448
+ ]
449
+ });
450
+ ```
451
+
452
+ **TTS-specific parameters:**
453
+
454
+ | Parameter | Type | Description |
455
+ |-----------|------|-------------|
456
+ | `MessageToPeople` | `string` | Message read when a person answers (required unless `TemplateID` set) |
457
+ | `TemplateID` | `string (uuid)` | Pre-built template ID (alternative to `MessageToPeople`) |
458
+ | `MessageToAnswerPhones` | `string` | Message left on voicemail/answerphone |
459
+ | `AnswerPhoneMode` | `AnswerPhoneMode` | Answerphone behaviour (`NDAS`, `NDAF`, `DAS`, `DAF`) |
460
+ | `Destinations` | `ITTSDestination[]` | **Required.** Phone numbers to call |
461
+ | `ToNumber` | `string` | Single-recipient shorthand (alternative to `Destinations`, resolves to `MainPhone`); comma-separated for multiple |
462
+ | `GroupID` | `string` | Single-group shorthand (alternative to `Destinations`); comma-separated for multiple |
463
+ | `ContactID` | `string` | Single-contact shorthand (alternative to `Destinations`); comma-separated for multiple |
464
+ | `CallerID` | `string` | Caller ID displayed to recipients |
465
+ | `Voice` | `TTSVoice` | Voice type (`Female1`, `Male1`, `Nicole`, `Russell`, etc.) |
466
+ | `RetryAttempts` | `number` | Retry attempts on no-answer |
467
+ | `RetryPeriod` | `number` | Minutes between retries |
468
+ | `NumberOfOperators` | `number` | Max simultaneous calls |
469
+ | `KeypadOptionRequired` | `boolean` | Require keypad input before proceeding |
470
+ | `EndCallMessage` | `string` | Message played before the call ends |
471
+ | `Options` | `string` | Additional call options (raw passthrough) |
472
+ | `Keypads` | `ITTSKeypad[]` | IVR keypad routing options |
473
+
474
+ **Single-recipient shorthand:**
475
+ ```typescript
476
+ const result = await client.Messaging.TTS.SendMessage({
477
+ MessageToPeople: "Hello, this is a reminder about your appointment tomorrow at 9am.",
478
+ ToNumber: "+64211234567"
479
+ });
480
+ ```
481
+
482
+ **With answerphone message and keypad routing:**
483
+ ```typescript
484
+ import { TTSVoice, AnswerPhoneMode } from 'tnzapi-ts';
485
+
486
+ const result = await client.Messaging.TTS.SendMessage({
487
+ MessageToPeople: "Press 1 to confirm your appointment. Press 2 to cancel.",
488
+ MessageToAnswerPhones: "We called about your appointment. Please call us back.",
489
+ Voice: TTSVoice.Nicole,
490
+ AnswerPhoneMode: AnswerPhoneMode.DAS,
491
+ CallerID: "+6491234567",
492
+ RetryAttempts: 3,
493
+ RetryPeriod: 5,
494
+ Destinations: [
495
+ { MainPhone: "+64271234567" },
496
+ { MainPhone: "+64291234567" }
497
+ ],
498
+ Keypads: [
499
+ { Tone: 1, RouteNumber: "+6491234567" }, // Transfer to operator on key 1
500
+ { Tone: 2, Play: "Thank you, your appointment has been cancelled." }
501
+ ]
502
+ });
503
+ ```
504
+
505
+ ---
506
+
507
+ ### Make a Voice Call (Audio File)
508
+
509
+ → [Full parameter reference](docs/voice.md)
510
+
511
+ Play a pre-recorded WAV or MP3 file to called parties.
512
+
513
+ ```typescript
514
+ import { TNZAPI } from 'tnzapi-ts';
515
+
516
+ const client = new TNZAPI();
517
+
518
+ const result = await client.Messaging.Voice.SendMessage({
519
+ Destinations: [
520
+ { MainPhone: "+64221234567" },
521
+ { MainPhone: "+64281234567" }
522
+ ],
523
+ VoiceFiles: [
524
+ {
525
+ Name: "MessageToPeople", // Which part of the call this file plays for
526
+ File: "/path/to/message.wav" // WAV, 16-bit, 8000 Hz recommended
527
+ }
528
+ ]
529
+ });
530
+ ```
531
+
532
+ **Voice-specific parameters:**
533
+
534
+ | Parameter | Type | Description |
535
+ |-----------|------|-------------|
536
+ | `Destinations` | `IVoiceDestination[]` | **Required.** Phone numbers to call |
537
+ | `ToNumber` | `string` | Single-recipient shorthand (alternative to `Destinations`, resolves to `MainPhone`); comma-separated for multiple |
538
+ | `GroupID` | `string` | Single-group shorthand (alternative to `Destinations`); comma-separated for multiple |
539
+ | `ContactID` | `string` | Single-contact shorthand (alternative to `Destinations`); comma-separated for multiple |
540
+ | `TemplateID` | `string (uuid)` | Pre-built template ID (alternative to `MessageToPeople`/`VoiceFiles`) |
541
+ | `VoiceFiles` | `IVoiceFile[]` | Audio files to play. `Name` values: `MessageToPeople`, `MessageToAnswerPhones`, `CallRouteMessageToPeople`, `CallRouteMessageToOperators`, `CallRouteMessageOnWrongKey` |
542
+ | `MessageToPeople` | `string` | Optional TTS fallback if no audio file for live answer |
543
+ | `MessageToAnswerPhones` | `string` | Optional TTS fallback for answerphone |
544
+ | `AnswerPhoneMode` | `AnswerPhoneMode` | Answerphone behaviour (`NDAS`, `NDAF`, `DAS`, `DAF`) |
545
+ | `CallerID` | `string` | Caller ID shown to recipients |
546
+ | `RetryAttempts` | `number` | Retry attempts on no-answer |
547
+ | `RetryPeriod` | `number` | Minutes between retries |
548
+ | `NumberOfOperators` | `number` | Max simultaneous calls |
549
+ | `KeypadOptionRequired` | `boolean` | Require keypad input before proceeding |
550
+ | `EndCallMessage` | `string` | Message played before the call ends |
551
+ | `Options` | `string` | Additional call options (raw passthrough) |
552
+ | `Keypads` | `IVoiceKeypad[]` | IVR keypad options (can include audio `File`) |
553
+
554
+ **Single-recipient shorthand:**
555
+ ```typescript
556
+ const result = await client.Messaging.Voice.SendMessage({
557
+ ToNumber: "+64211234567",
558
+ VoiceFiles: [
559
+ { Name: "MessageToPeople", File: "/path/to/message.wav" }
560
+ ]
561
+ });
562
+ ```
563
+
564
+ **Multiple audio files with keypad routing:**
565
+ ```typescript
566
+ const result = await client.Messaging.Voice.SendMessage({
567
+ Destinations: [
568
+ { MainPhone: "+64251234567" },
569
+ { MainPhone: "+64211234568" }
570
+ ],
571
+ VoiceFiles: [
572
+ { Name: "MessageToPeople", File: "/audio/main-message.wav" },
573
+ { Name: "MessageToAnswerPhones", File: "/audio/voicemail.wav" }
574
+ ],
575
+ Keypads: [
576
+ { Tone: 1, RouteNumber: "+6491234567" }, // Transfer to number
577
+ { Tone: 2, File: "/audio/cancelled.wav" } // Play audio on key 2
578
+ ]
579
+ });
580
+ ```
581
+
582
+ ---
583
+
584
+ ### Send WhatsApp Message
585
+
586
+ → [Full parameter reference](docs/whatsapp.md)
587
+
588
+ ```typescript
589
+ import { TNZAPI } from 'tnzapi-ts';
590
+
591
+ const client = new TNZAPI();
592
+
593
+ const result = await client.Messaging.WhatsApp.SendMessage({
594
+ Message: "Hello! Your order has been dispatched.",
595
+ Destinations: [
596
+ { ToNumber: "+64221234568" },
597
+ { ToNumber: "+64211234567" }
598
+ ]
599
+ });
600
+ ```
601
+
602
+ **WhatsApp-specific parameters:**
603
+
604
+ | Parameter | Type | Description |
605
+ |-----------|------|-------------|
606
+ | `Message` | `string` | Plain-text message body (required unless `TemplateID` set) |
607
+ | `TemplateID` | `string (uuid)` | Pre-approved WhatsApp template ID |
608
+ | `FallbackMode` | `WhatsAppFallbackMode` | Fallback channel if WhatsApp fails (`None`, `RCS`, `SMS`, `Voice`) |
609
+ | `Destinations` | `IWhatsAppDestination[]` | **Required.** WhatsApp-registered numbers |
610
+ | `ToNumber` | `string` | Single-recipient shorthand (alternative to `Destinations`); comma-separated for multiple |
611
+ | `GroupID` | `string` | Single-group shorthand (alternative to `Destinations`); comma-separated for multiple |
612
+ | `ContactID` | `string` | Single-contact shorthand (alternative to `Destinations`); comma-separated for multiple |
613
+ | `FromNumber` | `string` | WhatsApp sender number |
614
+ | `ReportTo` | `string` | Email address to receive delivery reports |
615
+ | `Attachments` | `string[]` | Paths to local media files to attach |
616
+
617
+ **Single-recipient shorthand:**
618
+ ```typescript
619
+ const result = await client.Messaging.WhatsApp.SendMessage({
620
+ Message: "Hello! Your order has been dispatched.",
621
+ ToNumber: "+64211234567"
622
+ });
623
+ ```
624
+
625
+ ---
626
+
627
+ ### Send RCS Message
628
+
629
+ → [Full parameter reference](docs/rcs.md)
630
+
631
+ ```typescript
632
+ import { TNZAPI } from 'tnzapi-ts';
633
+
634
+ const client = new TNZAPI();
635
+
636
+ const result = await client.Messaging.RCS.SendMessage({
637
+ Message: "Hello [[FirstName]], your appointment is confirmed.",
638
+ Destinations: [
639
+ { ToNumber: "+6421000001", FirstName: "Alice" },
640
+ { ToNumber: "+6421000002", FirstName: "Bob" }
641
+ ]
642
+ });
643
+ ```
644
+
645
+ **RCS-specific parameters:**
646
+
647
+ | Parameter | Type | Description |
648
+ |-----------|------|-------------|
649
+ | `Message` | `string` | Message body (required unless `TemplateID` set) |
650
+ | `TemplateID` | `string (uuid)` | Pre-configured template ID |
651
+ | `FallbackMode` | `RCSFallbackMode` | Fallback channel if RCS unavailable (`None`) |
652
+ | `Destinations` | `IRCSDestination[]` | **Required.** Recipients with mobile numbers |
653
+ | `ToNumber` | `string` | Single-recipient shorthand (alternative to `Destinations`); comma-separated for multiple |
654
+ | `GroupID` | `string` | Single-group shorthand (alternative to `Destinations`); comma-separated for multiple |
655
+ | `ContactID` | `string` | Single-contact shorthand (alternative to `Destinations`); comma-separated for multiple |
656
+ | `FromNumber` | `string` | Sender ID or number |
657
+
658
+ **Single-recipient shorthand:**
659
+ ```typescript
660
+ const result = await client.Messaging.RCS.SendMessage({
661
+ Message: "Hello, your appointment is confirmed.",
662
+ ToNumber: "+6421000001"
663
+ });
664
+ ```
665
+
666
+ ---
667
+
668
+ ### Send Workflow Message
669
+
670
+ → [Full parameter reference](docs/workflow.md)
671
+
672
+ Workflows are multi-channel sequences configured in the TNZ Dashboard.
673
+
674
+ ```typescript
675
+ import { TNZAPI } from 'tnzapi-ts';
676
+
677
+ const client = new TNZAPI();
678
+
679
+ const result = await client.Messaging.Workflow.SendMessage({
680
+ WorkflowTemplateID: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
681
+ Destinations: [
682
+ { ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98" },
683
+ { ContactID: "8000000a-f002-4007-b00a-d00000000002" }
684
+ ]
685
+ });
686
+ ```
687
+
688
+ **Workflow-specific parameters:**
689
+
690
+ | Parameter | Type | Description |
691
+ |-----------|------|-------------|
692
+ | `WorkflowTemplateID` | `string (uuid)` | **Required.** UUID of the workflow template from TNZ Dashboard |
693
+ | `Destinations` | `IWorkflowDestination[]` | **Required.** Use an addressbook `ContactID`/`GroupID`, or supply `ToNumber`/`EmailAddress`/`MainPhone` to create a new contact inline |
694
+ | `ToNumber` | `string` | Single-recipient shorthand (alternative to `Destinations`); comma-separated for multiple |
695
+ | `MainPhone` | `string` | Single-recipient shorthand (alternative to `Destinations`), independent of `ToNumber`; comma-separated for multiple |
696
+ | `GroupID` | `string` | Single-group shorthand (alternative to `Destinations`); comma-separated for multiple |
697
+ | `ContactID` | `string` | Single-contact shorthand (alternative to `Destinations`); comma-separated for multiple |
698
+
699
+ > **Note:** Inline destinations (`ToNumber`, `EmailAddress`, `MainPhone`) automatically create a new addressbook entry for the recipient, or update a matching existing one if a contact with that phone/email already exists in your addressbook. This also applies to the top-level `ToNumber`/`MainPhone` shorthand fields above — they resolve internally to exactly the same `Destinations: [{ ToNumber: ... }]` / `[{ MainPhone: ... }]` shape, so sending a Workflow request via shorthand without a `ContactID`/`GroupID` will create-or-update an addressbook contact, the same as writing out the `Destinations` array by hand. (`EmailAddress` is not available as a top-level shorthand for Workflow — only inside `Destinations`.)
700
+
701
+ **Single-recipient shorthand:**
702
+ ```typescript
703
+ const result = await client.Messaging.Workflow.SendMessage({
704
+ WorkflowTemplateID: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
705
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98"
706
+ });
707
+ ```
708
+
709
+ ---
710
+
711
+ ### Using Addressbook Destinations
712
+
713
+ All messaging APIs support sending to addressbook contacts and groups instead of (or in addition to) bare phone numbers.
714
+
715
+ ```typescript
716
+ // Send SMS to a specific contact in the addressbook
717
+ await client.Messaging.SMS.SendMessage({
718
+ Message: "Hello from the addressbook!",
719
+ Destinations: [
720
+ { ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98" }
721
+ ]
722
+ });
723
+
724
+ // Send to an entire group
725
+ await client.Messaging.SMS.SendMessage({
726
+ Message: "Hello group!",
727
+ Destinations: [
728
+ { GroupID: "ecf323e6-c432-11f0-98a9-86ea8dc1d654" }
729
+ ]
730
+ });
731
+
732
+ // Mix bare numbers with addressbook entries
733
+ await client.Messaging.Email.SendMessage({
734
+ EmailSubject: "Newsletter",
735
+ MessagePlain: "Our latest updates.",
736
+ Destinations: [
737
+ { EmailAddress: "direct@example.com" },
738
+ { ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98" },
739
+ { GroupID: "ecf323e6-c432-11f0-98a9-86ea8dc1d654" }
740
+ ]
741
+ });
742
+ ```
743
+
744
+ ---
745
+
746
+ ### Single Destination Shorthand
747
+
748
+ Every messaging channel also accepts a single-recipient shorthand directly on the top-level args, as
749
+ an alternative to wrapping one recipient in `Destinations: [...]`. Comma-separated values create
750
+ multiple destinations:
751
+
752
+ ```typescript
753
+ // Equivalent to Destinations: [{ ToNumber: "+64211234567" }]
754
+ await client.Messaging.SMS.SendMessage({
755
+ Message: "Hello!",
756
+ ToNumber: "+64211234567"
757
+ });
758
+
759
+ // Comma-separated values create multiple destinations
760
+ await client.Messaging.SMS.SendMessage({
761
+ Message: "Hello!",
762
+ ToNumber: "+64211234567,+64221234567"
763
+ });
764
+
765
+ // GroupID works the same way, and combines additively with Destinations
766
+ await client.Messaging.SMS.SendMessage({
767
+ Message: "Hello!",
768
+ GroupID: "4000000b-f002-4007-b00a-c00000000005"
769
+ });
770
+
771
+ // So does ContactID — available on every channel, comma-separated for multiple
772
+ await client.Messaging.SMS.SendMessage({
773
+ Message: "Hello!",
774
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98,8000000a-f002-4007-b00a-d00000000002"
775
+ });
776
+
777
+ // Email uses EmailAddress instead of ToNumber — same comma-separated behaviour
778
+ await client.Messaging.Email.SendMessage({
779
+ EmailSubject: "Your invoice",
780
+ MessagePlain: "Please find your invoice attached.",
781
+ EmailAddress: "alice@example.com,bob@example.com"
782
+ });
783
+ ```
784
+
785
+ The shorthand field per channel is: `ToNumber` (SMS, Fax, WhatsApp, RCS), `EmailAddress` (Email),
786
+ `ToNumber` (TTS, Voice — resolves internally to the same destination as `MainPhone`), and both
787
+ `ToNumber` and `MainPhone` (Workflow). `GroupID`/`ContactID` are available on every channel.
788
+
789
+ ---
790
+
791
+ ### Builder API (`AddRecipient`, `AddAttachment`)
792
+
793
+ All messaging API classes expose a builder-style API as an alternative to passing arguments to `SendMessage` directly.
794
+
795
+ > **Prefer `SendMessage({ Destinations: [...] })`** for typed destination objects. The builder API is retained for backward compatibility and is most useful for adding simple phone-number strings.
796
+
797
+ All builder methods return `this`, so calls can be chained:
798
+
799
+ ```typescript
800
+ // SMS — chain recipients then send
801
+ const result = await client.Messaging.SMS
802
+ .AddRecipient('+64211234567')
803
+ .AddRecipient({ ToNumber: '+64221234567', FirstName: 'Jane' })
804
+ .AddRecipient([{ ToNumber: '+64231234567' }, { ToNumber: '+64241234567' }])
805
+ .SendMessage({ Message: 'Hello!' });
806
+
807
+ // Email — chain recipients and attachments
808
+ const result = await client.Messaging.Email
809
+ .AddRecipient({ EmailAddress: 'user@example.com' })
810
+ .AddAttachment('/path/to/report.pdf')
811
+ .AddAttachment('/path/to/invoice.pdf')
812
+ .SendMessage({ EmailSubject: 'Your documents', MessagePlain: 'See attached.' });
813
+
814
+ // TTS — chain recipients and keypads
815
+ const result = await client.Messaging.TTS
816
+ .AddRecipient({ MainPhone: '+6421000001' })
817
+ .AddKeypad(1, '+6491001001', 'Transferring to sales.')
818
+ .AddKeypad(2, '+6491001002', 'Transferring to support.')
819
+ .SendMessage({ MessageToPeople: 'Press 1 for sales, 2 for support.' });
820
+
821
+ // Voice — chain recipients, audio files, and keypads
822
+ const result = await client.Messaging.Voice
823
+ .AddRecipient({ MainPhone: '+6421000001' })
824
+ .AddVoiceFile('MessageToPeople', '/audio/message.wav')
825
+ .AddKeypad(1, '+6491001001', '/audio/transfer.wav')
826
+ .SendMessage();
827
+ ```
828
+
829
+ > **Note:** `AddRecipient('+64...')` (string input) produces `{ Recipient: '...' }` internally for backward compatibility. Both the string and object forms are accepted by the API. State accumulated via builder calls is reset after each `SendMessage` call.
830
+
831
+ `AddRecipient` is typed per channel, not against the cross-channel union: on `client.Messaging.SMS`, for example, it's `(recipient: string | ISMSDestination | Array<string | ISMSDestination>) => this` — passing another channel's destination type (e.g. an `IEmailDestination` to `Messaging.SMS.AddRecipient`) will fail to type-check. Each messaging class accepts string, its own destination object, or an array of either. `IMessagingDestination` (`ISMSDestination | IEmailDestination | IFaxDestination | ITTSDestination | IVoiceDestination | IWhatsAppDestination | IRCSDestination | IWorkflowDestination`) is exported as a convenience union type, not the actual parameter type of any single channel's `AddRecipient`.
832
+
833
+ ---
834
+
835
+ ### Scheduled Sending
836
+
837
+ Use `SendTime` and optionally `Timezone` to schedule messages:
838
+
839
+ ```typescript
840
+ await client.Messaging.SMS.SendMessage({
841
+ Message: "Good morning! Today's meeting is at 10am.",
842
+ SendTime: "2030-12-25 08:00",
843
+ Timezone: "New Zealand",
844
+ Destinations: [
845
+ { ToNumber: "+64281234567" },
846
+ { ToNumber: "+64291234567" }
847
+ ]
848
+ });
849
+ ```
850
+
851
+ Accepted `SendTime` formats: `YYYY-MM-DD`, `YYYY-MM-DD HH:mm`, ISO 8601.
852
+
853
+ ---
854
+
855
+ ### Webhooks
856
+
857
+ Receive real-time delivery status updates via webhook:
858
+
859
+ ```typescript
860
+ import { WebhookCallbackFormat } from 'tnzapi-ts';
861
+
862
+ await client.Messaging.SMS.SendMessage({
863
+ Message: "Hello!",
864
+ Destinations: [
865
+ { ToNumber: "+64251234567" },
866
+ { ToNumber: "+64221234568" }
867
+ ],
868
+ WebhookCallbackURL: "https://yourapp.com/webhooks/tnz",
869
+ WebhookCallbackFormat: WebhookCallbackFormat.JSON // JSON | XML | POST | GET
870
+ });
871
+ ```
872
+
873
+ ---
874
+
875
+ ## Reports
876
+
877
+ ### Get Message Status
878
+
879
+ Poll the delivery status of a previously sent message.
880
+
881
+ ```typescript
882
+ import { TNZAPI } from 'tnzapi-ts';
883
+
884
+ const client = new TNZAPI();
885
+
886
+ const result = await client.Reports.Status.Poll({
887
+ MessageID: "ID-abc123",
888
+ Channel: "sms" // sms | email | fax | tts | voice | whatsapp | rcs | workflow
889
+ });
890
+
891
+ console.log(result.JobStatus); // e.g. "Completed"
892
+ console.log(result.Recipients); // Array of per-recipient delivery results
893
+ ```
894
+
895
+ **Parameters:**
896
+
897
+ | Parameter | Type | Description |
898
+ |-----------|------|-------------|
899
+ | `MessageID` | `string` | **Required.** The MessageID returned when the message was sent |
900
+ | `Channel` | `string` | Channel the message was sent on (defaults to `"sms"`) |
901
+ | `RecordsPerPage` | `number` | Recipients per page (1–999, default: 100) |
902
+ | `Page` | `number` | Page number (default: 1) |
903
+
904
+ **Response fields:**
905
+
906
+ ```typescript
907
+ {
908
+ Result: string,
909
+ MessageID?: string,
910
+ JobStatus?: string, // "Completed", "Processing", "Delayed", etc.
911
+ JobNum?: string,
912
+ Account?: string,
913
+ SubAccount?: string,
914
+ Department?: string,
915
+ Reference?: string,
916
+ CreatedTimeLocal?: string,
917
+ CreatedTimeUTC?: string,
918
+ DelayedTimeLocal?: string,
919
+ DelayedTimeUTC?: string,
920
+ Timezone?: string,
921
+ Count?: number, // Total recipients
922
+ Complete?: number,
923
+ Success?: number, // Successfully delivered
924
+ Failed?: number, // Failed deliveries
925
+ Price?: number,
926
+ TotalRecords?: number,
927
+ RecordsPerPage?: number,
928
+ PageCount?: number,
929
+ Page?: number,
930
+ Recipients: [
931
+ {
932
+ Type?: string,
933
+ DestSeq?: number,
934
+ Destination?: string,
935
+ ContactID?: string,
936
+ Status?: string,
937
+ Result?: string,
938
+ SentTimeLocal?: string,
939
+ SentTimeUTC?: string,
940
+ Price?: number
941
+ // plus Attention, Company, Custom1-9, RemoteID
942
+ }
943
+ ]
944
+ }
945
+ ```
946
+
947
+ ---
948
+
949
+ ### Get SMS Replies
950
+
951
+ Retrieve replies sent by recipients to an SMS message.
952
+
953
+ ```typescript
954
+ const result = await client.Reports.SMSReply.Poll({
955
+ MessageID: "ID-abc123",
956
+ Page: 1,
957
+ RecordsPerPage: 50
958
+ });
959
+
960
+ for (const recipient of result.Recipients ?? []) {
961
+ for (const reply of recipient.SMSReplies ?? []) {
962
+ console.log(`From ${reply.From}: ${reply.MessageText}`);
963
+ }
964
+ }
965
+ ```
966
+
967
+ **Parameters:**
968
+
969
+ | Parameter | Type | Description |
970
+ |-----------|------|-------------|
971
+ | `MessageID` | `string` | **Required.** The MessageID of the SMS that was sent |
972
+ | `RecordsPerPage` | `number` | Default: 100, max: 999 |
973
+ | `Page` | `number` | Default: 1 |
974
+
975
+ ---
976
+
977
+ ### Get SMS Received List
978
+
979
+ Retrieve inbound SMS messages received in a time window.
980
+
981
+ ```typescript
982
+ // By time period (last N minutes)
983
+ const result = await client.Reports.SMSReceived.Poll({
984
+ TimePeriod: 1440, // Last 24 hours (1–1440 minutes)
985
+ RecordsPerPage: 50,
986
+ Page: 1
987
+ });
988
+
989
+ // By date range
990
+ const result2 = await client.Reports.SMSReceived.Poll({
991
+ DateFrom: "2030-01-01",
992
+ DateTo: "2030-01-31"
993
+ });
994
+
995
+ for (const msg of result.Messages ?? []) {
996
+ console.log(`From ${msg.From}: ${msg.MessageText}`);
997
+ }
998
+ ```
999
+
1000
+ **Parameters:**
1001
+
1002
+ | Parameter | Type | Description |
1003
+ |-----------|------|-------------|
1004
+ | `TimePeriod` | `number` | Minutes to look back (1–1440). Used if `DateFrom`/`DateTo` not set |
1005
+ | `DateFrom` | `string` | Start date — ISO 8601 or `YYYY-MM-DD` |
1006
+ | `DateTo` | `string` | End date — ISO 8601 or `YYYY-MM-DD` |
1007
+ | `RecordsPerPage` | `number` | Default: 100, max: 999 |
1008
+ | `Page` | `number` | Default: 1 |
1009
+
1010
+ ---
1011
+
1012
+ ## Actions
1013
+
1014
+ Actions operate on messages that have already been submitted. All require `MessageID` and `Channel`.
1015
+
1016
+ Channels used across these actions: `sms`, `email`, `fax`, `tts`, `voice`. `Abort` and `Reschedule` accept any non-empty `Channel` value client-side (no allow-list enforced by the SDK); `Resubmit` and `Pacing` enforce the specific channel restrictions noted below.
1017
+
1018
+ ---
1019
+
1020
+ ### Abort a Job
1021
+
1022
+ Cancel a pending or delayed message before it is sent.
1023
+
1024
+ ```typescript
1025
+ const result = await client.Actions.Abort.SendRequest({
1026
+ MessageID: "ID-abc123",
1027
+ Channel: "sms"
1028
+ });
1029
+ ```
1030
+
1031
+ ---
1032
+
1033
+ ### Reschedule a Job
1034
+
1035
+ Change the send time of a delayed (scheduled) message.
1036
+
1037
+ ```typescript
1038
+ const result = await client.Actions.Reschedule.SendRequest({
1039
+ MessageID: "ID-abc123",
1040
+ Channel: "email",
1041
+ SendTime: "2030-06-15 09:00" // Must be a parseable date (YYYY-MM-DD HH:mm or ISO 8601); the API rejects times in the past
1042
+ });
1043
+ ```
1044
+
1045
+ ---
1046
+
1047
+ ### Resubmit a Failed Job
1048
+
1049
+ Retry a message that previously failed delivery.
1050
+
1051
+ > Supported channels: `email`, `fax`, `tts`, `voice` only. SMS resubmit is not supported.
1052
+
1053
+ ```typescript
1054
+ const result = await client.Actions.Resubmit.SendRequest({
1055
+ MessageID: "ID-abc123",
1056
+ Channel: "email"
1057
+ });
1058
+
1059
+ // Optionally set a new send time
1060
+ const result2 = await client.Actions.Resubmit.SendRequest({
1061
+ MessageID: "ID-abc123",
1062
+ Channel: "tts",
1063
+ SendTime: "2030-06-15 10:00"
1064
+ });
1065
+ ```
1066
+
1067
+ ---
1068
+
1069
+ ### Adjust Pacing
1070
+
1071
+ Change the number of concurrent operators (simultaneous outbound calls) on an active TTS or voice job.
1072
+
1073
+ > Supported channels: `tts`, `voice`.
1074
+
1075
+ ```typescript
1076
+ const result = await client.Actions.Pacing.SendRequest({
1077
+ MessageID: "ID-abc123",
1078
+ Channel: "tts",
1079
+ NumberOfOperators: 5 // Number of simultaneous calls
1080
+ });
1081
+ ```
1082
+
1083
+ ---
1084
+
1085
+ ## Opt-Out Management
1086
+
1087
+ Manage your opt-out list (suppression list) for recipients who have requested not to be contacted.
1088
+
1089
+ ### List Opt-Outs
1090
+
1091
+ ```typescript
1092
+ const result = await client.OptOut.List({
1093
+ RecordsPerPage: 50,
1094
+ Page: 1
1095
+ });
1096
+
1097
+ for (const entry of result.OptOuts ?? []) {
1098
+ console.log(`${entry.Destination} (${entry.DestType}) opted out on ${entry.CreatedTimeLocal}`);
1099
+ }
1100
+ ```
1101
+
1102
+ **Optional filter parameters:**
1103
+
1104
+ | Parameter | Type | Description |
1105
+ |-----------|------|-------------|
1106
+ | `DestType` | `string` | Filter by destination type (`SMS`, `Email`, `Voice`, `Fax`) |
1107
+ | `TimePeriod` | `number` | Return results created in the past _x_ days |
1108
+ | `ContactID` | `string` | Filter by ContactID |
1109
+
1110
+ ### Add Opt-Out
1111
+
1112
+ ```typescript
1113
+ const result = await client.OptOut.Create({
1114
+ Destination: "+64211234567",
1115
+ DestType: "SMS", // SMS | Email | Voice | Fax
1116
+ ContactID: "a1b2c3d4-...", // optional — link to an existing Addressbook contact
1117
+ StopMessage: "STOP", // optional — the opt-out message detected
1118
+ Notes: "Requested via SMS reply" // optional — free-form notes
1119
+ });
1120
+
1121
+ const optoutId = result.ID; // UUID — use for Detail/Delete
1122
+ ```
1123
+
1124
+ **Optional parameters:**
1125
+
1126
+ | Parameter | Type | Description |
1127
+ |-----------|------|-------------|
1128
+ | `Department` | `string` | The department the opt-out entry applies to |
1129
+ | `SubAccount` | `string` | The sub-account the opt-out entry applies to |
1130
+ | `ContactID` | `string` | Link to an existing Addressbook contact |
1131
+ | `StopMessage` | `string` | The opt-out message detected |
1132
+ | `Notes` | `string` | Free-form notes |
1133
+
1134
+ ### Get Opt-Out Detail
1135
+
1136
+ ```typescript
1137
+ const result = await client.OptOut.Detail({
1138
+ OptOutID: "a1b2c3d4-e5f6-7890-1234-567890abcdef" // UUID from List or Create
1139
+ });
1140
+
1141
+ console.log(result.Destination); // The opted-out destination
1142
+ console.log(result.DestType); // Channel type (SMS, Email, etc.)
1143
+ console.log(result.CreatedTimeLocal); // When the opt-out was added
1144
+ ```
1145
+
1146
+ ### Remove Opt-Out
1147
+
1148
+ ```typescript
1149
+ const result = await client.OptOut.Delete({
1150
+ OptOutID: "a1b2c3d4-e5f6-7890-1234-567890abcdef" // UUID from List or Create
1151
+ });
1152
+ ```
1153
+
1154
+ ---
1155
+
1156
+ ## Addressbook
1157
+
1158
+ ### Contacts
1159
+
1160
+ #### List Contacts
1161
+
1162
+ ```typescript
1163
+ const result = await client.Addressbook.Contact.List({
1164
+ RecordsPerPage: 50,
1165
+ Page: 1
1166
+ });
1167
+
1168
+ for (const contact of result.Contacts ?? []) {
1169
+ console.log(`${contact.FirstName} ${contact.LastName} — ${contact.MobilePhone}`);
1170
+ }
1171
+ ```
1172
+
1173
+ #### Get Contact Detail
1174
+
1175
+ ```typescript
1176
+ const result = await client.Addressbook.Contact.Detail({
1177
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98"
1178
+ });
1179
+
1180
+ console.log(result.Contact?.EmailAddress);
1181
+ ```
1182
+
1183
+ #### Create Contact
1184
+
1185
+ ```typescript
1186
+ const result = await client.Addressbook.Contact.Create({
1187
+ Title: "Mr",
1188
+ Company: "Acme Corp",
1189
+ FirstName: "John",
1190
+ LastName: "Smith",
1191
+ Position: "Manager",
1192
+ MobilePhone: "+64211234567",
1193
+ EmailAddress: "john.smith@acme.com",
1194
+ FaxNumber: "+6491234567",
1195
+ ViewBy: "Account", // Account | Subaccount | Department | No
1196
+ EditBy: "Account"
1197
+ });
1198
+
1199
+ console.log(result.Contact?.ContactID); // Save this GUID
1200
+ ```
1201
+
1202
+ **Available contact fields:**
1203
+
1204
+ | Field | Type | Description |
1205
+ |-------|------|-------------|
1206
+ | `Title` | `string` | e.g. `"Mr"`, `"Mrs"`, `"Dr"` |
1207
+ | `Company` | `string` | Company name |
1208
+ | `FirstName` | `string` | First name |
1209
+ | `LastName` | `string` | Last name |
1210
+ | `Position` | `string` | Job title |
1211
+ | `Attention` | `string` | Attention line |
1212
+ | `RecipDepartment` | `string` | Recipient's department |
1213
+ | `StreetAddress` | `string` | Street address |
1214
+ | `Suburb` | `string` | Suburb |
1215
+ | `City` | `string` | City |
1216
+ | `State` | `string` | State / province |
1217
+ | `Country` | `string` | Country |
1218
+ | `Postcode` | `string` | Postcode / ZIP |
1219
+ | `MainPhone` | `string` | Main phone |
1220
+ | `DirectPhone` | `string` | Direct phone |
1221
+ | `MobilePhone` | `string` | Mobile number |
1222
+ | `AltPhone1` | `string` | Alternate phone 1 |
1223
+ | `AltPhone2` | `string` | Alternate phone 2 |
1224
+ | `FaxNumber` | `string` | Fax number |
1225
+ | `EmailAddress` | `string` | Email address |
1226
+ | `WebAddress` | `string` | Website URL |
1227
+ | `Custom1`–`Custom4` | `string` | Custom fields |
1228
+ | `ViewBy` | `string` | Visibility: `Account`, `Subaccount`, `Department`, `No` |
1229
+ | `EditBy` | `string` | Edit access: `Account`, `Subaccount`, `Department`, `No` |
1230
+
1231
+ #### Update Contact
1232
+
1233
+ ```typescript
1234
+ const result = await client.Addressbook.Contact.Update({
1235
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98",
1236
+ MobilePhone: "+64219876543",
1237
+ EmailAddress: "new-email@acme.com"
1238
+ // Only fields you supply will be updated
1239
+ });
1240
+ ```
1241
+
1242
+ #### Delete Contact
1243
+
1244
+ ```typescript
1245
+ const result = await client.Addressbook.Contact.Delete({
1246
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98"
1247
+ });
1248
+ ```
1249
+
1250
+ ---
1251
+
1252
+ ### Groups
1253
+
1254
+ #### List Groups
1255
+
1256
+ ```typescript
1257
+ const result = await client.Addressbook.Group.List({
1258
+ RecordsPerPage: 50,
1259
+ Page: 1
1260
+ });
1261
+
1262
+ for (const group of result.Groups ?? []) {
1263
+ console.log(`${group.GroupName} (${group.GroupCode})`);
1264
+ }
1265
+ ```
1266
+
1267
+ #### Get Group Detail
1268
+
1269
+ ```typescript
1270
+ const result = await client.Addressbook.Group.Detail({
1271
+ GroupCode: "MY-GROUP"
1272
+ });
1273
+ ```
1274
+
1275
+ #### Create Group
1276
+
1277
+ ```typescript
1278
+ const result = await client.Addressbook.Group.Create({
1279
+ GroupName: "VIP Customers",
1280
+ ViewEditBy: "Account" // Account | Subaccount | Department | No
1281
+ });
1282
+
1283
+ console.log(result.Group?.GroupID); // Save the GUID
1284
+ console.log(result.Group?.GroupCode); // Auto-generated code
1285
+ ```
1286
+
1287
+ #### Update Group
1288
+
1289
+ ```typescript
1290
+ const result = await client.Addressbook.Group.Update({
1291
+ GroupCode: "MY-GROUP",
1292
+ GroupName: "VIP Customers 2025",
1293
+ ViewEditBy: "Subaccount"
1294
+ });
1295
+ ```
1296
+
1297
+ #### Delete Group
1298
+
1299
+ ```typescript
1300
+ const result = await client.Addressbook.Group.Delete({
1301
+ GroupCode: "MY-GROUP"
1302
+ });
1303
+ ```
1304
+
1305
+ ---
1306
+
1307
+ ### Contact Groups
1308
+
1309
+ Manage which groups a contact belongs to.
1310
+
1311
+ #### List Groups for a Contact
1312
+
1313
+ ```typescript
1314
+ const result = await client.Addressbook.ContactGroup.List({
1315
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98",
1316
+ RecordsPerPage: 50,
1317
+ Page: 1
1318
+ });
1319
+ ```
1320
+
1321
+ #### Get Contact–Group Membership Detail
1322
+
1323
+ ```typescript
1324
+ const result = await client.Addressbook.ContactGroup.Detail({
1325
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98",
1326
+ GroupCode: "MY-GROUP"
1327
+ });
1328
+ ```
1329
+
1330
+ #### Add Contact to a Group
1331
+
1332
+ ```typescript
1333
+ const result = await client.Addressbook.ContactGroup.Create({
1334
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98",
1335
+ GroupCode: "MY-GROUP"
1336
+ });
1337
+ ```
1338
+
1339
+ #### Remove Contact from a Group
1340
+
1341
+ ```typescript
1342
+ const result = await client.Addressbook.ContactGroup.Delete({
1343
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98",
1344
+ GroupCode: "MY-GROUP"
1345
+ });
1346
+ ```
1347
+
1348
+ ---
1349
+
1350
+ ### Group Contacts
1351
+
1352
+ Manage contacts within a group (the inverse view of Contact Groups).
1353
+
1354
+ #### List Contacts in a Group
1355
+
1356
+ ```typescript
1357
+ const result = await client.Addressbook.GroupContact.List({
1358
+ GroupCode: "MY-GROUP",
1359
+ RecordsPerPage: 50,
1360
+ Page: 1
1361
+ });
1362
+ ```
1363
+
1364
+ #### Get Group–Contact Membership Detail
1365
+
1366
+ ```typescript
1367
+ const result = await client.Addressbook.GroupContact.Detail({
1368
+ GroupCode: "MY-GROUP",
1369
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98"
1370
+ });
1371
+ ```
1372
+
1373
+ #### Add Contact to a Group (from group side)
1374
+
1375
+ ```typescript
1376
+ const result = await client.Addressbook.GroupContact.Create({
1377
+ GroupCode: "MY-GROUP",
1378
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98"
1379
+ });
1380
+ ```
1381
+
1382
+ #### Remove Contact from a Group (from group side)
1383
+
1384
+ ```typescript
1385
+ const result = await client.Addressbook.GroupContact.Delete({
1386
+ GroupCode: "MY-GROUP",
1387
+ ContactID: "cc5c3871-0d29-11f1-95bd-ae5f86698b98"
1388
+ });
1389
+ ```
1390
+
1391
+ ---
1392
+
1393
+ ## Response Structure
1394
+
1395
+ All API calls return one of two shapes:
1396
+
1397
+ ### Success
1398
+
1399
+ ```typescript
1400
+ // Messaging
1401
+ {
1402
+ Result: "Success",
1403
+ MessageID: string,
1404
+ JobNum?: string,
1405
+ Status?: string
1406
+ }
1407
+
1408
+ // Reports — Status
1409
+ {
1410
+ Result: "Success",
1411
+ MessageID?: string,
1412
+ JobStatus?: string,
1413
+ Count?: number,
1414
+ Success?: number,
1415
+ Failed?: number,
1416
+ Recipients: RecipientDTO[]
1417
+ }
1418
+
1419
+ // Addressbook — Contact
1420
+ {
1421
+ Result: "Success",
1422
+ Contact: {
1423
+ ContactID: string,
1424
+ FirstName: string,
1425
+ LastName: string,
1426
+ MobilePhone: string,
1427
+ EmailAddress: string,
1428
+ // ...all contact fields
1429
+ }
1430
+ }
1431
+ ```
1432
+
1433
+ ### Error
1434
+
1435
+ ```typescript
1436
+ {
1437
+ Result: "Error",
1438
+ ErrorMessage: string[] // One or more human-readable error descriptions
1439
+ }
1440
+ ```
1441
+
1442
+ ---
1443
+
1444
+ ## Error Handling
1445
+
1446
+ ```typescript
1447
+ import { TNZAPI } from 'tnzapi-ts';
1448
+
1449
+ const client = new TNZAPI();
1450
+
1451
+ const result = await client.Messaging.SMS.SendMessage({
1452
+ Message: "Hello!",
1453
+ Destinations: [
1454
+ { ToNumber: "+64211234568" },
1455
+ { ToNumber: "+64271234567" }
1456
+ ]
1457
+ });
1458
+
1459
+ if (result.Result === "Success") {
1460
+ console.log("Sent! MessageID:", result.MessageID);
1461
+ } else {
1462
+ console.error("API error:", result.ErrorMessage.join(", "));
1463
+ }
1464
+ ```
1465
+
1466
+ > **Note:** Check `result.Result === "Success"` (not `=== "Error"`) to get correct TypeScript narrowing — `Result` can be `"Error"`, `"Failed"`, or `"Unauthorized"` on a failed response, so only the `"Success"` check narrows both branches. `instanceof ErrorResponseDTO` works too, if you'd rather check the class directly.
1467
+
1468
+ **Common validation errors (caught before any API call):**
1469
+
1470
+ | Error | Cause |
1471
+ |-------|-------|
1472
+ | `Missing AuthToken` | No token provided in constructor or environment |
1473
+ | `Missing Message or TemplateID` | SMS/WhatsApp/RCS body is empty and no template specified |
1474
+ | `Missing EmailSubject` | Email subject is empty |
1475
+ | `Missing MessagePlain, MessageHTML or TemplateID` | Email has no plain-text or HTML body and no template specified |
1476
+ | `Missing MessageToPeople or TemplateID` | TTS call has no message and no template |
1477
+ | `Missing MessageToPeople contents, VoiceFiles, or TemplateID` | Voice call has no message, audio, or template |
1478
+ | `Missing WorkflowTemplateID` | Workflow template ID not provided |
1479
+ | `Empty Destination(s)` | No recipients in `Destinations` array |
1480
+ | `Invalid ToNumber - must be mobile number - {number}` | SMS recipient fails mobile number validation |
1481
+ | `Invalid Recipient - must be phone number - {number}` | Fax/TTS/Voice recipient fails phone validation |
1482
+ | `Invalid ToNumber - must be phone number - {number}` | WhatsApp/RCS recipient fails phone validation |
1483
+ | `Invalid EmailAddress - must be email address - {address}` | Email recipient fails email format validation |
1484
+ | `Unable to parse SendTime. Use YYYY-MM-DD hh:mm format.` | `SendTime` is not a recognised date format |
1485
+ | `Only Mode=Test is allowed` | Invalid value for `Mode` (only `"Test"` is accepted) |
1486
+ | `Missing or invalid WebhookCallbackFormat - JSON, XML, POST or GET` | `WebhookCallbackURL` set but format missing or invalid |
1487
+
1488
+ ---
1489
+
1490
+ ## TypeScript Types Reference
1491
+
1492
+ ### ITNZAuthArgs
1493
+
1494
+ ```typescript
1495
+ interface ITNZAuthArgs {
1496
+ AuthToken?: string; // Bearer token
1497
+ URL?: string; // Override API base URL
1498
+ }
1499
+ ```
1500
+
1501
+ ### Messaging Response
1502
+
1503
+ ```typescript
1504
+ class MessagingApiSuccessResponseDTO {
1505
+ Result: string;
1506
+ MessageID?: string;
1507
+ JobNum?: string;
1508
+ Status?: string;
1509
+ }
1510
+ ```
1511
+
1512
+ ### ErrorResponseDTO
1513
+
1514
+ ```typescript
1515
+ class ErrorResponseDTO {
1516
+ Result: string; // "Error"
1517
+ ErrorMessage: string[];
1518
+ }
1519
+ ```
1520
+
1521
+ ### Enums
1522
+
1523
+ ```typescript
1524
+ import {
1525
+ WebhookCallbackFormat, // JSON | XML | POST | GET
1526
+ NotificationType, // None | Webhook | Email
1527
+ AnswerPhoneMode, // NDAS | NDAF | DAS | DAF
1528
+ TTSVoice, // Female1 | Male1 | Nicole | Russell | Amy | Brian | Emma
1529
+ FaxResolution, // Low | High
1530
+ SMSFallbackMode, // None | RCS | WAPP | Voice
1531
+ WhatsAppFallbackMode, // None | RCS | SMS | Voice
1532
+ RCSFallbackMode, // None
1533
+ } from 'tnzapi-ts';
1534
+ ```
1535
+
1536
+ ### ISMSArgs
1537
+
1538
+ ```typescript
1539
+ interface ISMSDestination {
1540
+ ToNumber?: string;
1541
+ Recipient?: string; // generic fallback used by AddRecipient(string)
1542
+ Attention?: string;
1543
+ FirstName?: string;
1544
+ LastName?: string;
1545
+ Company?: string;
1546
+ Custom1?: string; Custom2?: string; Custom3?: string; Custom4?: string;
1547
+ Custom5?: string; Custom6?: string; Custom7?: string; Custom8?: string; Custom9?: string;
1548
+ ContactID?: string;
1549
+ GroupID?: string;
1550
+ GroupCode?: string;
1551
+ }
1552
+
1553
+ interface ISMSArgs {
1554
+ Reference?: string;
1555
+ Message?: string; // required unless TemplateID is set
1556
+ TemplateID?: string;
1557
+ FallbackMode?: SMSFallbackMode;
1558
+ Destinations?: ISMSDestination[];
1559
+ ToNumber?: string;
1560
+ GroupID?: string;
1561
+ ContactID?: string;
1562
+ SendTime?: string;
1563
+ Timezone?: string;
1564
+ SubAccount?: string;
1565
+ Department?: string;
1566
+ ChargeCode?: string;
1567
+ MessageID?: string;
1568
+ SMSEmailReply?: string;
1569
+ CharacterConversion?: boolean;
1570
+ ReportTo?: string;
1571
+ NotificationType?: NotificationType;
1572
+ WebhookCallbackURL?: string;
1573
+ WebhookCallbackFormat?: WebhookCallbackFormat;
1574
+ Mode?: 'Test';
1575
+ Attachments?: string[];
1576
+ }
1577
+ ```
1578
+
1579
+ ### IEmailArgs
1580
+
1581
+ ```typescript
1582
+ interface IEmailDestination {
1583
+ EmailAddress?: string;
1584
+ Recipient?: string; // generic fallback used by AddRecipient(string)
1585
+ Attention?: string;
1586
+ FirstName?: string;
1587
+ LastName?: string;
1588
+ Company?: string;
1589
+ Custom1?: string; Custom2?: string; Custom3?: string; Custom4?: string;
1590
+ Custom5?: string; Custom6?: string; Custom7?: string; Custom8?: string; Custom9?: string;
1591
+ ContactID?: string;
1592
+ GroupID?: string;
1593
+ GroupCode?: string;
1594
+ }
1595
+
1596
+ interface IEmailArgs {
1597
+ Reference?: string;
1598
+ EmailSubject: string;
1599
+ MessagePlain?: string; // required unless MessageHTML or TemplateID is set
1600
+ MessageHTML?: string;
1601
+ TemplateID?: string;
1602
+ FromEmail?: string;
1603
+ SMTPFrom?: string; // legacy/alternate sender field
1604
+ From?: string; // legacy/alternate sender field
1605
+ ReplyTo?: string;
1606
+ CCEmail?: string;
1607
+ BCCEmail?: string;
1608
+ Destinations?: IEmailDestination[];
1609
+ EmailAddress?: string;
1610
+ GroupID?: string;
1611
+ ContactID?: string;
1612
+ SendTime?: string;
1613
+ Timezone?: string;
1614
+ SubAccount?: string;
1615
+ Department?: string;
1616
+ ChargeCode?: string;
1617
+ MessageID?: string;
1618
+ ReportTo?: string;
1619
+ NotificationType?: NotificationType;
1620
+ WebhookCallbackURL?: string;
1621
+ WebhookCallbackFormat?: WebhookCallbackFormat;
1622
+ Mode?: 'Test';
1623
+ Attachments?: string[];
1624
+ }
1625
+ ```
1626
+
1627
+ ### IFaxArgs
1628
+
1629
+ ```typescript
1630
+ interface IFaxDestination {
1631
+ ToNumber?: string;
1632
+ Recipient?: string; // generic fallback used by AddRecipient(string)
1633
+ Attention?: string;
1634
+ FirstName?: string;
1635
+ LastName?: string;
1636
+ Company?: string;
1637
+ Custom1?: string; Custom2?: string; Custom3?: string; Custom4?: string;
1638
+ Custom5?: string; Custom6?: string; Custom7?: string; Custom8?: string; Custom9?: string;
1639
+ ContactID?: string;
1640
+ GroupID?: string;
1641
+ GroupCode?: string;
1642
+ }
1643
+
1644
+ interface IFaxArgs {
1645
+ Reference?: string;
1646
+ TemplateID?: string; // required unless Attachments is provided
1647
+ Resolution?: FaxResolution;
1648
+ CallerID?: string;
1649
+ CSID?: string;
1650
+ RetryAttempts?: number;
1651
+ RetryPeriod?: number;
1652
+ WatermarkFolder?: string;
1653
+ WatermarkFirstPage?: string;
1654
+ WatermarkAllPages?: string;
1655
+ Destinations?: IFaxDestination[];
1656
+ ToNumber?: string;
1657
+ GroupID?: string;
1658
+ ContactID?: string;
1659
+ SendTime?: string;
1660
+ Timezone?: string;
1661
+ SubAccount?: string;
1662
+ Department?: string;
1663
+ ChargeCode?: string;
1664
+ MessageID?: string;
1665
+ ReportTo?: string;
1666
+ NotificationType?: NotificationType;
1667
+ WebhookCallbackURL?: string;
1668
+ WebhookCallbackFormat?: WebhookCallbackFormat;
1669
+ Mode?: 'Test';
1670
+ Attachments?: string[];
1671
+ }
1672
+ ```
1673
+
1674
+ ### ITTSArgs
1675
+
1676
+ ```typescript
1677
+ interface ITTSDestination {
1678
+ MainPhone?: string;
1679
+ Recipient?: string; // generic fallback used by AddRecipient(string)
1680
+ Attention?: string;
1681
+ FirstName?: string;
1682
+ LastName?: string;
1683
+ Company?: string;
1684
+ Custom1?: string;
1685
+ Custom2?: string;
1686
+ Custom3?: string;
1687
+ Custom4?: string;
1688
+ Custom5?: string;
1689
+ Custom6?: string;
1690
+ Custom7?: string;
1691
+ Custom8?: string;
1692
+ Custom9?: string;
1693
+ ContactID?: string;
1694
+ GroupID?: string;
1695
+ GroupCode?: string;
1696
+ }
1697
+
1698
+ interface ITTSKeypad {
1699
+ Tone: number; // integer 0–9
1700
+ RouteNumber?: string;
1701
+ Play?: string;
1702
+ PlaySection?: string;
1703
+ }
1704
+
1705
+ interface ITTSArgs {
1706
+ Reference?: string;
1707
+ MessageToPeople?: string; // required unless TemplateID is set
1708
+ TemplateID?: string;
1709
+ MessageToAnswerPhones?: string;
1710
+ AnswerPhoneMode?: AnswerPhoneMode;
1711
+ Voice?: TTSVoice;
1712
+ CallerID?: string;
1713
+ RetryAttempts?: number;
1714
+ RetryPeriod?: number;
1715
+ NumberOfOperators?: number;
1716
+ KeypadOptionRequired?: boolean;
1717
+ CallRouteMessageOnWrongKey?: string;
1718
+ CallRouteMessageToPeople?: string;
1719
+ CallRouteMessageToOperators?: string;
1720
+ EndCallMessage?: string;
1721
+ Options?: string;
1722
+ Keypads?: ITTSKeypad[];
1723
+ Destinations?: ITTSDestination[];
1724
+ ToNumber?: string;
1725
+ GroupID?: string;
1726
+ ContactID?: string;
1727
+ SendTime?: string;
1728
+ Timezone?: string;
1729
+ SubAccount?: string;
1730
+ Department?: string;
1731
+ ChargeCode?: string;
1732
+ MessageID?: string;
1733
+ ReportTo?: string;
1734
+ NotificationType?: NotificationType;
1735
+ WebhookCallbackURL?: string;
1736
+ WebhookCallbackFormat?: WebhookCallbackFormat;
1737
+ Mode?: 'Test';
1738
+ }
1739
+ ```
1740
+
1741
+ ### IVoiceArgs
1742
+
1743
+ ```typescript
1744
+ interface IVoiceDestination {
1745
+ MainPhone?: string;
1746
+ Recipient?: string; // generic fallback used by AddRecipient(string)
1747
+ Attention?: string;
1748
+ FirstName?: string;
1749
+ LastName?: string;
1750
+ Company?: string;
1751
+ Custom1?: string;
1752
+ Custom2?: string;
1753
+ Custom3?: string;
1754
+ Custom4?: string;
1755
+ Custom5?: string;
1756
+ Custom6?: string;
1757
+ Custom7?: string;
1758
+ Custom8?: string;
1759
+ Custom9?: string;
1760
+ ContactID?: string;
1761
+ GroupID?: string;
1762
+ GroupCode?: string;
1763
+ }
1764
+
1765
+ interface IVoiceKeypad {
1766
+ Tone: number; // integer 0–9
1767
+ RouteNumber?: string;
1768
+ Play?: string;
1769
+ PlayFile?: string; // local audio file path played on this keypress
1770
+ PlaySection?: string;
1771
+ File?: string; // local audio file path
1772
+ }
1773
+
1774
+ interface IVoiceFile {
1775
+ Name: string; // e.g. 'MessageToPeople', 'MessageToAnswerPhones'
1776
+ File: string; // local file path
1777
+ }
1778
+
1779
+ interface IVoiceArgs {
1780
+ Reference?: string;
1781
+ MessageToPeople?: string;
1782
+ TemplateID?: string;
1783
+ MessageToAnswerPhones?: string;
1784
+ AnswerPhoneMode?: AnswerPhoneMode;
1785
+ VoiceFiles?: IVoiceFile[];
1786
+ CallerID?: string;
1787
+ RetryAttempts?: number;
1788
+ RetryPeriod?: number;
1789
+ NumberOfOperators?: number;
1790
+ KeypadOptionRequired?: boolean;
1791
+ CallRouteMessageOnWrongKey?: string;
1792
+ CallRouteMessageToPeople?: string;
1793
+ CallRouteMessageToOperators?: string;
1794
+ EndCallMessage?: string;
1795
+ Options?: string;
1796
+ Keypads?: IVoiceKeypad[];
1797
+ Destinations?: IVoiceDestination[];
1798
+ ToNumber?: string;
1799
+ GroupID?: string;
1800
+ ContactID?: string;
1801
+ SendTime?: string;
1802
+ Timezone?: string;
1803
+ SubAccount?: string;
1804
+ Department?: string;
1805
+ ChargeCode?: string;
1806
+ MessageID?: string;
1807
+ ReportTo?: string;
1808
+ NotificationType?: NotificationType;
1809
+ WebhookCallbackURL?: string;
1810
+ WebhookCallbackFormat?: WebhookCallbackFormat;
1811
+ Mode?: 'Test';
1812
+ }
1813
+ ```
1814
+
1815
+ ### IWhatsAppArgs
1816
+
1817
+ ```typescript
1818
+ interface IWhatsAppDestination {
1819
+ ToNumber?: string;
1820
+ Recipient?: string; // generic fallback used by AddRecipient(string)
1821
+ Attention?: string;
1822
+ FirstName?: string;
1823
+ LastName?: string;
1824
+ Company?: string;
1825
+ Custom1?: string;
1826
+ Custom2?: string;
1827
+ Custom3?: string;
1828
+ Custom4?: string;
1829
+ Custom5?: string;
1830
+ Custom6?: string;
1831
+ Custom7?: string;
1832
+ Custom8?: string;
1833
+ Custom9?: string;
1834
+ ContactID?: string;
1835
+ GroupID?: string;
1836
+ GroupCode?: string;
1837
+ }
1838
+
1839
+ interface IWhatsAppArgs {
1840
+ Reference?: string;
1841
+ Message?: string; // required unless TemplateID is set
1842
+ TemplateID?: string;
1843
+ FallbackMode?: WhatsAppFallbackMode;
1844
+ FromNumber?: string;
1845
+ Destinations?: IWhatsAppDestination[];
1846
+ ToNumber?: string;
1847
+ GroupID?: string;
1848
+ ContactID?: string;
1849
+ ReportTo?: string;
1850
+ SendTime?: string;
1851
+ Timezone?: string;
1852
+ SubAccount?: string;
1853
+ Department?: string;
1854
+ ChargeCode?: string;
1855
+ MessageID?: string;
1856
+ NotificationType?: NotificationType;
1857
+ WebhookCallbackURL?: string;
1858
+ WebhookCallbackFormat?: WebhookCallbackFormat;
1859
+ Mode?: 'Test';
1860
+ Attachments?: string[];
1861
+ }
1862
+ ```
1863
+
1864
+ ### IRCSArgs
1865
+
1866
+ ```typescript
1867
+ interface IRCSDestination {
1868
+ ToNumber?: string;
1869
+ Recipient?: string; // generic fallback used by AddRecipient(string)
1870
+ Attention?: string;
1871
+ FirstName?: string;
1872
+ LastName?: string;
1873
+ Company?: string;
1874
+ Custom1?: string;
1875
+ Custom2?: string;
1876
+ Custom3?: string;
1877
+ Custom4?: string;
1878
+ Custom5?: string;
1879
+ Custom6?: string;
1880
+ Custom7?: string;
1881
+ Custom8?: string;
1882
+ Custom9?: string;
1883
+ ContactID?: string;
1884
+ GroupID?: string;
1885
+ GroupCode?: string;
1886
+ }
1887
+
1888
+ interface IRCSArgs {
1889
+ Reference?: string;
1890
+ Message?: string; // required unless TemplateID is set
1891
+ TemplateID?: string;
1892
+ FallbackMode?: RCSFallbackMode;
1893
+ FromNumber?: string;
1894
+ Destinations?: IRCSDestination[];
1895
+ ToNumber?: string;
1896
+ GroupID?: string;
1897
+ ContactID?: string;
1898
+ ReportTo?: string;
1899
+ SendTime?: string;
1900
+ Timezone?: string;
1901
+ SubAccount?: string;
1902
+ Department?: string;
1903
+ ChargeCode?: string;
1904
+ MessageID?: string;
1905
+ NotificationType?: NotificationType;
1906
+ WebhookCallbackURL?: string;
1907
+ WebhookCallbackFormat?: WebhookCallbackFormat;
1908
+ Mode?: 'Test';
1909
+ }
1910
+ ```
1911
+
1912
+ ### IWorkflowArgs
1913
+
1914
+ ```typescript
1915
+ interface IWorkflowDestination {
1916
+ ContactID?: string;
1917
+ GroupID?: string;
1918
+ GroupCode?: string;
1919
+ ToNumber?: string; // creates a new addressbook contact inline
1920
+ EmailAddress?: string; // creates a new addressbook contact inline
1921
+ MainPhone?: string; // creates a new addressbook contact inline
1922
+ Recipient?: string; // generic fallback used by AddRecipient(string)
1923
+ Attention?: string;
1924
+ FirstName?: string;
1925
+ LastName?: string;
1926
+ Company?: string;
1927
+ Custom1?: string;
1928
+ Custom2?: string;
1929
+ Custom3?: string;
1930
+ Custom4?: string;
1931
+ Custom5?: string;
1932
+ Custom6?: string;
1933
+ Custom7?: string;
1934
+ Custom8?: string;
1935
+ Custom9?: string;
1936
+ }
1937
+
1938
+ interface IWorkflowArgs {
1939
+ Reference?: string;
1940
+ WorkflowTemplateID: string;
1941
+ Destinations?: IWorkflowDestination[];
1942
+ ToNumber?: string;
1943
+ MainPhone?: string;
1944
+ GroupID?: string;
1945
+ ContactID?: string;
1946
+ SendTime?: string;
1947
+ Timezone?: string;
1948
+ SubAccount?: string;
1949
+ Department?: string;
1950
+ ChargeCode?: string;
1951
+ MessageID?: string;
1952
+ WebhookCallbackURL?: string;
1953
+ WebhookCallbackFormat?: WebhookCallbackFormat;
1954
+ Mode?: 'Test';
1955
+ }
1956
+ ```
1957
+
1958
+ ### IMessagingDestination
1959
+
1960
+ ```typescript
1961
+ type IMessagingDestination =
1962
+ | ISMSDestination
1963
+ | IEmailDestination
1964
+ | IFaxDestination
1965
+ | ITTSDestination
1966
+ | IVoiceDestination
1967
+ | IWhatsAppDestination
1968
+ | IRCSDestination
1969
+ | IWorkflowDestination;
1970
+ ```
1971
+
1972
+ ### IStatusArgs / ISMSReplyArgs / ISMSReceivedArgs
1973
+
1974
+ ```typescript
1975
+ interface IStatusArgs {
1976
+ MessageID: string;
1977
+ Channel?: string;
1978
+ RecordsPerPage?: number;
1979
+ Page?: number;
1980
+ }
1981
+
1982
+ interface ISMSReplyArgs {
1983
+ MessageID: string;
1984
+ RecordsPerPage?: number;
1985
+ Page?: number;
1986
+ }
1987
+
1988
+ interface ISMSReceivedArgs {
1989
+ TimePeriod?: number;
1990
+ DateFrom?: string;
1991
+ DateTo?: string;
1992
+ RecordsPerPage?: number;
1993
+ Page?: number;
1994
+ }
1995
+ ```
1996
+
1997
+ ### IAbortArgs / IResubmitArgs / IRescheduleArgs / IPacingArgs
1998
+
1999
+ ```typescript
2000
+ interface IAbortArgs {
2001
+ MessageID: string;
2002
+ Channel: string;
2003
+ }
2004
+
2005
+ interface IResubmitArgs {
2006
+ MessageID: string;
2007
+ Channel: string;
2008
+ SendTime?: string;
2009
+ }
2010
+
2011
+ interface IRescheduleArgs {
2012
+ MessageID: string;
2013
+ Channel: string;
2014
+ SendTime: string;
2015
+ }
2016
+
2017
+ interface IPacingArgs {
2018
+ MessageID: string;
2019
+ Channel: string;
2020
+ NumberOfOperators: number;
2021
+ }
2022
+ ```
2023
+
2024
+ ### IContactArgs
2025
+
2026
+ ```typescript
2027
+ interface IContactFields {
2028
+ Title?: string; Company?: string; FirstName?: string; LastName?: string;
2029
+ Position?: string; Attention?: string; RecipDepartment?: string;
2030
+ StreetAddress?: string; Suburb?: string; City?: string; State?: string;
2031
+ Country?: string; Postcode?: string; MainPhone?: string; DirectPhone?: string;
2032
+ MobilePhone?: string; AltPhone1?: string; AltPhone2?: string; FaxNumber?: string;
2033
+ EmailAddress?: string; WebAddress?: string;
2034
+ Custom1?: string; Custom2?: string; Custom3?: string; Custom4?: string;
2035
+ Timezone?: string; ViewBy?: string; EditBy?: string;
2036
+ }
2037
+
2038
+ interface IContactCreateArgs extends IContactFields {}
2039
+ interface IContactUpdateArgs extends IContactFields { ContactID: string; }
2040
+ interface IContactDetailArgs { ContactID: string; }
2041
+ interface IContactDeleteArgs { ContactID: string; }
2042
+ interface IContactListArgs { RecordsPerPage?: number; Page?: number; }
2043
+ ```
2044
+
2045
+ ### IGroupArgs
2046
+
2047
+ ```typescript
2048
+ interface IGroupFields {
2049
+ GroupName?: string;
2050
+ ViewEditBy?: string; // Account | Subaccount | Department | No
2051
+ SubAccount?: string;
2052
+ Department?: string;
2053
+ }
2054
+
2055
+ interface IGroupCreateArgs extends IGroupFields {}
2056
+ interface IGroupUpdateArgs extends IGroupFields { GroupID?: string; GroupCode?: string; }
2057
+ interface IGroupDetailArgs { GroupID?: string; GroupCode?: string; }
2058
+ interface IGroupDeleteArgs { GroupID?: string; GroupCode?: string; }
2059
+ interface IGroupListArgs { RecordsPerPage?: number; Page?: number; }
2060
+ ```
2061
+
2062
+ ### IContactGroupArgs / IGroupContactArgs
2063
+
2064
+ ```typescript
2065
+ interface IContactGroupArgs {
2066
+ ContactID?: string;
2067
+ Contact?: ContactModel;
2068
+ GroupID?: string;
2069
+ GroupCode?: string;
2070
+ Group?: GroupModel;
2071
+ }
2072
+ interface IContactGroupListArgs {
2073
+ ContactID?: string;
2074
+ Contact?: ContactModel;
2075
+ RecordsPerPage?: number;
2076
+ Page?: number;
2077
+ }
2078
+
2079
+ interface IGroupContactArgs {
2080
+ GroupID?: string;
2081
+ GroupCode?: string;
2082
+ Group?: GroupModel;
2083
+ ContactID?: string;
2084
+ Contact?: ContactModel;
2085
+ }
2086
+ interface IGroupContactListArgs {
2087
+ GroupID?: string;
2088
+ GroupCode?: string;
2089
+ Group?: GroupModel;
2090
+ RecordsPerPage?: number;
2091
+ Page?: number;
2092
+ }
2093
+ ```
2094
+
2095
+ ### IOptOutArgs
2096
+
2097
+ ```typescript
2098
+ interface IOptOutCreateArgs {
2099
+ Destination: string;
2100
+ DestType: string;
2101
+ Department?: string;
2102
+ SubAccount?: string;
2103
+ ContactID?: string;
2104
+ StopMessage?: string;
2105
+ Notes?: string;
2106
+ }
2107
+ interface IOptOutDetailArgs { OptOutID: string; }
2108
+ interface IOptOutDeleteArgs { OptOutID: string; }
2109
+ interface IOptOutListArgs {
2110
+ RecordsPerPage?: number;
2111
+ Page?: number;
2112
+ DestType?: string;
2113
+ TimePeriod?: number;
2114
+ ContactID?: string;
2115
+ }
2116
+ ```
2117
+
2118
+ ---
2119
+
2120
+ ## Development & Testing
2121
+
2122
+ ### Setting Up Environment Files
2123
+
2124
+ `jest.setup.js` loads environment files in this order, each overriding the previous:
2125
+
2126
+ | File | Purpose |
2127
+ |------|---------|
2128
+ | `.env` | Default environment — used in your application |
2129
+ | `.env.local` | Per-developer override — e.g. your personal `TNZ_AUTH_TOKEN` (gitignored, not committed) |
2130
+ | `.env.test` | Test-specific overrides (test recipient numbers, message IDs, etc.) |
2131
+
2132
+ **Step 1 — Create `.env` or `.env.local`:**
2133
+
2134
+ ```bash
2135
+ cp .env.example .env.local
2136
+ ```
2137
+
2138
+ Edit `.env.local`:
2139
+
2140
+ ```
2141
+ TNZ_AUTH_TOKEN=your-auth-token-here
2142
+ TNZ_API_URL=https://api.tnz.co.nz/api/v3.00
2143
+ ```
2144
+
2145
+ **Step 2 — Create `.env.test`** (for integration tests only):
2146
+
2147
+ ```bash
2148
+ cp .env.example .env.test
2149
+ ```
2150
+
2151
+ Edit `.env.test` with test-specific values:
2152
+
2153
+ ```
2154
+ TNZ_AUTH_TOKEN=your-auth-token-here
2155
+
2156
+ # Shared test recipient — used by SMS, TTS, Voice, WhatsApp, and RCS tests
2157
+ TNZ_TEST_MOBILE=+6421000001
2158
+
2159
+ TNZ_TEST_EMAIL=test@example.com
2160
+ TNZ_TEST_FAX=+6491000001
2161
+
2162
+ # For workflow and addressbook tests
2163
+ TNZ_TEST_CONTACT_ID=00000000-0000-0000-0000-000000000000
2164
+ TNZ_TEST_WORKFLOW_TEMPLATE_ID=00000000-0000-0000-0000-000000000000
2165
+ TNZ_TEST_GROUP_ID=00000000-0000-0000-0000-000000000000
2166
+
2167
+ # For action/report tests
2168
+ TNZ_TEST_MESSAGE_ID=ID123456
2169
+ TNZ_TEST_MESSAGE_CHANNEL=sms
2170
+
2171
+ # Optional: bypass SSL for local dev API server
2172
+ # TNZ_IGNORE_SSL=true
2173
+ # TNZ_API_URL=https://localhost:5001/api/v3.00
2174
+ ```
2175
+
2176
+ > `.env.test` values override `.env.local`, which overrides `.env`, during test runs. All three files are gitignored — never commit credentials.
2177
+
2178
+ ### Running Tests
2179
+
2180
+ ```bash
2181
+ npm run build # Compile TypeScript to dist/
2182
+ npm run test # Run full test suite (unit + integration)
2183
+
2184
+ # Run only unit tests
2185
+ npm run test:unit
2186
+ # equivalent: npx jest --selectProjects unit
2187
+
2188
+ # Run only integration tests
2189
+ npm run test:integration
2190
+ # equivalent: npx jest --selectProjects integration
2191
+
2192
+ # Run a specific test file
2193
+ npx jest tests/unit/messaging/smsApi.spec.ts
2194
+ npx jest tests/integration/messaging/sms.spec.ts
2195
+ ```
2196
+
2197
+ Integration tests send real messages to the numbers configured in `.env.test`. Unit tests mock the HTTP layer and do not require valid credentials.
2198
+
2199
+ ---
2200
+
2201
+ ## Getting Help
2202
+
2203
+ If you need help installing or using the library, please check the [TNZ Contact](https://www.tnz.co.nz/About/Contact/) page.