@zavudev/sdk 0.55.0 → 0.57.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 (371) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/client.d.mts +25 -13
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +25 -13
  5. package/client.d.ts.map +1 -1
  6. package/client.js +15 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +15 -3
  9. package/client.mjs.map +1 -1
  10. package/internal/qs/formats.d.mts +7 -0
  11. package/internal/qs/formats.d.mts.map +1 -0
  12. package/internal/qs/formats.d.ts +7 -0
  13. package/internal/qs/formats.d.ts.map +1 -0
  14. package/internal/qs/formats.js +13 -0
  15. package/internal/qs/formats.js.map +1 -0
  16. package/internal/qs/formats.mjs +9 -0
  17. package/internal/qs/formats.mjs.map +1 -0
  18. package/internal/qs/index.d.mts +10 -0
  19. package/internal/qs/index.d.mts.map +1 -0
  20. package/internal/qs/index.d.ts +10 -0
  21. package/internal/qs/index.d.ts.map +1 -0
  22. package/internal/qs/index.js +14 -0
  23. package/internal/qs/index.js.map +1 -0
  24. package/internal/qs/index.mjs +10 -0
  25. package/internal/qs/index.mjs.map +1 -0
  26. package/internal/qs/stringify.d.mts +3 -0
  27. package/internal/qs/stringify.d.mts.map +1 -0
  28. package/internal/qs/stringify.d.ts +3 -0
  29. package/internal/qs/stringify.d.ts.map +1 -0
  30. package/internal/qs/stringify.js +277 -0
  31. package/internal/qs/stringify.js.map +1 -0
  32. package/internal/qs/stringify.mjs +274 -0
  33. package/internal/qs/stringify.mjs.map +1 -0
  34. package/internal/qs/types.d.mts +57 -0
  35. package/internal/qs/types.d.mts.map +1 -0
  36. package/internal/qs/types.d.ts +57 -0
  37. package/internal/qs/types.d.ts.map +1 -0
  38. package/internal/qs/types.js +3 -0
  39. package/internal/qs/types.js.map +1 -0
  40. package/internal/qs/types.mjs +2 -0
  41. package/internal/qs/types.mjs.map +1 -0
  42. package/internal/qs/utils.d.mts +15 -0
  43. package/internal/qs/utils.d.mts.map +1 -0
  44. package/internal/qs/utils.d.ts +15 -0
  45. package/internal/qs/utils.d.ts.map +1 -0
  46. package/internal/qs/utils.js +230 -0
  47. package/internal/qs/utils.js.map +1 -0
  48. package/internal/qs/utils.mjs +217 -0
  49. package/internal/qs/utils.mjs.map +1 -0
  50. package/internal/tslib.js +17 -17
  51. package/internal/utils/query.d.mts +0 -3
  52. package/internal/utils/query.d.mts.map +1 -1
  53. package/internal/utils/query.d.ts +0 -3
  54. package/internal/utils/query.d.ts.map +1 -1
  55. package/internal/utils/query.js +3 -16
  56. package/internal/utils/query.js.map +1 -1
  57. package/internal/utils/query.mjs +2 -16
  58. package/internal/utils/query.mjs.map +1 -1
  59. package/package.json +1 -1
  60. package/resources/agent-templates.d.mts +97 -0
  61. package/resources/agent-templates.d.mts.map +1 -0
  62. package/resources/agent-templates.d.ts +97 -0
  63. package/resources/agent-templates.d.ts.map +1 -0
  64. package/resources/agent-templates.js +39 -0
  65. package/resources/agent-templates.js.map +1 -0
  66. package/resources/agent-templates.mjs +35 -0
  67. package/resources/agent-templates.mjs.map +1 -0
  68. package/resources/agents/agents.d.mts +462 -0
  69. package/resources/agents/agents.d.mts.map +1 -0
  70. package/resources/agents/agents.d.ts +462 -0
  71. package/resources/agents/agents.d.ts.map +1 -0
  72. package/resources/agents/agents.js +129 -0
  73. package/resources/agents/agents.js.map +1 -0
  74. package/resources/agents/agents.mjs +124 -0
  75. package/resources/agents/agents.mjs.map +1 -0
  76. package/resources/agents/index.d.mts +3 -0
  77. package/resources/agents/index.d.mts.map +1 -0
  78. package/resources/agents/index.d.ts +3 -0
  79. package/resources/agents/index.d.ts.map +1 -0
  80. package/resources/agents/index.js +9 -0
  81. package/resources/agents/index.js.map +1 -0
  82. package/resources/agents/index.mjs +4 -0
  83. package/resources/agents/index.mjs.map +1 -0
  84. package/resources/agents/senders.d.mts +54 -0
  85. package/resources/agents/senders.d.mts.map +1 -0
  86. package/resources/agents/senders.d.ts +54 -0
  87. package/resources/agents/senders.d.ts.map +1 -0
  88. package/resources/agents/senders.js +45 -0
  89. package/resources/agents/senders.js.map +1 -0
  90. package/resources/agents/senders.mjs +41 -0
  91. package/resources/agents/senders.mjs.map +1 -0
  92. package/resources/agents.d.mts +2 -0
  93. package/resources/agents.d.mts.map +1 -0
  94. package/resources/agents.d.ts +2 -0
  95. package/resources/agents.d.ts.map +1 -0
  96. package/resources/agents.js +6 -0
  97. package/resources/agents.js.map +1 -0
  98. package/resources/agents.mjs +3 -0
  99. package/resources/agents.mjs.map +1 -0
  100. package/resources/broadcasts/broadcasts.d.mts +16 -9
  101. package/resources/broadcasts/broadcasts.d.mts.map +1 -1
  102. package/resources/broadcasts/broadcasts.d.ts +16 -9
  103. package/resources/broadcasts/broadcasts.d.ts.map +1 -1
  104. package/resources/broadcasts/broadcasts.js +16 -9
  105. package/resources/broadcasts/broadcasts.js.map +1 -1
  106. package/resources/broadcasts/broadcasts.mjs +16 -9
  107. package/resources/broadcasts/broadcasts.mjs.map +1 -1
  108. package/resources/calls.d.mts +539 -0
  109. package/resources/calls.d.mts.map +1 -0
  110. package/resources/calls.d.ts +539 -0
  111. package/resources/calls.d.ts.map +1 -0
  112. package/resources/calls.js +85 -0
  113. package/resources/calls.js.map +1 -0
  114. package/resources/calls.mjs +81 -0
  115. package/resources/calls.mjs.map +1 -0
  116. package/resources/contacts/contacts.d.mts +32 -13
  117. package/resources/contacts/contacts.d.mts.map +1 -1
  118. package/resources/contacts/contacts.d.ts +32 -13
  119. package/resources/contacts/contacts.d.ts.map +1 -1
  120. package/resources/contacts/contacts.js +0 -14
  121. package/resources/contacts/contacts.js.map +1 -1
  122. package/resources/contacts/contacts.mjs +0 -14
  123. package/resources/contacts/contacts.mjs.map +1 -1
  124. package/resources/conversations.d.mts +360 -0
  125. package/resources/conversations.d.mts.map +1 -0
  126. package/resources/conversations.d.ts +360 -0
  127. package/resources/conversations.d.ts.map +1 -0
  128. package/resources/conversations.js +47 -0
  129. package/resources/conversations.js.map +1 -0
  130. package/resources/conversations.mjs +43 -0
  131. package/resources/conversations.mjs.map +1 -0
  132. package/resources/email-domains.d.mts +260 -0
  133. package/resources/email-domains.d.mts.map +1 -0
  134. package/resources/email-domains.d.ts +260 -0
  135. package/resources/email-domains.d.ts.map +1 -0
  136. package/resources/email-domains.js +77 -0
  137. package/resources/email-domains.js.map +1 -0
  138. package/resources/email-domains.mjs +73 -0
  139. package/resources/email-domains.mjs.map +1 -0
  140. package/resources/functions/functions.d.mts +122 -1
  141. package/resources/functions/functions.d.mts.map +1 -1
  142. package/resources/functions/functions.d.ts +122 -1
  143. package/resources/functions/functions.d.ts.map +1 -1
  144. package/resources/functions/functions.js +53 -0
  145. package/resources/functions/functions.js.map +1 -1
  146. package/resources/functions/functions.mjs +53 -0
  147. package/resources/functions/functions.mjs.map +1 -1
  148. package/resources/functions/git-link.d.mts +295 -0
  149. package/resources/functions/git-link.d.mts.map +1 -0
  150. package/resources/functions/git-link.d.ts +295 -0
  151. package/resources/functions/git-link.d.ts.map +1 -0
  152. package/resources/functions/git-link.js +97 -0
  153. package/resources/functions/git-link.js.map +1 -0
  154. package/resources/functions/git-link.mjs +93 -0
  155. package/resources/functions/git-link.mjs.map +1 -0
  156. package/resources/functions/index.d.mts +3 -1
  157. package/resources/functions/index.d.mts.map +1 -1
  158. package/resources/functions/index.d.ts +3 -1
  159. package/resources/functions/index.d.ts.map +1 -1
  160. package/resources/functions/index.js +5 -1
  161. package/resources/functions/index.js.map +1 -1
  162. package/resources/functions/index.mjs +2 -0
  163. package/resources/functions/index.mjs.map +1 -1
  164. package/resources/functions/triggers.d.mts +164 -0
  165. package/resources/functions/triggers.d.mts.map +1 -0
  166. package/resources/functions/triggers.d.ts +164 -0
  167. package/resources/functions/triggers.d.ts.map +1 -0
  168. package/resources/functions/triggers.js +74 -0
  169. package/resources/functions/triggers.js.map +1 -0
  170. package/resources/functions/triggers.mjs +70 -0
  171. package/resources/functions/triggers.mjs.map +1 -0
  172. package/resources/index.d.mts +10 -5
  173. package/resources/index.d.mts.map +1 -1
  174. package/resources/index.d.ts +10 -5
  175. package/resources/index.d.ts.map +1 -1
  176. package/resources/index.js +11 -1
  177. package/resources/index.js.map +1 -1
  178. package/resources/index.mjs +5 -0
  179. package/resources/index.mjs.map +1 -1
  180. package/resources/introspect.d.mts +74 -1
  181. package/resources/introspect.d.mts.map +1 -1
  182. package/resources/introspect.d.ts +74 -1
  183. package/resources/introspect.d.ts.map +1 -1
  184. package/resources/introspect.js +22 -0
  185. package/resources/introspect.js.map +1 -1
  186. package/resources/introspect.mjs +22 -0
  187. package/resources/introspect.mjs.map +1 -1
  188. package/resources/messages.d.mts +89 -1
  189. package/resources/messages.d.mts.map +1 -1
  190. package/resources/messages.d.ts +89 -1
  191. package/resources/messages.d.ts.map +1 -1
  192. package/resources/messages.js +48 -0
  193. package/resources/messages.js.map +1 -1
  194. package/resources/messages.mjs +48 -0
  195. package/resources/messages.mjs.map +1 -1
  196. package/resources/number-10dlc/brands.d.mts +10 -5
  197. package/resources/number-10dlc/brands.d.mts.map +1 -1
  198. package/resources/number-10dlc/brands.d.ts +10 -5
  199. package/resources/number-10dlc/brands.d.ts.map +1 -1
  200. package/resources/number-10dlc/brands.js +10 -5
  201. package/resources/number-10dlc/brands.js.map +1 -1
  202. package/resources/number-10dlc/brands.mjs +10 -5
  203. package/resources/number-10dlc/brands.mjs.map +1 -1
  204. package/resources/number-10dlc/campaigns/campaigns.d.mts +8 -7
  205. package/resources/number-10dlc/campaigns/campaigns.d.mts.map +1 -1
  206. package/resources/number-10dlc/campaigns/campaigns.d.ts +8 -7
  207. package/resources/number-10dlc/campaigns/campaigns.d.ts.map +1 -1
  208. package/resources/number-10dlc/campaigns/campaigns.js +8 -7
  209. package/resources/number-10dlc/campaigns/campaigns.js.map +1 -1
  210. package/resources/number-10dlc/campaigns/campaigns.mjs +8 -7
  211. package/resources/number-10dlc/campaigns/campaigns.mjs.map +1 -1
  212. package/resources/phone-numbers.d.mts +6 -1
  213. package/resources/phone-numbers.d.mts.map +1 -1
  214. package/resources/phone-numbers.d.ts +6 -1
  215. package/resources/phone-numbers.d.ts.map +1 -1
  216. package/resources/senders/agent/agent.d.mts +4 -3
  217. package/resources/senders/agent/agent.d.mts.map +1 -1
  218. package/resources/senders/agent/agent.d.ts +4 -3
  219. package/resources/senders/agent/agent.d.ts.map +1 -1
  220. package/resources/senders/agent/agent.js +2 -2
  221. package/resources/senders/agent/agent.js.map +1 -1
  222. package/resources/senders/agent/agent.mjs +2 -2
  223. package/resources/senders/agent/agent.mjs.map +1 -1
  224. package/resources/senders/agent/index.d.mts +2 -2
  225. package/resources/senders/agent/index.d.mts.map +1 -1
  226. package/resources/senders/agent/index.d.ts +2 -2
  227. package/resources/senders/agent/index.d.ts.map +1 -1
  228. package/resources/senders/agent/index.js +2 -2
  229. package/resources/senders/agent/index.js.map +1 -1
  230. package/resources/senders/agent/index.mjs +1 -1
  231. package/resources/senders/agent/index.mjs.map +1 -1
  232. package/resources/senders/agent/knowledge-bases/documents.d.mts +56 -1
  233. package/resources/senders/agent/knowledge-bases/documents.d.mts.map +1 -1
  234. package/resources/senders/agent/knowledge-bases/documents.d.ts +56 -1
  235. package/resources/senders/agent/knowledge-bases/documents.d.ts.map +1 -1
  236. package/resources/senders/agent/knowledge-bases/documents.js +33 -0
  237. package/resources/senders/agent/knowledge-bases/documents.js.map +1 -1
  238. package/resources/senders/agent/knowledge-bases/documents.mjs +33 -0
  239. package/resources/senders/agent/knowledge-bases/documents.mjs.map +1 -1
  240. package/resources/senders/agent/knowledge-bases/index.d.mts +1 -1
  241. package/resources/senders/agent/knowledge-bases/index.d.mts.map +1 -1
  242. package/resources/senders/agent/knowledge-bases/index.d.ts +1 -1
  243. package/resources/senders/agent/knowledge-bases/index.d.ts.map +1 -1
  244. package/resources/senders/agent/knowledge-bases/index.js.map +1 -1
  245. package/resources/senders/agent/knowledge-bases/index.mjs.map +1 -1
  246. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.mts +2 -2
  247. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.mts.map +1 -1
  248. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.ts +2 -2
  249. package/resources/senders/agent/knowledge-bases/knowledge-bases.d.ts.map +1 -1
  250. package/resources/senders/agent/knowledge-bases/knowledge-bases.js.map +1 -1
  251. package/resources/senders/agent/knowledge-bases/knowledge-bases.mjs.map +1 -1
  252. package/resources/senders/agent/tools/index.d.mts +3 -0
  253. package/resources/senders/agent/tools/index.d.mts.map +1 -0
  254. package/resources/senders/agent/tools/index.d.ts +3 -0
  255. package/resources/senders/agent/tools/index.d.ts.map +1 -0
  256. package/resources/senders/agent/tools/index.js +9 -0
  257. package/resources/senders/agent/tools/index.js.map +1 -0
  258. package/resources/senders/agent/tools/index.mjs +4 -0
  259. package/resources/senders/agent/tools/index.mjs.map +1 -0
  260. package/resources/senders/agent/tools/tools.d.mts +338 -0
  261. package/resources/senders/agent/tools/tools.d.mts.map +1 -0
  262. package/resources/senders/agent/tools/tools.d.ts +338 -0
  263. package/resources/senders/agent/tools/tools.d.ts.map +1 -0
  264. package/resources/senders/agent/tools/tools.js +163 -0
  265. package/resources/senders/agent/tools/tools.js.map +1 -0
  266. package/resources/senders/agent/tools/tools.mjs +158 -0
  267. package/resources/senders/agent/tools/tools.mjs.map +1 -0
  268. package/resources/senders/agent/tools/webhook.d.mts +28 -0
  269. package/resources/senders/agent/tools/webhook.d.mts.map +1 -0
  270. package/resources/senders/agent/tools/webhook.d.ts +28 -0
  271. package/resources/senders/agent/tools/webhook.d.ts.map +1 -0
  272. package/resources/senders/agent/tools/webhook.js +28 -0
  273. package/resources/senders/agent/tools/webhook.js.map +1 -0
  274. package/resources/senders/agent/tools/webhook.mjs +24 -0
  275. package/resources/senders/agent/tools/webhook.mjs.map +1 -0
  276. package/resources/senders/agent/tools.d.mts +1 -270
  277. package/resources/senders/agent/tools.d.mts.map +1 -1
  278. package/resources/senders/agent/tools.d.ts +1 -270
  279. package/resources/senders/agent/tools.d.ts.map +1 -1
  280. package/resources/senders/agent/tools.js +2 -131
  281. package/resources/senders/agent/tools.js.map +1 -1
  282. package/resources/senders/agent/tools.mjs +1 -129
  283. package/resources/senders/agent/tools.mjs.map +1 -1
  284. package/resources/senders/index.d.mts +2 -1
  285. package/resources/senders/index.d.mts.map +1 -1
  286. package/resources/senders/index.d.ts +2 -1
  287. package/resources/senders/index.d.ts.map +1 -1
  288. package/resources/senders/index.js +3 -1
  289. package/resources/senders/index.js.map +1 -1
  290. package/resources/senders/index.mjs +1 -0
  291. package/resources/senders/index.mjs.map +1 -1
  292. package/resources/senders/senders.d.mts +4 -0
  293. package/resources/senders/senders.d.mts.map +1 -1
  294. package/resources/senders/senders.d.ts +4 -0
  295. package/resources/senders/senders.d.ts.map +1 -1
  296. package/resources/senders/senders.js +4 -0
  297. package/resources/senders/senders.js.map +1 -1
  298. package/resources/senders/senders.mjs +4 -0
  299. package/resources/senders/senders.mjs.map +1 -1
  300. package/resources/senders/telegram.d.mts +48 -0
  301. package/resources/senders/telegram.d.mts.map +1 -0
  302. package/resources/senders/telegram.d.ts +48 -0
  303. package/resources/senders/telegram.d.ts.map +1 -0
  304. package/resources/senders/telegram.js +41 -0
  305. package/resources/senders/telegram.js.map +1 -0
  306. package/resources/senders/telegram.mjs +37 -0
  307. package/resources/senders/telegram.mjs.map +1 -0
  308. package/resources/templates.d.mts +66 -1
  309. package/resources/templates.d.mts.map +1 -1
  310. package/resources/templates.d.ts +66 -1
  311. package/resources/templates.d.ts.map +1 -1
  312. package/resources/templates.js +31 -0
  313. package/resources/templates.js.map +1 -1
  314. package/resources/templates.mjs +31 -0
  315. package/resources/templates.mjs.map +1 -1
  316. package/resources/urls.d.mts +24 -1
  317. package/resources/urls.d.mts.map +1 -1
  318. package/resources/urls.d.ts +24 -1
  319. package/resources/urls.d.ts.map +1 -1
  320. package/resources/urls.js +15 -0
  321. package/resources/urls.js.map +1 -1
  322. package/resources/urls.mjs +15 -0
  323. package/resources/urls.mjs.map +1 -1
  324. package/src/client.ts +129 -3
  325. package/src/internal/qs/LICENSE.md +13 -0
  326. package/src/internal/qs/README.md +3 -0
  327. package/src/internal/qs/formats.ts +10 -0
  328. package/src/internal/qs/index.ts +13 -0
  329. package/src/internal/qs/stringify.ts +385 -0
  330. package/src/internal/qs/types.ts +71 -0
  331. package/src/internal/qs/utils.ts +265 -0
  332. package/src/internal/utils/query.ts +2 -18
  333. package/src/resources/agent-templates.ts +128 -0
  334. package/src/resources/agents/agents.ts +603 -0
  335. package/src/resources/agents/index.ts +21 -0
  336. package/src/resources/agents/senders.ts +79 -0
  337. package/src/resources/agents.ts +3 -0
  338. package/src/resources/broadcasts/broadcasts.ts +16 -9
  339. package/src/resources/calls.ts +647 -0
  340. package/src/resources/contacts/contacts.ts +35 -20
  341. package/src/resources/conversations.ts +472 -0
  342. package/src/resources/email-domains.ts +337 -0
  343. package/src/resources/functions/functions.ts +202 -0
  344. package/src/resources/functions/git-link.ts +398 -0
  345. package/src/resources/functions/index.ts +22 -0
  346. package/src/resources/functions/triggers.ts +227 -0
  347. package/src/resources/index.ts +57 -0
  348. package/src/resources/introspect.ts +105 -0
  349. package/src/resources/messages.ts +102 -0
  350. package/src/resources/number-10dlc/brands.ts +10 -5
  351. package/src/resources/number-10dlc/campaigns/campaigns.ts +8 -7
  352. package/src/resources/phone-numbers.ts +6 -1
  353. package/src/resources/senders/agent/agent.ts +23 -17
  354. package/src/resources/senders/agent/index.ts +4 -1
  355. package/src/resources/senders/agent/knowledge-bases/documents.ts +89 -0
  356. package/src/resources/senders/agent/knowledge-bases/index.ts +4 -0
  357. package/src/resources/senders/agent/knowledge-bases/knowledge-bases.ts +8 -0
  358. package/src/resources/senders/agent/tools/index.ts +21 -0
  359. package/src/resources/senders/agent/tools/tools.ts +460 -0
  360. package/src/resources/senders/agent/tools/webhook.ts +40 -0
  361. package/src/resources/senders/agent/tools.ts +1 -364
  362. package/src/resources/senders/index.ts +2 -0
  363. package/src/resources/senders/senders.ts +10 -0
  364. package/src/resources/senders/telegram.ts +73 -0
  365. package/src/resources/templates.ts +80 -0
  366. package/src/resources/urls.ts +35 -0
  367. package/src/version.ts +1 -1
  368. package/version.d.mts +1 -1
  369. package/version.d.ts +1 -1
  370. package/version.js +1 -1
  371. package/version.mjs +1 -1
