@zavudev/sdk 0.50.0 → 0.52.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 (87) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/package.json +1 -1
  3. package/resources/functions/functions.d.mts +22 -8
  4. package/resources/functions/functions.d.mts.map +1 -1
  5. package/resources/functions/functions.d.ts +22 -8
  6. package/resources/functions/functions.d.ts.map +1 -1
  7. package/resources/functions/functions.js +6 -4
  8. package/resources/functions/functions.js.map +1 -1
  9. package/resources/functions/functions.mjs +6 -4
  10. package/resources/functions/functions.mjs.map +1 -1
  11. package/resources/invitations.d.mts +84 -23
  12. package/resources/invitations.d.mts.map +1 -1
  13. package/resources/invitations.d.ts +84 -23
  14. package/resources/invitations.d.ts.map +1 -1
  15. package/resources/invitations.js +13 -10
  16. package/resources/invitations.js.map +1 -1
  17. package/resources/invitations.mjs +13 -10
  18. package/resources/invitations.mjs.map +1 -1
  19. package/resources/messages.d.mts +66 -20
  20. package/resources/messages.d.mts.map +1 -1
  21. package/resources/messages.d.ts +66 -20
  22. package/resources/messages.d.ts.map +1 -1
  23. package/resources/messages.js +23 -3
  24. package/resources/messages.js.map +1 -1
  25. package/resources/messages.mjs +23 -3
  26. package/resources/messages.mjs.map +1 -1
  27. package/resources/number-10dlc/brands.d.mts +5 -1
  28. package/resources/number-10dlc/brands.d.mts.map +1 -1
  29. package/resources/number-10dlc/brands.d.ts +5 -1
  30. package/resources/number-10dlc/brands.d.ts.map +1 -1
  31. package/resources/number-10dlc/brands.js +5 -1
  32. package/resources/number-10dlc/brands.js.map +1 -1
  33. package/resources/number-10dlc/brands.mjs +5 -1
  34. package/resources/number-10dlc/brands.mjs.map +1 -1
  35. package/resources/number-10dlc/campaigns/campaigns.d.mts +6 -1
  36. package/resources/number-10dlc/campaigns/campaigns.d.mts.map +1 -1
  37. package/resources/number-10dlc/campaigns/campaigns.d.ts +6 -1
  38. package/resources/number-10dlc/campaigns/campaigns.d.ts.map +1 -1
  39. package/resources/number-10dlc/campaigns/campaigns.js +6 -1
  40. package/resources/number-10dlc/campaigns/campaigns.js.map +1 -1
  41. package/resources/number-10dlc/campaigns/campaigns.mjs +6 -1
  42. package/resources/number-10dlc/campaigns/campaigns.mjs.map +1 -1
  43. package/resources/phone-numbers.d.mts +5 -0
  44. package/resources/phone-numbers.d.mts.map +1 -1
  45. package/resources/phone-numbers.d.ts +5 -0
  46. package/resources/phone-numbers.d.ts.map +1 -1
  47. package/resources/senders/agent/agent.d.mts +307 -0
  48. package/resources/senders/agent/agent.d.mts.map +1 -1
  49. package/resources/senders/agent/agent.d.ts +307 -0
  50. package/resources/senders/agent/agent.d.ts.map +1 -1
  51. package/resources/senders/agent/agent.js +6 -0
  52. package/resources/senders/agent/agent.js.map +1 -1
  53. package/resources/senders/agent/agent.mjs +6 -0
  54. package/resources/senders/agent/agent.mjs.map +1 -1
  55. package/resources/senders/agent/executions.d.mts +5 -0
  56. package/resources/senders/agent/executions.d.mts.map +1 -1
  57. package/resources/senders/agent/executions.d.ts +5 -0
  58. package/resources/senders/agent/executions.d.ts.map +1 -1
  59. package/resources/senders/agent/executions.js +5 -0
  60. package/resources/senders/agent/executions.js.map +1 -1
  61. package/resources/senders/agent/executions.mjs +5 -0
  62. package/resources/senders/agent/executions.mjs.map +1 -1
  63. package/resources/senders/senders.d.mts +71 -21
  64. package/resources/senders/senders.d.mts.map +1 -1
  65. package/resources/senders/senders.d.ts +71 -21
  66. package/resources/senders/senders.d.ts.map +1 -1
  67. package/resources/senders/senders.js.map +1 -1
  68. package/resources/senders/senders.mjs.map +1 -1
  69. package/resources/templates.d.mts +12 -3
  70. package/resources/templates.d.mts.map +1 -1
  71. package/resources/templates.d.ts +12 -3
  72. package/resources/templates.d.ts.map +1 -1
  73. package/src/resources/functions/functions.ts +23 -8
  74. package/src/resources/invitations.ts +90 -23
  75. package/src/resources/messages.ts +67 -19
  76. package/src/resources/number-10dlc/brands.ts +5 -1
  77. package/src/resources/number-10dlc/campaigns/campaigns.ts +6 -1
  78. package/src/resources/phone-numbers.ts +6 -0
  79. package/src/resources/senders/agent/agent.ts +357 -0
  80. package/src/resources/senders/agent/executions.ts +5 -0
  81. package/src/resources/senders/senders.ts +78 -21
  82. package/src/resources/templates.ts +13 -4
  83. package/src/version.ts +1 -1
  84. package/version.d.mts +1 -1
  85. package/version.d.ts +1 -1
  86. package/version.js +1 -1
  87. package/version.mjs +1 -1
