@sentdm/sentdm 0.46.0 → 0.47.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 (113) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.d.mts +3 -1
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -1
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/core/pagination.d.mts +25 -0
  9. package/core/pagination.d.mts.map +1 -1
  10. package/core/pagination.d.ts +25 -0
  11. package/core/pagination.d.ts.map +1 -1
  12. package/core/pagination.js +28 -1
  13. package/core/pagination.js.map +1 -1
  14. package/core/pagination.mjs +26 -0
  15. package/core/pagination.mjs.map +1 -1
  16. package/package.json +1 -1
  17. package/resources/channels/voice.d.mts +68 -19
  18. package/resources/channels/voice.d.mts.map +1 -1
  19. package/resources/channels/voice.d.ts +68 -19
  20. package/resources/channels/voice.d.ts.map +1 -1
  21. package/resources/channels/voice.js +31 -12
  22. package/resources/channels/voice.js.map +1 -1
  23. package/resources/channels/voice.mjs +31 -12
  24. package/resources/channels/voice.mjs.map +1 -1
  25. package/resources/profiles/campaigns.d.mts +3 -2
  26. package/resources/profiles/campaigns.d.mts.map +1 -1
  27. package/resources/profiles/campaigns.d.ts +3 -2
  28. package/resources/profiles/campaigns.d.ts.map +1 -1
  29. package/resources/profiles/campaigns.js +3 -2
  30. package/resources/profiles/campaigns.js.map +1 -1
  31. package/resources/profiles/campaigns.mjs +3 -2
  32. package/resources/profiles/campaigns.mjs.map +1 -1
  33. package/resources/voice/agents.d.mts +524 -0
  34. package/resources/voice/agents.d.mts.map +1 -0
  35. package/resources/voice/agents.d.ts +524 -0
  36. package/resources/voice/agents.d.ts.map +1 -0
  37. package/resources/voice/agents.js +193 -0
  38. package/resources/voice/agents.js.map +1 -0
  39. package/resources/voice/agents.mjs +189 -0
  40. package/resources/voice/agents.mjs.map +1 -0
  41. package/resources/voice/calls/calls.d.mts +87 -15
  42. package/resources/voice/calls/calls.d.mts.map +1 -1
  43. package/resources/voice/calls/calls.d.ts +87 -15
  44. package/resources/voice/calls/calls.d.ts.map +1 -1
  45. package/resources/voice/calls/calls.js +18 -11
  46. package/resources/voice/calls/calls.js.map +1 -1
  47. package/resources/voice/calls/calls.mjs +18 -11
  48. package/resources/voice/calls/calls.mjs.map +1 -1
  49. package/resources/voice/calls/participants.d.mts +2 -0
  50. package/resources/voice/calls/participants.d.mts.map +1 -1
  51. package/resources/voice/calls/participants.d.ts +2 -0
  52. package/resources/voice/calls/participants.d.ts.map +1 -1
  53. package/resources/voice/calls/participants.js +2 -0
  54. package/resources/voice/calls/participants.js.map +1 -1
  55. package/resources/voice/calls/participants.mjs +2 -0
  56. package/resources/voice/calls/participants.mjs.map +1 -1
  57. package/resources/voice/catalogue.d.mts +86 -0
  58. package/resources/voice/catalogue.d.mts.map +1 -0
  59. package/resources/voice/catalogue.d.ts +86 -0
  60. package/resources/voice/catalogue.d.ts.map +1 -0
  61. package/resources/voice/catalogue.js +40 -0
  62. package/resources/voice/catalogue.js.map +1 -0
  63. package/resources/voice/catalogue.mjs +36 -0
  64. package/resources/voice/catalogue.mjs.map +1 -0
  65. package/resources/voice/index.d.mts +2 -0
  66. package/resources/voice/index.d.mts.map +1 -1
  67. package/resources/voice/index.d.ts +2 -0
  68. package/resources/voice/index.d.ts.map +1 -1
  69. package/resources/voice/index.js +5 -1
  70. package/resources/voice/index.js.map +1 -1
  71. package/resources/voice/index.mjs +2 -0
  72. package/resources/voice/index.mjs.map +1 -1
  73. package/resources/voice/tokens.d.mts +2 -0
  74. package/resources/voice/tokens.d.mts.map +1 -1
  75. package/resources/voice/tokens.d.ts +2 -0
  76. package/resources/voice/tokens.d.ts.map +1 -1
  77. package/resources/voice/tokens.js +2 -0
  78. package/resources/voice/tokens.js.map +1 -1
  79. package/resources/voice/tokens.mjs +2 -0
  80. package/resources/voice/tokens.mjs.map +1 -1
  81. package/resources/voice/voice.d.mts +8 -0
  82. package/resources/voice/voice.d.mts.map +1 -1
  83. package/resources/voice/voice.d.ts +8 -0
  84. package/resources/voice/voice.d.ts.map +1 -1
  85. package/resources/voice/voice.js +8 -0
  86. package/resources/voice/voice.js.map +1 -1
  87. package/resources/voice/voice.mjs +8 -0
  88. package/resources/voice/voice.mjs.map +1 -1
  89. package/resources/webhooks.d.mts +151 -29
  90. package/resources/webhooks.d.mts.map +1 -1
  91. package/resources/webhooks.d.ts +151 -29
  92. package/resources/webhooks.d.ts.map +1 -1
  93. package/resources/webhooks.js +51 -11
  94. package/resources/webhooks.js.map +1 -1
  95. package/resources/webhooks.mjs +51 -11
  96. package/resources/webhooks.mjs.map +1 -1
  97. package/src/client.ts +8 -0
  98. package/src/core/pagination.ts +64 -0
  99. package/src/resources/channels/voice.ts +72 -19
  100. package/src/resources/profiles/campaigns.ts +3 -2
  101. package/src/resources/voice/agents.ts +729 -0
  102. package/src/resources/voice/calls/calls.ts +98 -15
  103. package/src/resources/voice/calls/participants.ts +2 -0
  104. package/src/resources/voice/catalogue.ts +118 -0
  105. package/src/resources/voice/index.ts +33 -0
  106. package/src/resources/voice/tokens.ts +2 -0
  107. package/src/resources/voice/voice.ts +74 -0
  108. package/src/resources/webhooks.ts +159 -29
  109. package/src/version.ts +1 -1
  110. package/version.d.mts +1 -1
  111. package/version.d.ts +1 -1
  112. package/version.js +1 -1
  113. package/version.mjs +1 -1