@@ -182,15 +182,22 @@ export class Broadcasts extends APIResource {
182
182
  /**
183
183
  * Start sending the broadcast immediately or schedule for later.
184
184
  *
185
- * **Verification is required to send, except on WhatsApp.** On every channel other
186
- * than `whatsapp`, the team must have completed both identity verification (KYC)
187
- * and business verification (KYB); passing one is not enough. A `whatsapp`
188
- * broadcast requires neither: it can only be built on a template, and Meta vets
189
- * the business and the content when it approves that template, so an unapproved
190
- * template is refused instead. `smart` is not exempt — it can route a contact to
191
- * SMS or email. Drafts can be created, edited and kept without any check. Every
192
- * send path — dashboard, API and CLI alike — enforces the same rule, returning
193
- * `403` with code `kyc_required` or `kyb_required` for whichever is outstanding.
185
+ * **The account must be past the unverified level to send, except on WhatsApp.**
186
+ * An account that has verified nothing is refused with `403` and code
187
+ * `kyc_required` on every channel other than `whatsapp`. Any one of these lifts
188
+ * it: identity verification (KYC), a saved payment method, a settled deposit, or a
189
+ * paid plan. Business verification (KYB) is not required to broadcast; it gates
190
+ * 10DLC registration only. A `whatsapp` broadcast is exempt: it can only be built
191
+ * on a template, and Meta vets the business and the content when it approves that
192
+ * template, so an unapproved template is refused instead. `smart` is not exempt,
193
+ * since it can route a contact to SMS or email. Drafts can be created, edited and
194
+ * kept without any check. Every send path (dashboard, API and CLI) enforces the
195
+ * same rule.
196
+ *
197
+ * **Daily ceilings apply per recipient.** Each message a broadcast sends counts
198
+ * against the channel's daily ceiling (see `POST /v1/messages`). Once the ceiling
199
+ * is reached, the remaining recipients are marked `failed` with `errorCode`
200
+ * `DAILY_LIMIT_EXCEEDED`; they are not retried the next day.
194
201
  *
195
202
  * **Review depends on the channel, and cannot be bypassed.** A draft is submitted
196
203
  * to automated content review here; it does not go straight out. A WhatsApp
@@ -0,0 +1,647 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class Calls extends APIResource {
10
+ /**
11
+ * Place an outbound voice call answered by the voice agent configured on the
12
+ * sender. Zavu dials the recipient and runs the conversation through its managed
13
+ * voice pipeline (speech recognition, the agent's LLM, and speech synthesis, with
14
+ * real-time interruption handling).
15
+ *
16
+ * **Requirements:**
17
+ *
18
+ * - The Voice Agents feature must be enabled for your team (otherwise `403`).
19
+ * - An account that has verified nothing may only call the phone numbers the
20
+ * project has verified (`403` with code `destination_not_verified`, and
21
+ * `details.verifiedNumbers` lists them), and at most 5 calls a day (`429` with
22
+ * code `daily_limit_exceeded`). A number is verified from the dashboard's
23
+ * Sandbox screen by sending the pre-filled WhatsApp message from that phone; the
24
+ * same verification covers SMS and calls. Verify your identity, add a payment
25
+ * method, settle a deposit or subscribe to call any destination. That raises the
26
+ * ceiling to 50 calls a day on Free; paid plans have no daily call ceiling. Full
27
+ * reference: https://docs.zavu.dev/concepts/sending-limits
28
+ * - The sender's agent must have `voice.enabled` set to `true`.
29
+ * - Not available with test-mode API keys.
30
+ *
31
+ * **Billing:** Voice calls are billed per minute of connected time plus telephony,
32
+ * deducted from your prepaid balance. A short-duration estimate is reserved when
33
+ * the call is placed; you are charged for the actual duration when the call ends.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const call = await client.calls.create({
38
+ * to: '+56912345678',
39
+ * });
40
+ * ```
41
+ */
42
+ create(body: CallCreateParams, options?: RequestOptions): APIPromise<CallCreateResponse> {
43
+ return this._client.post('/v1/calls', { body, ...options });
44
+ }
45
+
46
+ /**
47
+ * Retrieve a single voice call, including its full transcript once the
48
+ * conversation has produced turns.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * const call = await client.calls.retrieve('callId');
53
+ * ```
54
+ */
55
+ retrieve(callID: string, options?: RequestOptions): APIPromise<CallRetrieveResponse> {
56
+ return this._client.get(path`/v1/calls/${callID}`, options);
57
+ }
58
+
59
+ /**
60
+ * List voice calls for this project, most recent first. Transcripts are omitted
61
+ * from the list; fetch a single call to get its transcript.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * // Automatically fetches more pages as needed.
66
+ * for await (const callListResponse of client.calls.list()) {
67
+ * // ...
68
+ * }
69
+ * ```
70
+ */
71
+ list(
72
+ query: CallListParams | null | undefined = {},
73
+ options?: RequestOptions,
74
+ ): PagePromise<CallListResponsesCursor, CallListResponse> {
75
+ return this._client.getAPIList('/v1/calls', Cursor<CallListResponse>, { query, ...options });
76
+ }
77
+
78
+ /**
79
+ * End an active voice call. The call must still be ringing or in progress. Not
80
+ * available with test-mode API keys.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * const response = await client.calls.hangup('callId');
85
+ * ```
86
+ */
87
+ hangup(callID: string, options?: RequestOptions): APIPromise<CallHangupResponse> {
88
+ return this._client.post(path`/v1/calls/${callID}/hangup`, options);
89
+ }
90
+ }
91
+
92
+ export type CallListResponsesCursor = Cursor<CallListResponse>;
93
+
94
+ export interface CallCreateResponse {
95
+ call: CallCreateResponse.Call;
96
+ }
97
+
98
+ export namespace CallCreateResponse {
99
+ export interface Call {
100
+ id: string;
101
+
102
+ createdAt: string;
103
+
104
+ /**
105
+ * Whether the call was placed by Zavu (outbound) or received from a caller
106
+ * (inbound).
107
+ */
108
+ direction: 'inbound' | 'outbound';
109
+
110
+ /**
111
+ * Caller phone number in E.164 format. Your sender's number for outbound calls;
112
+ * the caller's number for inbound calls.
113
+ */
114
+ from: string;
115
+
116
+ /**
117
+ * Lifecycle status of a voice call.
118
+ *
119
+ * - `queued`: outbound call created, not yet dialing.
120
+ * - `ringing`: dialing (outbound) or received and ringing (inbound).
121
+ * - `in_progress`: answered, the agent is connected.
122
+ * - `completed`: ended after a conversation.
123
+ * - `failed`: could not be completed.
124
+ * - `busy`: the line was busy.
125
+ * - `no_answer`: rang but was not answered.
126
+ * - `canceled`: canceled before it was answered.
127
+ */
128
+ status: 'queued' | 'ringing' | 'in_progress' | 'completed' | 'failed' | 'busy' | 'no_answer' | 'canceled';
129
+
130
+ /**
131
+ * Callee phone number in E.164 format.
132
+ */
133
+ to: string;
134
+
135
+ /**
136
+ * When the call was answered.
137
+ */
138
+ answeredAt?: string | null;
139
+
140
+ /**
141
+ * Total cost of the call in USD, combining the managed voice pipeline per-minute
142
+ * charge and telephony. Available once the call has ended.
143
+ */
144
+ cost?: number | null;
145
+
146
+ /**
147
+ * Billable talk time in seconds, measured from answer to hangup.
148
+ */
149
+ durationSeconds?: number | null;
150
+
151
+ /**
152
+ * When the call ended.
153
+ */
154
+ endedAt?: string | null;
155
+
156
+ /**
157
+ * Why the call ended (e.g. `agent_ended`, `max_duration`, `transfer`, `hangup`).
158
+ * Present once the call is no longer active.
159
+ */
160
+ endReason?: string | null;
161
+
162
+ /**
163
+ * Arbitrary metadata you attached when creating the call.
164
+ */
165
+ metadata?: { [key: string]: string };
166
+
167
+ /**
168
+ * Ordered transcript of the call. Included when retrieving a single call; omitted
169
+ * from list responses.
170
+ */
171
+ transcript?: Array<Call.Transcript>;
172
+
173
+ /**
174
+ * Number of conversation turns exchanged during the call.
175
+ */
176
+ turnCount?: number | null;
177
+
178
+ updatedAt?: string;
179
+ }
180
+
181
+ export namespace Call {
182
+ /**
183
+ * A single turn in a voice call transcript.
184
+ */
185
+ export interface Transcript {
186
+ /**
187
+ * Who produced the turn. `tool` records a tool call the agent made during the
188
+ * conversation.
189
+ */
190
+ role: 'user' | 'assistant' | 'tool';
191
+
192
+ /**
193
+ * Ordinal position of the turn within the call, starting at 0.
194
+ */
195
+ seq: number;
196
+
197
+ /**
198
+ * Transcribed speech for `user` and `assistant` turns, or a JSON summary of the
199
+ * tool call for `tool` turns.
200
+ */
201
+ text: string;
202
+
203
+ /**
204
+ * When the turn ended.
205
+ */
206
+ endedAt?: string | null;
207
+
208
+ /**
209
+ * When the turn started.
210
+ */
211
+ startedAt?: string | null;
212
+ }
213
+ }
214
+ }
215
+
216
+ export interface CallRetrieveResponse {
217
+ call: CallRetrieveResponse.Call;
218
+ }
219
+
220
+ export namespace CallRetrieveResponse {
221
+ export interface Call {
222
+ id: string;
223
+
224
+ createdAt: string;
225
+
226
+ /**
227
+ * Whether the call was placed by Zavu (outbound) or received from a caller
228
+ * (inbound).
229
+ */
230
+ direction: 'inbound' | 'outbound';
231
+
232
+ /**
233
+ * Caller phone number in E.164 format. Your sender's number for outbound calls;
234
+ * the caller's number for inbound calls.
235
+ */
236
+ from: string;
237
+
238
+ /**
239
+ * Lifecycle status of a voice call.
240
+ *
241
+ * - `queued`: outbound call created, not yet dialing.
242
+ * - `ringing`: dialing (outbound) or received and ringing (inbound).
243
+ * - `in_progress`: answered, the agent is connected.
244
+ * - `completed`: ended after a conversation.
245
+ * - `failed`: could not be completed.
246
+ * - `busy`: the line was busy.
247
+ * - `no_answer`: rang but was not answered.
248
+ * - `canceled`: canceled before it was answered.
249
+ */
250
+ status: 'queued' | 'ringing' | 'in_progress' | 'completed' | 'failed' | 'busy' | 'no_answer' | 'canceled';
251
+
252
+ /**
253
+ * Callee phone number in E.164 format.
254
+ */
255
+ to: string;
256
+
257
+ /**
258
+ * When the call was answered.
259
+ */
260
+ answeredAt?: string | null;
261
+
262
+ /**
263
+ * Total cost of the call in USD, combining the managed voice pipeline per-minute
264
+ * charge and telephony. Available once the call has ended.
265
+ */
266
+ cost?: number | null;
267
+
268
+ /**
269
+ * Billable talk time in seconds, measured from answer to hangup.
270
+ */
271
+ durationSeconds?: number | null;
272
+
273
+ /**
274
+ * When the call ended.
275
+ */
276
+ endedAt?: string | null;
277
+
278
+ /**
279
+ * Why the call ended (e.g. `agent_ended`, `max_duration`, `transfer`, `hangup`).
280
+ * Present once the call is no longer active.
281
+ */
282
+ endReason?: string | null;
283
+
284
+ /**
285
+ * Arbitrary metadata you attached when creating the call.
286
+ */
287
+ metadata?: { [key: string]: string };
288
+
289
+ /**
290
+ * Ordered transcript of the call. Included when retrieving a single call; omitted
291
+ * from list responses.
292
+ */
293
+ transcript?: Array<Call.Transcript>;
294
+
295
+ /**
296
+ * Number of conversation turns exchanged during the call.
297
+ */
298
+ turnCount?: number | null;
299
+
300
+ updatedAt?: string;
301
+ }
302
+
303
+ export namespace Call {
304
+ /**
305
+ * A single turn in a voice call transcript.
306
+ */
307
+ export interface Transcript {
308
+ /**
309
+ * Who produced the turn. `tool` records a tool call the agent made during the
310
+ * conversation.
311
+ */
312
+ role: 'user' | 'assistant' | 'tool';
313
+
314
+ /**
315
+ * Ordinal position of the turn within the call, starting at 0.
316
+ */
317
+ seq: number;
318
+
319
+ /**
320
+ * Transcribed speech for `user` and `assistant` turns, or a JSON summary of the
321
+ * tool call for `tool` turns.
322
+ */
323
+ text: string;
324
+
325
+ /**
326
+ * When the turn ended.
327
+ */
328
+ endedAt?: string | null;
329
+
330
+ /**
331
+ * When the turn started.
332
+ */
333
+ startedAt?: string | null;
334
+ }
335
+ }
336
+ }
337
+
338
+ export interface CallListResponse {
339
+ id: string;
340
+
341
+ createdAt: string;
342
+
343
+ /**
344
+ * Whether the call was placed by Zavu (outbound) or received from a caller
345
+ * (inbound).
346
+ */
347
+ direction: 'inbound' | 'outbound';
348
+
349
+ /**
350
+ * Caller phone number in E.164 format. Your sender's number for outbound calls;
351
+ * the caller's number for inbound calls.
352
+ */
353
+ from: string;
354
+
355
+ /**
356
+ * Lifecycle status of a voice call.
357
+ *
358
+ * - `queued`: outbound call created, not yet dialing.
359
+ * - `ringing`: dialing (outbound) or received and ringing (inbound).
360
+ * - `in_progress`: answered, the agent is connected.
361
+ * - `completed`: ended after a conversation.
362
+ * - `failed`: could not be completed.
363
+ * - `busy`: the line was busy.
364
+ * - `no_answer`: rang but was not answered.
365
+ * - `canceled`: canceled before it was answered.
366
+ */
367
+ status: 'queued' | 'ringing' | 'in_progress' | 'completed' | 'failed' | 'busy' | 'no_answer' | 'canceled';
368
+
369
+ /**
370
+ * Callee phone number in E.164 format.
371
+ */
372
+ to: string;
373
+
374
+ /**
375
+ * When the call was answered.
376
+ */
377
+ answeredAt?: string | null;
378
+
379
+ /**
380
+ * Total cost of the call in USD, combining the managed voice pipeline per-minute
381
+ * charge and telephony. Available once the call has ended.
382
+ */
383
+ cost?: number | null;
384
+
385
+ /**
386
+ * Billable talk time in seconds, measured from answer to hangup.
387
+ */
388
+ durationSeconds?: number | null;
389
+
390
+ /**
391
+ * When the call ended.
392
+ */
393
+ endedAt?: string | null;
394
+
395
+ /**
396
+ * Why the call ended (e.g. `agent_ended`, `max_duration`, `transfer`, `hangup`).
397
+ * Present once the call is no longer active.
398
+ */
399
+ endReason?: string | null;
400
+
401
+ /**
402
+ * Arbitrary metadata you attached when creating the call.
403
+ */
404
+ metadata?: { [key: string]: string };
405
+
406
+ /**
407
+ * Ordered transcript of the call. Included when retrieving a single call; omitted
408
+ * from list responses.
409
+ */
410
+ transcript?: Array<CallListResponse.Transcript>;
411
+
412
+ /**
413
+ * Number of conversation turns exchanged during the call.
414
+ */
415
+ turnCount?: number | null;
416
+
417
+ updatedAt?: string;
418
+ }
419
+
420
+ export namespace CallListResponse {
421
+ /**
422
+ * A single turn in a voice call transcript.
423
+ */
424
+ export interface Transcript {
425
+ /**
426
+ * Who produced the turn. `tool` records a tool call the agent made during the
427
+ * conversation.
428
+ */
429
+ role: 'user' | 'assistant' | 'tool';
430
+
431
+ /**
432
+ * Ordinal position of the turn within the call, starting at 0.
433
+ */
434
+ seq: number;
435
+
436
+ /**
437
+ * Transcribed speech for `user` and `assistant` turns, or a JSON summary of the
438
+ * tool call for `tool` turns.
439
+ */
440
+ text: string;
441
+
442
+ /**
443
+ * When the turn ended.
444
+ */
445
+ endedAt?: string | null;
446
+
447
+ /**
448
+ * When the turn started.
449
+ */
450
+ startedAt?: string | null;
451
+ }
452
+ }
453
+
454
+ export interface CallHangupResponse {
455
+ call: CallHangupResponse.Call;
456
+ }
457
+
458
+ export namespace CallHangupResponse {
459
+ export interface Call {
460
+ id: string;
461
+
462
+ createdAt: string;
463
+
464
+ /**
465
+ * Whether the call was placed by Zavu (outbound) or received from a caller
466
+ * (inbound).
467
+ */
468
+ direction: 'inbound' | 'outbound';
469
+
470
+ /**
471
+ * Caller phone number in E.164 format. Your sender's number for outbound calls;
472
+ * the caller's number for inbound calls.
473
+ */
474
+ from: string;
475
+
476
+ /**
477
+ * Lifecycle status of a voice call.
478
+ *
479
+ * - `queued`: outbound call created, not yet dialing.
480
+ * - `ringing`: dialing (outbound) or received and ringing (inbound).
481
+ * - `in_progress`: answered, the agent is connected.
482
+ * - `completed`: ended after a conversation.
483
+ * - `failed`: could not be completed.
484
+ * - `busy`: the line was busy.
485
+ * - `no_answer`: rang but was not answered.
486
+ * - `canceled`: canceled before it was answered.
487
+ */
488
+ status: 'queued' | 'ringing' | 'in_progress' | 'completed' | 'failed' | 'busy' | 'no_answer' | 'canceled';
489
+
490
+ /**
491
+ * Callee phone number in E.164 format.
492
+ */
493
+ to: string;
494
+
495
+ /**
496
+ * When the call was answered.
497
+ */
498
+ answeredAt?: string | null;
499
+
500
+ /**
501
+ * Total cost of the call in USD, combining the managed voice pipeline per-minute
502
+ * charge and telephony. Available once the call has ended.
503
+ */
504
+ cost?: number | null;
505
+
506
+ /**
507
+ * Billable talk time in seconds, measured from answer to hangup.
508
+ */
509
+ durationSeconds?: number | null;
510
+
511
+ /**
512
+ * When the call ended.
513
+ */
514
+ endedAt?: string | null;
515
+
516
+ /**
517
+ * Why the call ended (e.g. `agent_ended`, `max_duration`, `transfer`, `hangup`).
518
+ * Present once the call is no longer active.
519
+ */
520
+ endReason?: string | null;
521
+
522
+ /**
523
+ * Arbitrary metadata you attached when creating the call.
524
+ */
525
+ metadata?: { [key: string]: string };
526
+
527
+ /**
528
+ * Ordered transcript of the call. Included when retrieving a single call; omitted
529
+ * from list responses.
530
+ */
531
+ transcript?: Array<Call.Transcript>;
532
+
533
+ /**
534
+ * Number of conversation turns exchanged during the call.
535
+ */
536
+ turnCount?: number | null;
537
+
538
+ updatedAt?: string;
539
+ }
540
+
541
+ export namespace Call {
542
+ /**
543
+ * A single turn in a voice call transcript.
544
+ */
545
+ export interface Transcript {
546
+ /**
547
+ * Who produced the turn. `tool` records a tool call the agent made during the
548
+ * conversation.
549
+ */
550
+ role: 'user' | 'assistant' | 'tool';
551
+
552
+ /**
553
+ * Ordinal position of the turn within the call, starting at 0.
554
+ */
555
+ seq: number;
556
+
557
+ /**
558
+ * Transcribed speech for `user` and `assistant` turns, or a JSON summary of the
559
+ * tool call for `tool` turns.
560
+ */
561
+ text: string;
562
+
563
+ /**
564
+ * When the turn ended.
565
+ */
566
+ endedAt?: string | null;
567
+
568
+ /**
569
+ * When the turn started.
570
+ */
571
+ startedAt?: string | null;
572
+ }
573
+ }
574
+ }
575
+
576
+ export interface CallCreateParams {
577
+ /**
578
+ * Recipient phone number in E.164 format.
579
+ */
580
+ to: string;
581
+
582
+ /**
583
+ * Overrides the agent's configured greeting for this call only.
584
+ */
585
+ greeting?: string;
586
+
587
+ /**
588
+ * Language the agent speaks on this call only, as a BCP-47 tag (`en`, `es`,
589
+ * `es-ES`, `pt-BR`), or `auto` to detect the caller's language and follow it.
590
+ * Overrides the agent's configured language for speech recognition, the agent's
591
+ * replies, and the synthesized voice. If the agent uses a custom voice you
592
+ * supplied, that voice is kept and only the language changes. When omitted, the
593
+ * agent's configured language is used.
594
+ */
595
+ language?: string;
596
+
597
+ /**
598
+ * Overrides the agent's maximum call duration for this call only.
599
+ */
600
+ maxDurationMinutes?: number;
601
+
602
+ /**
603
+ * Arbitrary metadata to associate with the call. Returned on the call object and
604
+ * included in voice webhooks.
605
+ */
606
+ metadata?: { [key: string]: string };
607
+
608
+ /**
609
+ * Sender profile that places the call. Uses the project's default sender if
610
+ * omitted. The sender's agent must have voice enabled.
611
+ */
612
+ senderId?: string;
613
+ }
614
+
615
+ export interface CallListParams extends CursorParams {
616
+ /**
617
+ * Whether the call was placed by Zavu (outbound) or received from a caller
618
+ * (inbound).
619
+ */
620
+ direction?: 'inbound' | 'outbound';
621
+
622
+ /**
623
+ * Lifecycle status of a voice call.
624
+ *
625
+ * - `queued`: outbound call created, not yet dialing.
626
+ * - `ringing`: dialing (outbound) or received and ringing (inbound).
627
+ * - `in_progress`: answered, the agent is connected.
628
+ * - `completed`: ended after a conversation.
629
+ * - `failed`: could not be completed.
630
+ * - `busy`: the line was busy.
631
+ * - `no_answer`: rang but was not answered.
632
+ * - `canceled`: canceled before it was answered.
633
+ */
634
+ status?: 'queued' | 'ringing' | 'in_progress' | 'completed' | 'failed' | 'busy' | 'no_answer' | 'canceled';
635
+ }
636
+
637
+ export declare namespace Calls {
638
+ export {
639
+ type CallCreateResponse as CallCreateResponse,
640
+ type CallRetrieveResponse as CallRetrieveResponse,
641
+ type CallListResponse as CallListResponse,
642
+ type CallHangupResponse as CallHangupResponse,
643
+ type CallListResponsesCursor as CallListResponsesCursor,
644
+ type CallCreateParams as CallCreateParams,
645
+ type CallListParams as CallListParams,
646
+ };
647
+ }