@@ -138,6 +138,12 @@ export class AgentResource extends APIResource {
138
138
  /**
139
139
  * Get statistics for an AI agent including invocations, tokens, and costs.
140
140
  *
141
+ * Covers the messaging channels only. Voice calls are not counted here: a call is
142
+ * a multi-turn conversation rather than one inbound message and one reply, so it
143
+ * is recorded as a call, not an execution. An agent that only answers phone calls
144
+ * reports zeros on every field. Use `GET /v1/calls` for voice activity, duration,
145
+ * and cost.
146
+ *
141
147
  * @example
142
148
  * ```ts
143
149
  * const agentStats = await client.senders.agent.stats(
@@ -201,6 +207,12 @@ export interface Agent {
201
207
  */
202
208
  maxTokens?: number | null;
203
209
 
210
+ /**
211
+ * Senders this agent answers on. An agent can serve several; `senderId` remains
212
+ * the primary one, for compatibility.
213
+ */
214
+ senderIds?: Array<string>;
215
+
204
216
  stats?: Agent.Stats;
205
217
 
206
218
  /**
@@ -217,6 +229,13 @@ export interface Agent {
217
229
  * Message types that trigger the agent.
218
230
  */
219
231
  triggerOnMessageTypes?: Array<string>;
232
+
233
+ /**
234
+ * Voice Agent configuration. When present and enabled, the agent can answer
235
+ * inbound phone calls and place outbound calls with Zavu's managed voice pipeline.
236
+ * Requires the Voice Agents feature to be enabled for your team.
237
+ */
238
+ voice?: Agent.Voice;
220
239
  }
221
240
 