@@ -23,11 +23,29 @@ import { path } from '../internal/utils/path';
23
23
  */
24
24
  export class Webhooks extends APIResource {
25
25
  /**
26
- * Creates a new webhook endpoint for the authenticated customer.
26
+ * Creates a new webhook endpoint for the authenticated customer. A webhook is
27
+ * version 2 unless the request sets webhook_version to 1: Svix delivers it, signed
28
+ * with the webhook-id, webhook-timestamp and webhook-signature headers, and
29
+ * retries it on its own schedule, so retry_count and timeout_seconds apply to
30
+ * version 1 only. sender_profile applies to version 1 only and is ignored on
31
+ * version 2; is_inheritable applies to version 2 only. A version 1 webhook's
32
+ * response returns its sender_profile selection, with an empty event_types when it
33
+ * is not cloned onto sender profiles; a version 2 webhook's response leaves
34
+ * sender_profile out.
27
35
  *
28
36
  * @example
29
37
  * ```ts
30
- * const apiResponseWebhook = await client.webhooks.create();
38
+ * const apiResponseWebhook = await client.webhooks.create({
39
+ * display_name: 'Order Notifications',
40
+ * endpoint_url: 'https://example.com/webhooks/orders',
41
+ * event_filters: {
42
+ * message: ['delivered', 'failed'],
43
+ * templates: ['approved', 'rejected'],
44
+ * },
45
+ * event_types: ['contact', 'message', 'templates'],
46
+ * retry_count: 3,
47
+ * timeout_seconds: 30,
48
+ * });
31
49
  * ```
32
50
  */
33
51
  create(params: WebhookCreateParams, options?: RequestOptions): APIPromise<APIResponseWebhook> {
@@ -46,7 +64,8 @@ export class Webhooks extends APIResource {
46
64
  }
47
65
 
48
66
  /**
49
- * Retrieves a single webhook by ID for the authenticated customer.
67
+ * Retrieves a single webhook by ID for the authenticated customer. A version 1
68
+ * webhook includes its sender_profile selection.
50
69
  *
51
70
  * @example
52
71
  * ```ts
@@ -71,12 +90,24 @@ export class Webhooks extends APIResource {
71
90
  }
72
91
 
73
92
  /**
74
- * Updates an existing webhook for the authenticated customer.
93
+ * Updates an existing webhook for the authenticated customer. Its version does not
94
+ * change. sender_profile applies to a version 1 webhook and is_inheritable to a
95
+ * version 2 one; retry_count and timeout_seconds apply to version 1 only. A
96
+ * version 1 webhook's response returns its sender_profile selection as saved; a
97
+ * version 2 webhook's response leaves sender_profile out.
75
98
  *
76
99
  * @example
77
100
  * ```ts
78
101
  * const apiResponseWebhook = await client.webhooks.update(
79
102
  * 'd4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8',
103
+ * {
104
+ * display_name: 'Updated Order Notifications',
105
+ * endpoint_url: 'https://example.com/webhooks/orders-v2',
106
+ * event_filters: { message: ['delivered', 'failed'] },
107
+ * event_types: ['contact', 'message', 'templates'],
108
+ * retry_count: 5,
109
+ * timeout_seconds: 60,
110
+ * },
80
111
  * );
81
112
  * ```
82
113
  */
@@ -96,7 +127,8 @@ export class Webhooks extends APIResource {
96
127
  }
97
128
 
98
129
  /**
99
- * Retrieves a paginated list of webhooks for the authenticated customer.
130
+ * Retrieves a paginated list of webhooks for the authenticated customer. Each
131
+ * version 1 webhook includes its sender_profile selection.
100
132
  *
101
133
  * @example
102
134
  * ```ts
@@ -169,9 +201,11 @@ export class Webhooks extends APIResource {
169
201
  }
170
202
 
171
203
  /**
172
- * Retrieves a paginated list of delivery events for the specified webhook. If the
173
- * webhook is cloned onto your sender profiles, the list includes what those clones
174
- * received; read payload.account_id to tell whose event it is.
204
+ * Retrieves a paginated list of delivery events for the specified webhook, newest
205
+ * first. If the webhook is cloned onto your sender profiles (version 1) or
206
+ * inheritable by them (version 2, is_inheritable), the list includes their events;
207
+ * read payload.account_id to tell whose event it is. A sender profile may read its
208
+ * organization's inheritable webhook too, and gets the events about itself.
175
209
  *
176
210
  * @example
177
211
  * ```ts
@@ -204,8 +238,11 @@ export class Webhooks extends APIResource {
204
238
  }
205
239
 
206
240
  /**
207
- * Generates a new signing secret for the specified webhook. The old secret is
208
- * immediately invalidated.
241
+ * Generates a new signing secret for the specified webhook. A version 1 webhook's
242
+ * old secret stops verifying at once. A version 2 webhook's deliveries are signed
243
+ * with the new secret at once, and with the old one as well for the next 24 hours,
244
+ * so a receiver can switch over without rejecting any; after that the old secret
245
+ * no longer verifies.
209
246
  *
210
247
  * @example
211
248
  * ```ts
@@ -234,7 +271,10 @@ export class Webhooks extends APIResource {
234
271
  }
235
272
 
236
273
  /**
237
- * Sends a test event to the specified webhook endpoint to verify connectivity.
274
+ * Sends a test event to the specified webhook endpoint to verify connectivity. A
275
+ * version 1 webhook is tested at once and the answer says whether it was
276
+ * delivered; a version 2 webhook's test is queued with Svix, which delivers it
277
+ * right after, and the answer says it was queued.
238
278
  *
239
279
  * @example
240
280
  * ```ts
@@ -357,15 +397,17 @@ export interface CallEvent {
357
397
  field?: string;
358
398
 
359
399
  /**
360
- * Body of a call.initiated, call.answered, call.completed, call.failed or
361
- * call.recording_ready event. Which of them occurred is the envelope's event.
400
+ * Body of a call.initiated, call.answered, call.agent_connected, call.completed,
401
+ * call.failed or call.recording_ready event. Which of them occurred is the
402
+ * envelope's event.
362
403
  *
363
404
  * Shaped like the message, inbound, template and channel payloads: account_id
364
405
  * names the account the event is about, channel names the channel, and updated_at
365
406
  * is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
366
- * duration_seconds and price are added on call.completed, reason on call.failed
367
- * and recording_id on call.recording_ready; each is omitted rather than sent as
368
- * null when it does not apply.
407
+ * Every event says how the call is handled in mode, and an agent call names its
408
+ * agent in agent_id. duration_seconds and price are added on call.completed,
409
+ * reason on call.failed and recording_id on call.recording_ready; each is omitted
410
+ * rather than sent as null when it does not apply.
369
411
  *
370
412
  * Casing is snake_case because these ride the same webhook stream customers
371
413
  * already parse message_id from; the question/answer contract is a separate
@@ -388,15 +430,17 @@ export interface CallEvent {
388
430
  }
389
431
 
390
432
  /**
391
- * Body of a call.initiated, call.answered, call.completed, call.failed or
392
- * call.recording_ready event. Which of them occurred is the envelope's event.
433
+ * Body of a call.initiated, call.answered, call.agent_connected, call.completed,
434
+ * call.failed or call.recording_ready event. Which of them occurred is the
435
+ * envelope's event.
393
436
  *
394
437
  * Shaped like the message, inbound, template and channel payloads: account_id
395
438
  * names the account the event is about, channel names the channel, and updated_at
396
439
  * is when the change happened on the call, in the same yyyy-MM-ddTHH:mm:ssZ form.
397
- * duration_seconds and price are added on call.completed, reason on call.failed
398
- * and recording_id on call.recording_ready; each is omitted rather than sent as
399
- * null when it does not apply.
440
+ * Every event says how the call is handled in mode, and an agent call names its
441
+ * agent in agent_id. duration_seconds and price are added on call.completed,
442
+ * reason on call.failed and recording_id on call.recording_ready; each is omitted
443
+ * rather than sent as null when it does not apply.
400
444
  *
401
445
  * Casing is snake_case because these ride the same webhook stream customers
402
446
  * already parse message_id from; the question/answer contract is a separate
@@ -415,6 +459,11 @@ export interface CallEventPayload {
415
459
  */
416
460
  account_id?: string;
417
461
 
462
+ /**
463
+ * The voice agent that answers the call, agent\_…. Only on an agent call.
464
+ */
465
+ agent_id?: string | null;
466
+
418
467
  /**
419
468
  * Always voice.
420
469
  */
@@ -425,6 +474,12 @@ export interface CallEventPayload {
425
474
  */
426
475
  duration_seconds?: number | null;
427
476
 
477
+ /**
478
+ * inapp, a call routed by the number's callback URL, or agent, a call one of the
479
+ * account's voice agents answers. The same value GET /v3/voice/calls returns.
480
+ */
481
+ mode?: string;
482
+
428
483
  /**
429
484
  * The customer number that owns the call, in E.164 format.
430
485
  */
@@ -1410,6 +1465,10 @@ export interface WebhookEventType {
1410
1465
  export interface WebhookResponse {
1411
1466
  id?: string;
1412
1467
 
1468
+ /**
1469
+ * Failed attempts since the last success. Version 1 only: always 0 on a version 2
1470
+ * webhook, whose deliveries are in its events (GET /v3/webhooks/{id}/events).
1471
+ */
1413
1472
  consecutive_failures?: number;
1414
1473
 
1415
1474
  created_at?: string;
@@ -1430,17 +1489,62 @@ export interface WebhookResponse {
1430
1489
 
1431
1490
  is_active?: boolean;
1432
1491
 
1492
+ /**
1493
+ * Whether the webhook also receives its organization's sender profiles' events,
1494
+ * and each profile sees it and reads the events about itself. Always false on a
1495
+ * version 1 webhook.
1496
+ */
1497
+ is_inheritable?: boolean;
1498
+
1499
+ /**
1500
+ * When the webhook was last attempted. Version 1 only: always null on a version 2
1501
+ * webhook.
1502
+ */
1433
1503
  last_delivery_attempt_at?: string | null;
1434
1504
 
1505
+ /**
1506
+ * When the webhook last received an event. Version 1 only: always null on a
1507
+ * version 2 webhook.
1508
+ */
1435
1509
  last_successful_delivery_at?: string | null;
1436
1510
 
1437
1511
  retry_count?: number;
1438
1512
 
1513
+ /**
1514
+ * The events a version 1 webhook's sender profile clones receive, as a response
1515
+ * reports them.
1516
+ *
1517
+ * Its own type, field for field the same as the request's sender_profile. A
1518
+ * response is not a request, whatever it carries.
1519
+ */
1520
+ sender_profile?: WebhookResponse.SenderProfile | null;
1521
+
1439
1522
  signing_secret?: string | null;
1440
1523
 
1441
1524
  timeout_seconds?: number;
1442
1525
 
1443
1526
  updated_at?: string | null;
1527
+
1528
+ /**
1529
+ * Who delivers the webhook: 1 the older delivery, which will be retired, or 2
1530
+ * Svix. A webhook is created as version 2 unless the request asks for 1.
1531
+ */
1532
+ webhook_version?: number;
1533
+ }
1534
+
1535
+ export namespace WebhookResponse {
1536
+ /**
1537
+ * The events a version 1 webhook's sender profile clones receive, as a response
1538
+ * reports them.
1539
+ *
1540
+ * Its own type, field for field the same as the request's sender_profile. A
1541
+ * response is not a request, whatever it carries.
1542
+ */
1543
+ export interface SenderProfile {
1544
+ event_filters?: { [key: string]: Array<string> } | null;
1545
+
1546
+ event_types?: Array<string>;
1547
+ }
1444
1548
  }
1445
1549
 
1446
1550
  /**
@@ -1839,7 +1943,16 @@ export interface WebhookCreateParams {
1839
1943
  event_types?: Array<string>;
1840
1944
 
1841
1945
  /**
1842
- * Body param
1946
+ * Body param: Also delivers every sender profile's events to this webhook, at the
1947
+ * same URL and with the same signing secret, and lets each profile see the webhook
1948
+ * and read the events about itself. Off by default: the organization's own events
1949
+ * only. Only an organization's version 2 webhook can set it.
1950
+ */
1951
+ is_inheritable?: boolean;
1952
+
1953
+ /**
1954
+ * Body param: Delivery retries. Applies to version 1 only: Svix retries a version
1955
+ * 2 webhook on its own schedule.
1843
1956
  */
1844
1957
  retry_count?: number;
1845
1958
 
@@ -1851,16 +1964,24 @@ export interface WebhookCreateParams {
1851
1964
 
1852
1965
  /**
1853
1966
  * Body param: Request-only: the events an organization webhook's sender profile
1854
- * clones receive, one clone per existing and future profile. Responses never
1855
- * return it.
1967
+ * clones receive, one clone per existing and future profile. A version 1 webhook's
1968
+ * responses report it as WebhookSenderProfileV3Response.
1856
1969
  */
1857
1970
  sender_profile?: WebhookCreateParams.SenderProfile | null;
1858
1971
 
1859
1972
  /**
1860
- * Body param
1973
+ * Body param: Delivery timeout. Applies to version 1 only.
1861
1974
  */
1862
1975
  timeout_seconds?: number;
1863
1976
 
1977
+ /**
1978
+ * Body param: Who delivers the webhook: 2, the default, is delivered by Svix and
1979
+ * signed with the webhook-id, webhook-timestamp and webhook-signature headers; 1
1980
+ * is the older delivery, signed with the X-Webhook-\* headers, which will be
1981
+ * retired.
1982
+ */
1983
+ webhook_version?: number | null;
1984
+
1864
1985
  /**
1865
1986
  * Header param: Unique key to ensure idempotent request processing. Must be 1-255
1866
1987
  * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
@@ -1879,7 +2000,8 @@ export interface WebhookCreateParams {
1879
2000
  export namespace WebhookCreateParams {
1880
2001
  /**
1881
2002
  * Request-only: the events an organization webhook's sender profile clones
1882
- * receive, one clone per existing and future profile. Responses never return it.
2003
+ * receive, one clone per existing and future profile. A version 1 webhook's
2004
+ * responses report it as WebhookSenderProfileV3Response.
1883
2005
  */
1884
2006
  export interface SenderProfile {
1885
2007
  event_filters?: { [key: string]: Array<string> } | null;
@@ -1917,6 +2039,13 @@ export interface WebhookUpdateParams {
1917
2039
  */
1918
2040
  event_types?: Array<string>;
1919
2041
 
2042
+ /**
2043
+ * Body param: Makes this webhook inheritable by the organization's sender profiles
2044
+ * (see create), or stops it being inheritable. Omit or pass null to keep it as it
2045
+ * is. Only a version 2 webhook can be inheritable.
2046
+ */
2047
+ is_inheritable?: boolean | null;
2048
+
1920
2049
  /**
1921
2050
  * Body param
1922
2051
  */
@@ -1930,8 +2059,8 @@ export interface WebhookUpdateParams {
1930
2059
 
1931
2060
  /**
1932
2061
  * Body param: Request-only: the events an organization webhook's sender profile
1933
- * clones receive, one clone per existing and future profile. Responses never
1934
- * return it.
2062
+ * clones receive, one clone per existing and future profile. A version 1 webhook's
2063
+ * responses report it as WebhookSenderProfileV3Response.
1935
2064
  */
1936
2065
  sender_profile?: WebhookUpdateParams.SenderProfile | null;
1937
2066
 
@@ -1958,7 +2087,8 @@ export interface WebhookUpdateParams {
1958
2087
  export namespace WebhookUpdateParams {
1959
2088
  /**
1960
2089
  * Request-only: the events an organization webhook's sender profile clones
1961
- * receive, one clone per existing and future profile. Responses never return it.
2090
+ * receive, one clone per existing and future profile. A version 1 webhook's
2091
+ * responses report it as WebhookSenderProfileV3Response.
1962
2092
  */
1963
2093
  export interface SenderProfile {
1964
2094
  event_filters?: { [key: string]: Array<string> } | null;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.46.0'; // x-release-please-version
1
+ export const VERSION = '0.47.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.46.0";
1
+ export declare const VERSION = "0.47.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.46.0";
1
+ export declare const VERSION = "0.47.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.46.0'; // x-release-please-version
4
+ exports.VERSION = '0.47.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.46.0'; // x-release-please-version
1
+ export const VERSION = '0.47.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map