222
241
  export namespace Agent {
@@ -230,6 +249,110 @@ export namespace Agent {
230
249
 
231
250
  totalTokensUsed?: number;
232
251
  }
252
+
253
+ /**
254
+ * Voice Agent configuration. When present and enabled, the agent can answer
255
+ * inbound phone calls and place outbound calls with Zavu's managed voice pipeline.
256
+ * Requires the Voice Agents feature to be enabled for your team.
257
+ */
258
+ export interface Voice {
259
+ /**
260
+ * Whether the agent handles voice calls. When false, the sender's number is not
261
+ * answered by the voice agent and outbound calls are rejected.
262
+ */
263
+ enabled: boolean;
264
+
265
+ /**
266
+ * Opening line the agent speaks when the call connects. If omitted, the agent
267
+ * waits for the caller to speak first.
268
+ */
269
+ greeting?: string;
270
+
271
+ /**
272
+ * Greeting per language, keyed by language code. Used when the caller's language
273
+ * differs from the one `greeting` is written in.
274
+ */
275
+ greetings?: { [key: string]: string };
276
+
277
+ /**
278
+ * Whether the caller can interrupt the agent while it is speaking (barge-in). When
279
+ * true, the agent stops talking as soon as the caller starts.
280
+ */
281
+ interruptible?: boolean;
282
+
283
+ /**
284
+ * BCP-47 language code used for both speech recognition and speech synthesis (e.g.
285
+ * `en`, `es`, `pt-BR`). Auto-detected from the recipient when omitted.
286
+ */
287
+ language?: string;
288
+
289
+ /**
290
+ * Hard limit on call length in minutes. The call ends automatically when reached.
291
+ */
292
+ maxCallDurationMinutes?: number;
293
+
294
+ /**
295
+ * How long the agent waits during silence before ending the call.
296
+ */
297
+ maxIdleSeconds?: number;
298
+
299
+ /**
300
+ * Model that runs the conversation, co-located in the voice network for lowest
301
+ * latency. Independent of the model used for text messaging. Derived from the
302
+ * agent's text model when omitted.
303
+ */
304
+ model?: string;
305
+
306
+ /**
307
+ * Whether the call audio is recorded.
308
+ */
309
+ recordCalls?: boolean;
310
+
311
+ /**
312
+ * Speech-recognition model. Uses the default when omitted.
313
+ */
314
+ sttModel?: string;
315
+
316
+ /**
317
+ * Speech-recognition provider. Uses the default when omitted.
318
+ */
319
+ sttProvider?: string;
320
+
321
+ /**
322
+ * E.164 phone number the agent can transfer the call to. When set, the agent is
323
+ * given a transfer tool it can use to hand the call to a human.
324
+ */
325
+ transferPhoneNumber?: string;
326
+
327
+ /**
328
+ * Speech-synthesis provider. Uses the default when omitted.
329
+ */
330
+ ttsProvider?: string;
331
+
332
+ /**
333
+ * Identifier of the synthesized voice that speaks. Choose from the voices
334
+ * available in the dashboard. Uses a neutral default when omitted.
335
+ */
336
+ ttsVoiceId?: string;
337
+
338
+ /**
339
+ * What the agent does when an answering machine or voicemail is detected on an
340
+ * outbound call.
341
+ */
342
+ voicemailAction?: 'hangup' | 'leave_message';
343
+
344
+ /**
345
+ * Message spoken when `voicemailAction` is `leave_message`. Falls back to
346
+ * `greeting` when omitted.
347
+ */
348
+ voicemailMessage?: string;
349
+
350
+ /**
351
+ * Speech rate. 1.0 is natural. Only honoured by voices that support rate control;
352
+ * ignored by the others.
353
+ */
354
+ voiceSpeed?: number;
355
+ }
233
356
  }
234
357
 
235
358
  export interface AgentExecution {
@@ -259,6 +382,14 @@ export interface AgentExecution {
259
382
 
260
383
  inboundMessageId?: string;
261
384
 
385
+ /**
386
+ * Knowledge-base chunks retrieved for this answer. Zero on an agent that has
387
+ * documents attached means the reply was not grounded in them, which is otherwise
388
+ * indistinguishable from a correct answer in this record. Absent on executions
389
+ * recorded before this field existed, which is not the same as zero.
390
+ */
391
+ knowledgeChunksUsed?: number | null;
392
+
262
393
  responseMessageId?: string | null;
263
394
 
264
395
  responseText?: string | null;
@@ -326,6 +457,119 @@ export interface AgentCreateParams {
326
457
  triggerOnChannels?: Array<string>;
327
458
 
328
459
  triggerOnMessageTypes?: Array<string>;
460
+
461
+ /**
462
+ * Voice Agent configuration. Enable this to let the agent answer and place phone
463
+ * calls with Zavu's managed voice pipeline. Requires the Voice Agents feature to
464
+ * be enabled for your team.
465
+ */
466
+ voice?: AgentCreateParams.Voice;
467
+ }
468
+
469
+ export namespace AgentCreateParams {
470
+ /**
471
+ * Voice Agent configuration. Enable this to let the agent answer and place phone
472
+ * calls with Zavu's managed voice pipeline. Requires the Voice Agents feature to
473
+ * be enabled for your team.
474
+ */
475
+ export interface Voice {
476
+ /**
477
+ * Whether the agent handles voice calls. When false, the sender's number is not
478
+ * answered by the voice agent and outbound calls are rejected.
479
+ */
480
+ enabled: boolean;
481
+
482
+ /**
483
+ * Opening line the agent speaks when the call connects. If omitted, the agent
484
+ * waits for the caller to speak first.
485
+ */
486
+ greeting?: string;
487
+
488
+ /**
489
+ * Greeting per language, keyed by language code. Used when the caller's language
490
+ * differs from the one `greeting` is written in.
491
+ */
492
+ greetings?: { [key: string]: string };
493
+
494
+ /**
495
+ * Whether the caller can interrupt the agent while it is speaking (barge-in). When
496
+ * true, the agent stops talking as soon as the caller starts.
497
+ */
498
+ interruptible?: boolean;
499
+
500
+ /**
501
+ * BCP-47 language code used for both speech recognition and speech synthesis (e.g.
502
+ * `en`, `es`, `pt-BR`). Auto-detected from the recipient when omitted.
503
+ */
504
+ language?: string;
505
+
506
+ /**
507
+ * Hard limit on call length in minutes. The call ends automatically when reached.
508
+ */
509
+ maxCallDurationMinutes?: number;
510
+
511
+ /**
512
+ * How long the agent waits during silence before ending the call.
513
+ */
514
+ maxIdleSeconds?: number;
515
+
516
+ /**
517
+ * Model that runs the conversation, co-located in the voice network for lowest
518
+ * latency. Independent of the model used for text messaging. Derived from the
519
+ * agent's text model when omitted.
520
+ */
521
+ model?: string;
522
+
523
+ /**
524
+ * Whether the call audio is recorded.
525
+ */
526
+ recordCalls?: boolean;
527
+
528
+ /**
529
+ * Speech-recognition model. Uses the default when omitted.
530
+ */
531
+ sttModel?: string;
532
+
533
+ /**
534
+ * Speech-recognition provider. Uses the default when omitted.
535
+ */
536
+ sttProvider?: string;
537
+
538
+ /**
539
+ * E.164 phone number the agent can transfer the call to. When set, the agent is
540
+ * given a transfer tool it can use to hand the call to a human.
541
+ */
542
+ transferPhoneNumber?: string;
543
+
544
+ /**
545
+ * Speech-synthesis provider. Uses the default when omitted.
546
+ */
547
+ ttsProvider?: string;
548
+
549
+ /**
550
+ * Identifier of the synthesized voice that speaks. Choose from the voices
551
+ * available in the dashboard. Uses a neutral default when omitted.
552
+ */
553
+ ttsVoiceId?: string;
554
+
555
+ /**
556
+ * What the agent does when an answering machine or voicemail is detected on an
557
+ * outbound call.
558
+ */
559
+ voicemailAction?: 'hangup' | 'leave_message';
560
+
561
+ /**
562
+ * Message spoken when `voicemailAction` is `leave_message`. Falls back to
563
+ * `greeting` when omitted.
564
+ */
565
+ voicemailMessage?: string;
566
+
567
+ /**
568
+ * Speech rate. 1.0 is natural. Only honoured by voices that support rate control;
569
+ * ignored by the others.
570
+ */
571
+ voiceSpeed?: number;
572
+ }
329
573
  }
330
574
 
331
575
  export interface AgentUpdateParams {
@@ -355,6 +599,119 @@ export interface AgentUpdateParams {
355
599
  triggerOnChannels?: Array<string>;
356
600
 
357
601
  triggerOnMessageTypes?: Array<string>;
602
+
603
+ /**
604
+ * Voice Agent configuration. Patch this object to enable voice, change the
605
+ * greeting, or adjust call limits. Requires the Voice Agents feature to be enabled
606
+ * for your team.
607
+ */
608
+ voice?: AgentUpdateParams.Voice;
609
+ }
610
+
611
+ export namespace AgentUpdateParams {
612
+ /**
613
+ * Voice Agent configuration. Patch this object to enable voice, change the
614
+ * greeting, or adjust call limits. Requires the Voice Agents feature to be enabled
615
+ * for your team.
616
+ */
617
+ export interface Voice {
618
+ /**
619
+ * Whether the agent handles voice calls. When false, the sender's number is not
620
+ * answered by the voice agent and outbound calls are rejected.
621
+ */
622
+ enabled: boolean;
623
+
624
+ /**
625
+ * Opening line the agent speaks when the call connects. If omitted, the agent
626
+ * waits for the caller to speak first.
627
+ */
628
+ greeting?: string;
629
+
630
+ /**
631
+ * Greeting per language, keyed by language code. Used when the caller's language
632
+ * differs from the one `greeting` is written in.
633
+ */
634
+ greetings?: { [key: string]: string };
635
+
636
+ /**
637
+ * Whether the caller can interrupt the agent while it is speaking (barge-in). When
638
+ * true, the agent stops talking as soon as the caller starts.
639
+ */
640
+ interruptible?: boolean;
641
+
642
+ /**
643
+ * BCP-47 language code used for both speech recognition and speech synthesis (e.g.
644
+ * `en`, `es`, `pt-BR`). Auto-detected from the recipient when omitted.
645
+ */
646
+ language?: string;
647
+
648
+ /**
649
+ * Hard limit on call length in minutes. The call ends automatically when reached.
650
+ */
651
+ maxCallDurationMinutes?: number;
652
+
653
+ /**
654
+ * How long the agent waits during silence before ending the call.
655
+ */
656
+ maxIdleSeconds?: number;
657
+
658
+ /**
659
+ * Model that runs the conversation, co-located in the voice network for lowest
660
+ * latency. Independent of the model used for text messaging. Derived from the
661
+ * agent's text model when omitted.
662
+ */
663
+ model?: string;
664
+
665
+ /**
666
+ * Whether the call audio is recorded.
667
+ */
668
+ recordCalls?: boolean;
669
+
670
+ /**
671
+ * Speech-recognition model. Uses the default when omitted.
672
+ */
673
+ sttModel?: string;
674
+
675
+ /**
676
+ * Speech-recognition provider. Uses the default when omitted.
677
+ */
678
+ sttProvider?: string;
679
+
680
+ /**
681
+ * E.164 phone number the agent can transfer the call to. When set, the agent is
682
+ * given a transfer tool it can use to hand the call to a human.
683
+ */
684
+ transferPhoneNumber?: string;
685
+
686
+ /**
687
+ * Speech-synthesis provider. Uses the default when omitted.
688
+ */
689
+ ttsProvider?: string;
690
+
691
+ /**
692
+ * Identifier of the synthesized voice that speaks. Choose from the voices
693
+ * available in the dashboard. Uses a neutral default when omitted.
694
+ */
695
+ ttsVoiceId?: string;
696
+
697
+ /**
698
+ * What the agent does when an answering machine or voicemail is detected on an
699
+ * outbound call.
700
+ */
701
+ voicemailAction?: 'hangup' | 'leave_message';
702
+
703
+ /**
704
+ * Message spoken when `voicemailAction` is `leave_message`. Falls back to
705
+ * `greeting` when omitted.
706
+ */
707
+ voicemailMessage?: string;
708
+
709
+ /**
710
+ * Speech rate. 1.0 is natural. Only honoured by voices that support rate control;
711
+ * ignored by the others.
712
+ */
713
+ voiceSpeed?: number;
714
+ }
358
715
  }
359
716
 
360
717
  AgentResource.Executions = Executions;
@@ -34,6 +34,11 @@ export class Executions extends APIResource {
34
34
  /**
35
35
  * List recent agent executions with pagination.
36
36
  *
37
+ * An execution is one inbound message answered by the agent, so this covers the
38
+ * messaging channels only. Voice calls are never listed here regardless of how
39
+ * many the agent handled. Use `GET /v1/calls` (and `GET /v1/calls/{callId}` for
40
+ * the transcript) for voice.
41
+ *
37
42
  * @example
38
43
  * ```ts
39
44
  * // Automatically fetches more pages as needed.
@@ -195,6 +195,14 @@ export interface Sender {
195
195
  */
196
196
  phoneNumber: string;
197
197
 
198
+ /**
199
+ * Channels this sender can actually send on right now, computed from its
200
+ * configuration. Empty means the sender cannot send or receive anything yet: a
201
+ * phoneNumber alone does not enable SMS or voice. Check this rather than inferring
202
+ * capability from phoneNumber or emailAddress.
203
+ */
204
+ channels?: Array<string>;
205
+
198
206
  createdAt?: string;
199
207
 
200
208
  /**
@@ -320,22 +328,21 @@ export interface SenderWebhook {
320
328
  *
321
329
  * **Inbound events:**
322
330
  *
323
- * - `message.inbound`: New message received from a contact. Reactions are
324
- * delivered as `message.inbound` with `messageType='reaction'`. When the contact
325
- * replied to (quoted) an earlier message, `data.content` carries the reply
326
- * context: `replyToMessageId`, `replyToProviderMessageId`, `replyToFrom`,
327
- * `replyToText`, and `replyToMessageType`. `data.providerTimestamp` is the
328
- * provider's original receive time in Unix milliseconds (the moment the channel
329
- * received the message from the contact — WhatsApp, Telegram, Instagram,
330
- * Messenger; `null` for SMS and email). Compare it against the top-level
331
- * `timestamp` (when Zavu dispatched the webhook) to detect and ignore delayed
332
- * deliveries.
333
- * - `message.status`: A contact posted a WhatsApp status/story (currently WhatsApp
334
- * Alternative only). It is NOT a conversation message and never enters the inbox
335
- * — it is delivered only if you subscribe to `message.status`. `data` carries
336
- * `from` (the author in E.164), `messageType` (`text`, `image`, `video`,
337
- * `audio`), `text` (caption/text when present), `mimetype` (for media stories),
338
- * and `providerTimestamp`. Media bytes are not included.
331
+ * - `message.inbound`: New message received from a contact. `data.conversationId`
332
+ * is the inbox thread id (deep-link with
333
+ * `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`); it is
334
+ * `null` while the conversation row is still being created (the first message of
335
+ * a brand-new thread, or several near-simultaneous first messages), where
336
+ * `conversation.new` carries the id instead — `GET /v1/messages/{messageId}`
337
+ * always has it. Reactions are delivered as `message.inbound` with
338
+ * `messageType='reaction'`. When the contact replied to (quoted) an earlier
339
+ * message, `data.content` carries the reply context: `replyToMessageId`,
340
+ * `replyToProviderMessageId`, `replyToFrom`, `replyToText`, and
341
+ * `replyToMessageType`. `data.providerTimestamp` is the provider's original
342
+ * receive time in Unix milliseconds (the moment the channel received the message
343
+ * from the contact — WhatsApp, Telegram, Instagram, Messenger; `null` for SMS
344
+ * and email). Compare it against the top-level `timestamp` (when Zavu dispatched
345
+ * the webhook) to detect and ignore delayed deliveries.
339
346
  * - `message.unsupported`: Received a message type that is not supported
340
347
  *
341
348
  * **Broadcast events:**
@@ -345,13 +352,42 @@ export interface SenderWebhook {
345
352
  *
346
353
  * **Other events:**
347
354
  *
348
- * - `conversation.new`: New conversation started with a contact
355
+ * - `conversation.new`: New conversation started with a contact. `data` carries
356
+ * `conversationId` (the inbox thread id — deep-link with
357
+ * `https://dashboard.zavu.dev/{locale}/inbox?conv={conversationId}`), the
358
+ * `phoneNumber` or `email` key, `channel`, `firstMessageId`, `firstMessageText`,
359
+ * and `profileName`.
349
360
  * - `template.status_changed`: WhatsApp template approval status changed
350
361
  *
351
362
  * **Partner events:**
352
363
  *
353
364
  * - `invitation.status_changed`: A partner invitation status changed (pending,
354
- * in_progress, completed, cancelled)
365
+ * in_progress, completed, cancelled, failed). `data` carries `invitationId`,
366
+ * `clientName`, `clientEmail`, `connectionType` (`whatsapp_waba` or
367
+ * `messenger`), `previousStatus`, and `currentStatus`. On `completed` it also
368
+ * carries `senderId` and `connectedAccount` (`channel`, `id`, `name`) — the
369
+ * WhatsApp number or Facebook Page that was linked. On `failed` it carries
370
+ * `failureReason`; the invitation link stays usable, so a client can retry it.
371
+ *
372
+ * **Voice Agent events:** For every voice event, `data` carries `callId`,
373
+ * `direction`, `from`, `to`, `status`, `durationSeconds`, `endReason`, and
374
+ * `transcriptAvailable`. The terminal events (`call.completed`, `call.failed`)
375
+ * additionally carry `cost` — what the call was billed, in USD, combining
376
+ * telephony and the managed voice pipeline — and `currency`. They are dispatched
377
+ * after the call is charged, so `cost` is populated rather than zero; telephony
378
+ * can still be settling on an outbound call, in which case
379
+ * `GET /v1/calls/{callId}` holds the reconciled figure.
380
+ *
381
+ * - `call.initiated`: An outbound call was created and is dialing, or an inbound
382
+ * call was received. `data.status` = `ringing`
383
+ * - `call.answered`: The call was answered and the voice agent is connected.
384
+ * `data.status` = `in_progress`
385
+ * - `call.completed`: The call ended after a conversation. `data.status` =
386
+ * `completed`; `durationSeconds` and `endReason` describe how it ended, and
387
+ * `transcriptAvailable` indicates whether a transcript can be fetched.
388
+ * - `call.failed`: The call could not be completed (busy, no answer, canceled, or
389
+ * an error). `data.status` is the terminal status and `endReason` explains the
390
+ * cause.
355
391
  *
356
392
  * **Custom domain events:**
357
393
  *
@@ -365,14 +401,18 @@ export type WebhookEvent =
365
401
  | 'message.sent'
366
402
  | 'message.delivered'
367
403
  | 'message.read'
404
+ | 'message.status'
368
405
  | 'message.failed'
369
406
  | 'message.inbound'
370
- | 'message.status'
371
407
  | 'message.unsupported'
372
408
  | 'broadcast.status_changed'
373
409
  | 'conversation.new'
374
410
  | 'template.status_changed'
375
411
  | 'invitation.status_changed'
412
+ | 'call.initiated'
413
+ | 'call.answered'
414
+ | 'call.completed'
415
+ | 'call.failed'
376
416
  | 'domain.verified'
377
417
  | 'domain.failed';
378
418
 
@@ -500,8 +540,18 @@ export interface SenderCreateParams {
500
540
  emailReceivingEnabled?: boolean;
501
541
 
502
542
  /**
503
- * Phone number in E.164 format. Required for phone-based channels (SMS, WhatsApp).
504
- * Omit for an email-only sender.
543
+ * Let this sender place and answer phone calls. Requires `phoneNumber`; enabling
544
+ * it without one returns 400. Check the `channels` array on the response to
545
+ * confirm `voice` is on.
546
+ */
547
+ enableVoice?: boolean;
548
+
549
+ /**
550
+ * Phone number in E.164 format, and it must be a number your project already owns
551
+ * (see `GET /v1/phone-numbers`). The number is routed to the sender as part of
552
+ * this call, which is what turns the SMS channel on. Passing a number the project
553
+ * does not own, or one already attached to another sender, returns 400 rather than
554
+ * creating a sender that cannot send. Omit for an email-only sender.
505
555
  */
506
556
  phoneNumber?: string;
507
557
 
@@ -548,6 +598,13 @@ export interface SenderUpdateParams {
548
598
  */
549
599
  emailReceivingEnabled?: boolean;
550
600
 
601
+ /**
602
+ * Turn the voice channel on or off. The sender must already have a phone number
603
+ * provisioned for calls; enabling it otherwise returns 400 instead of storing a
604
+ * flag that changes nothing. Confirm with the `channels` array on the response.
605
+ */
606
+ enableVoice?: boolean;
607
+
551
608
  name?: string;
552
609
 
553
610
  setAsDefault?: boolean;
@@ -210,7 +210,7 @@ export namespace Template {
210
210
 
211
211
  text?: string;
212
212
 
213
- type?: 'quick_reply' | 'url' | 'phone' | 'otp';
213
+ type?: 'quick_reply' | 'url' | 'phone' | 'otp' | 'request_contact_info';
214
214
 
215
215
  url?: string;
216
216
  }
@@ -306,9 +306,12 @@ export interface TemplateCreateParams {
306
306
 
307
307
  export namespace TemplateCreateParams {
308
308
  export interface Button {
309
- text: string;
310
-
311
- type: 'quick_reply' | 'url' | 'phone' | 'otp';
309
+ /**
310
+ * `request_contact_info` renders a fixed **Share Contact Info** button that asks
311
+ * the recipient to share their phone number — useful when a contact adopted a
312
+ * WhatsApp username and you only know their BSUID. It takes no other fields.
313
+ */
314
+ type: 'quick_reply' | 'url' | 'phone' | 'otp' | 'request_contact_info';
312
315
 
313
316
  /**
314
317
  * Sample value Meta uses to review templates with a dynamic URL button.
@@ -335,6 +338,12 @@ export namespace TemplateCreateParams {
335
338
  */
336
339
  signatureHash?: string;
337
340
 
341
+ /**
342
+ * Button label. Required for every type except `request_contact_info`, whose label
343
+ * is fixed by WhatsApp.
344
+ */
345
+ text?: string;
346
+
338
347
  /**
339
348
  * Button destination. Use `{{1}}` exactly once for a dynamic URL (e.g.
340
349
  * `https://example.com/orders/{{1}}`); WhatsApp only accepts the strict `{{1}}`
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.50.0'; // x-release-please-version
1
+ export const VERSION = '0.52.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.50.0";
1
+ export declare const VERSION = "0.52.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.50.0";
1
+ export declare const VERSION = "0.52.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.50.0'; // x-release-please-version
4
+ exports.VERSION = '0.52.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.50.0'; // x-release-please-version
1
+ export const VERSION = '0.52.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map