@sentdm/sentdm 0.45.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 (191) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/client.d.mts +6 -11
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -11
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -10
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -10
  9. package/client.mjs.map +1 -1
  10. package/core/pagination.d.mts +25 -0
  11. package/core/pagination.d.mts.map +1 -1
  12. package/core/pagination.d.ts +25 -0
  13. package/core/pagination.d.ts.map +1 -1
  14. package/core/pagination.js +28 -1
  15. package/core/pagination.js.map +1 -1
  16. package/core/pagination.mjs +26 -0
  17. package/core/pagination.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/channels/channels.d.mts +2 -2
  20. package/resources/channels/channels.d.mts.map +1 -1
  21. package/resources/channels/channels.d.ts +2 -2
  22. package/resources/channels/channels.d.ts.map +1 -1
  23. package/resources/channels/channels.js.map +1 -1
  24. package/resources/channels/channels.mjs.map +1 -1
  25. package/resources/channels/index.d.mts +1 -1
  26. package/resources/channels/index.d.mts.map +1 -1
  27. package/resources/channels/index.d.ts +1 -1
  28. package/resources/channels/index.d.ts.map +1 -1
  29. package/resources/channels/index.js.map +1 -1
  30. package/resources/channels/index.mjs.map +1 -1
  31. package/resources/channels/voice.d.mts +72 -115
  32. package/resources/channels/voice.d.mts.map +1 -1
  33. package/resources/channels/voice.d.ts +72 -115
  34. package/resources/channels/voice.d.ts.map +1 -1
  35. package/resources/channels/voice.js +35 -45
  36. package/resources/channels/voice.js.map +1 -1
  37. package/resources/channels/voice.mjs +35 -45
  38. package/resources/channels/voice.mjs.map +1 -1
  39. package/resources/index.d.mts +1 -1
  40. package/resources/index.d.mts.map +1 -1
  41. package/resources/index.d.ts +1 -1
  42. package/resources/index.d.ts.map +1 -1
  43. package/resources/index.js +3 -3
  44. package/resources/index.js.map +1 -1
  45. package/resources/index.mjs +1 -1
  46. package/resources/index.mjs.map +1 -1
  47. package/resources/messages.d.mts +8 -1
  48. package/resources/messages.d.mts.map +1 -1
  49. package/resources/messages.d.ts +8 -1
  50. package/resources/messages.d.ts.map +1 -1
  51. package/resources/profiles/campaigns.d.mts +3 -2
  52. package/resources/profiles/campaigns.d.mts.map +1 -1
  53. package/resources/profiles/campaigns.d.ts +3 -2
  54. package/resources/profiles/campaigns.d.ts.map +1 -1
  55. package/resources/profiles/campaigns.js +3 -2
  56. package/resources/profiles/campaigns.js.map +1 -1
  57. package/resources/profiles/campaigns.mjs +3 -2
  58. package/resources/profiles/campaigns.mjs.map +1 -1
  59. package/resources/templates.d.mts +14 -13
  60. package/resources/templates.d.mts.map +1 -1
  61. package/resources/templates.d.ts +14 -13
  62. package/resources/templates.d.ts.map +1 -1
  63. package/resources/voice/agents.d.mts +524 -0
  64. package/resources/voice/agents.d.mts.map +1 -0
  65. package/resources/voice/agents.d.ts +524 -0
  66. package/resources/voice/agents.d.ts.map +1 -0
  67. package/resources/voice/agents.js +193 -0
  68. package/resources/voice/agents.js.map +1 -0
  69. package/resources/voice/agents.mjs +189 -0
  70. package/resources/voice/agents.mjs.map +1 -0
  71. package/resources/{calls → voice/calls}/calls.d.mts +103 -26
  72. package/resources/voice/calls/calls.d.mts.map +1 -0
  73. package/resources/{calls → voice/calls}/calls.d.ts +103 -26
  74. package/resources/voice/calls/calls.d.ts.map +1 -0
  75. package/resources/{calls → voice/calls}/calls.js +35 -28
  76. package/resources/voice/calls/calls.js.map +1 -0
  77. package/resources/{calls → voice/calls}/calls.mjs +34 -27
  78. package/resources/voice/calls/calls.mjs.map +1 -0
  79. package/resources/voice/calls/index.d.mts.map +1 -0
  80. package/resources/voice/calls/index.d.ts.map +1 -0
  81. package/resources/voice/calls/index.js.map +1 -0
  82. package/resources/voice/calls/index.mjs.map +1 -0
  83. package/resources/{calls → voice/calls}/participants.d.mts +16 -14
  84. package/resources/voice/calls/participants.d.mts.map +1 -0
  85. package/resources/{calls → voice/calls}/participants.d.ts +16 -14
  86. package/resources/voice/calls/participants.d.ts.map +1 -0
  87. package/resources/{calls → voice/calls}/participants.js +19 -17
  88. package/resources/voice/calls/participants.js.map +1 -0
  89. package/resources/{calls → voice/calls}/participants.mjs +19 -17
  90. package/resources/voice/calls/participants.mjs.map +1 -0
  91. package/resources/voice/calls.d.mts.map +1 -0
  92. package/resources/voice/calls.d.ts.map +1 -0
  93. package/resources/{calls.js → voice/calls.js} +1 -1
  94. package/resources/voice/calls.js.map +1 -0
  95. package/resources/voice/calls.mjs.map +1 -0
  96. package/resources/voice/catalogue.d.mts +86 -0
  97. package/resources/voice/catalogue.d.mts.map +1 -0
  98. package/resources/voice/catalogue.d.ts +86 -0
  99. package/resources/voice/catalogue.d.ts.map +1 -0
  100. package/resources/voice/catalogue.js +40 -0
  101. package/resources/voice/catalogue.js.map +1 -0
  102. package/resources/voice/catalogue.mjs +36 -0
  103. package/resources/voice/catalogue.mjs.map +1 -0
  104. package/resources/voice/index.d.mts +6 -0
  105. package/resources/voice/index.d.mts.map +1 -0
  106. package/resources/voice/index.d.ts +6 -0
  107. package/resources/voice/index.d.ts.map +1 -0
  108. package/resources/voice/index.js +15 -0
  109. package/resources/voice/index.js.map +1 -0
  110. package/resources/voice/index.mjs +7 -0
  111. package/resources/voice/index.mjs.map +1 -0
  112. package/resources/voice/tokens.d.mts +111 -0
  113. package/resources/voice/tokens.d.mts.map +1 -0
  114. package/resources/voice/tokens.d.ts +111 -0
  115. package/resources/voice/tokens.d.ts.map +1 -0
  116. package/resources/voice/tokens.js +47 -0
  117. package/resources/voice/tokens.js.map +1 -0
  118. package/resources/voice/tokens.mjs +43 -0
  119. package/resources/voice/tokens.mjs.map +1 -0
  120. package/resources/voice/voice.d.mts +22 -0
  121. package/resources/voice/voice.d.mts.map +1 -0
  122. package/resources/voice/voice.d.ts +22 -0
  123. package/resources/voice/voice.d.ts.map +1 -0
  124. package/resources/voice/voice.js +29 -0
  125. package/resources/voice/voice.js.map +1 -0
  126. package/resources/voice/voice.mjs +24 -0
  127. package/resources/voice/voice.mjs.map +1 -0
  128. package/resources/voice.d.mts +2 -0
  129. package/resources/voice.d.mts.map +1 -0
  130. package/resources/voice.d.ts +2 -0
  131. package/resources/voice.d.ts.map +1 -0
  132. package/resources/voice.js +6 -0
  133. package/resources/voice.js.map +1 -0
  134. package/resources/voice.mjs +3 -0
  135. package/resources/voice.mjs.map +1 -0
  136. package/resources/webhooks.d.mts +154 -31
  137. package/resources/webhooks.d.mts.map +1 -1
  138. package/resources/webhooks.d.ts +154 -31
  139. package/resources/webhooks.d.ts.map +1 -1
  140. package/resources/webhooks.js +51 -11
  141. package/resources/webhooks.js.map +1 -1
  142. package/resources/webhooks.mjs +51 -11
  143. package/resources/webhooks.mjs.map +1 -1
  144. package/src/client.ts +12 -45
  145. package/src/core/pagination.ts +64 -0
  146. package/src/resources/channels/channels.ts +0 -6
  147. package/src/resources/channels/index.ts +0 -3
  148. package/src/resources/channels/voice.ts +74 -144
  149. package/src/resources/index.ts +1 -18
  150. package/src/resources/messages.ts +8 -1
  151. package/src/resources/profiles/campaigns.ts +3 -2
  152. package/src/resources/templates.ts +14 -13
  153. package/src/resources/voice/agents.ts +729 -0
  154. package/src/resources/{calls → voice/calls}/calls.ts +122 -33
  155. package/src/resources/{calls → voice/calls}/participants.ts +23 -21
  156. package/src/resources/voice/catalogue.ts +118 -0
  157. package/src/resources/voice/index.ts +55 -0
  158. package/src/resources/voice/tokens.ts +146 -0
  159. package/src/resources/voice/voice.ts +134 -0
  160. package/src/resources/voice.ts +3 -0
  161. package/src/resources/webhooks.ts +162 -31
  162. package/src/version.ts +1 -1
  163. package/version.d.mts +1 -1
  164. package/version.d.ts +1 -1
  165. package/version.js +1 -1
  166. package/version.mjs +1 -1
  167. package/resources/calls/calls.d.mts.map +0 -1
  168. package/resources/calls/calls.d.ts.map +0 -1
  169. package/resources/calls/calls.js.map +0 -1
  170. package/resources/calls/calls.mjs.map +0 -1
  171. package/resources/calls/index.d.mts.map +0 -1
  172. package/resources/calls/index.d.ts.map +0 -1
  173. package/resources/calls/index.js.map +0 -1
  174. package/resources/calls/index.mjs.map +0 -1
  175. package/resources/calls/participants.d.mts.map +0 -1
  176. package/resources/calls/participants.d.ts.map +0 -1
  177. package/resources/calls/participants.js.map +0 -1
  178. package/resources/calls/participants.mjs.map +0 -1
  179. package/resources/calls.d.mts.map +0 -1
  180. package/resources/calls.d.ts.map +0 -1
  181. package/resources/calls.js.map +0 -1
  182. package/resources/calls.mjs.map +0 -1
  183. /package/resources/{calls → voice/calls}/index.d.mts +0 -0
  184. /package/resources/{calls → voice/calls}/index.d.ts +0 -0
  185. /package/resources/{calls → voice/calls}/index.js +0 -0
  186. /package/resources/{calls → voice/calls}/index.mjs +0 -0
  187. /package/resources/{calls.d.mts → voice/calls.d.mts} +0 -0
  188. /package/resources/{calls.d.ts → voice/calls.d.ts} +0 -0
  189. /package/resources/{calls.mjs → voice/calls.mjs} +0 -0
  190. /package/src/resources/{calls → voice/calls}/index.ts +0 -0
  191. /package/src/resources/{calls.ts → voice/calls.ts} +0 -0
@@ -0,0 +1,146 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as WebhooksAPI from '../webhooks';
5
+ import { APIPromise } from '../../core/api-promise';
6
+ import { buildHeaders } from '../../internal/headers';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+
9
+ /**
10
+ * Phone calls from the numbers you hold, driven by your own callback URL.
11
+ *
12
+ * `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent asks what to do with each call on it, and `POST /v3/voice/tokens` mints a short-lived token that lets a user of your app place and receive calls as that number. When a call arrives or a caller presses a key, a signed question is POSTed to the callback URL and the answer decides the call; `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need before a real call reaches it, and `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret. The call events themselves (`call.completed` and the rest) arrive through your webhooks.
13
+ *
14
+ * Every call is a record under `/v3/voice/calls`: read it, list its recordings once one is ready, hang it up, start or stop recording, and add, mute or remove conference participants while it is live. A leg to a phone number runs for at most what your balance affords at the destination's rate.
15
+ *
16
+ * **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls through the Sent Voice Gateway: `session_type` says whether Sent carries the call as text (speech recognised and spoken for the agent) or as audio, `websocket_url` is where the gateway dials the agent for each call (leave it out and the agent dials in with your API key), and `tools`, `transfer_targets`, `fallback` and `limits` say what it may do on a call. The agent's `signing_secret` is shown on create and on `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once it is bound to it on `/v3/channels/voice`.
17
+ */
18
+ export class Tokens extends APIResource {
19
+ /**
20
+ * Mints a short-lived token for one of your app users. Call this from your backend
21
+ * and return the token to your app, which passes it to the voice client SDK to
22
+ * register. The identity is bound to the given number, or to your default app-call
23
+ * number when omitted, and calls placed by that identity are routed through the
24
+ * bound number. Minting again re-binds the identity, so an identity can move
25
+ * between numbers.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const apiResponseOfVoiceToken =
30
+ * await client.voice.tokens.create();
31
+ * ```
32
+ */
33
+ create(params: TokenCreateParams, options?: RequestOptions): APIPromise<APIResponseOfVoiceToken> {
34
+ const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
35
+ return this._client.post('/v3/voice/tokens', {
36
+ body,
37
+ ...options,
38
+ headers: buildHeaders([
39
+ {
40
+ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
41
+ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
42
+ },
43
+ options?.headers,
44
+ ]),
45
+ });
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Standard API response envelope for all v3 endpoints
51
+ */
52
+ export interface APIResponseOfVoiceToken {
53
+ /**
54
+ * A short-lived token your app passes to the voice client SDK to register
55
+ */
56
+ data?: VoiceToken | null;
57
+
58
+ /**
59
+ * Error information
60
+ */
61
+ error?: WebhooksAPI.ErrorDetail | null;
62
+
63
+ /**
64
+ * Request and response metadata
65
+ */
66
+ meta?: WebhooksAPI.APIMeta;
67
+
68
+ /**
69
+ * Indicates whether the request was successful
70
+ */
71
+ success?: boolean;
72
+ }
73
+
74
+ /**
75
+ * A short-lived token your app passes to the voice client SDK to register
76
+ */
77
+ export interface VoiceToken {
78
+ /**
79
+ * The signed token. Hand it to the client SDK unchanged. Treat it as opaque: read
80
+ * the identity, number, and expiry from this response, not from the token.
81
+ */
82
+ token?: string;
83
+
84
+ /**
85
+ * When the token expires (UTC)
86
+ */
87
+ expires_at?: string;
88
+
89
+ /**
90
+ * The identity the token was minted for
91
+ */
92
+ identity?: string;
93
+
94
+ /**
95
+ * The phone number this identity is now bound to, in E.164 format
96
+ */
97
+ number?: string;
98
+ }
99
+
100
+ export interface TokenCreateParams {
101
+ /**
102
+ * Body param: Your identifier for the app user, such as an agent or account id.
103
+ * Letters, digits, hyphens and underscores only, up to 200 characters.
104
+ */
105
+ identity?: string;
106
+
107
+ /**
108
+ * Body param: One of your voice-enabled phone numbers in E.164 format. Calls
109
+ * placed by this identity are routed through that number. Omit to use your default
110
+ * app-call number.
111
+ */
112
+ number?: string | null;
113
+
114
+ /**
115
+ * Body param: Sandbox flag - when true, the operation is simulated without side
116
+ * effects Useful for testing integrations without actual execution
117
+ */
118
+ sandbox?: boolean;
119
+
120
+ /**
121
+ * Body param: Token lifetime in seconds. Defaults to 600 and cannot exceed 3600.
122
+ */
123
+ ttl?: number | null;
124
+
125
+ /**
126
+ * Header param: Unique key to ensure idempotent request processing. Must be 1-255
127
+ * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
128
+ * hours per key per customer.
129
+ */
130
+ 'Idempotency-Key'?: string;
131
+
132
+ /**
133
+ * Header param: Profile UUID to scope the request to a child profile. Only
134
+ * organization API keys can use this header. The profile must belong to the
135
+ * calling organization.
136
+ */
137
+ 'x-profile-id'?: string;
138
+ }
139
+
140
+ export declare namespace Tokens {
141
+ export {
142
+ type APIResponseOfVoiceToken as APIResponseOfVoiceToken,
143
+ type VoiceToken as VoiceToken,
144
+ type TokenCreateParams as TokenCreateParams,
145
+ };
146
+ }
@@ -0,0 +1,134 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as AgentsAPI from './agents';
5
+ import {
6
+ APIResponseOfVoiceAgent,
7
+ APIResponseOfVoiceAgentSecret,
8
+ APIResponseOfVoiceAgentsList,
9
+ AgentCreateParams,
10
+ AgentDeleteParams,
11
+ AgentListParams,
12
+ AgentRetrieveParams,
13
+ AgentRotateSecretParams,
14
+ AgentUpdateParams,
15
+ Agents,
16
+ VoiceAgent,
17
+ VoiceAgentAudio,
18
+ VoiceAgentAudioSpec,
19
+ VoiceAgentLimits,
20
+ VoiceAgentLimitsSpec,
21
+ VoiceAgentParty,
22
+ VoiceAgentPartySpec,
23
+ VoiceAgentSecret,
24
+ VoiceAgentSpeech,
25
+ VoiceAgentSpeechSpec,
26
+ VoiceAgentTranscripts,
27
+ VoiceAgentTranscriptsSpec,
28
+ VoiceAgentsList,
29
+ VoiceAgentsVoiceAgentsPage,
30
+ } from './agents';
31
+ import * as CatalogueAPI from './catalogue';
32
+ import {
33
+ APIResponseOfVoiceCatalogue,
34
+ Catalogue,
35
+ CatalogueListParams,
36
+ VoiceCatalogue,
37
+ VoiceCatalogueVoice,
38
+ } from './catalogue';
39
+ import * as TokensAPI from './tokens';
40
+ import { APIResponseOfVoiceToken, TokenCreateParams, Tokens, VoiceToken } from './tokens';
41
+ import * as CallsAPI from './calls/calls';
42
+ import {
43
+ APIResponseOfCall,
44
+ APIResponseOfCallRecordings,
45
+ APIResponseOfCallsList,
46
+ Call,
47
+ CallHangupParams,
48
+ CallListParams,
49
+ CallListRecordingsParams,
50
+ CallParty,
51
+ CallRecordParams,
52
+ CallRecording,
53
+ CallRecordings,
54
+ CallRetrieveParams,
55
+ CallTimelineEntry,
56
+ Calls,
57
+ CallsCallsPage,
58
+ CallsList,
59
+ } from './calls/calls';
60
+
61
+ export class Voice extends APIResource {
62
+ calls: CallsAPI.Calls = new CallsAPI.Calls(this._client);
63
+ tokens: TokensAPI.Tokens = new TokensAPI.Tokens(this._client);
64
+ agents: AgentsAPI.Agents = new AgentsAPI.Agents(this._client);
65
+ catalogue: CatalogueAPI.Catalogue = new CatalogueAPI.Catalogue(this._client);
66
+ }
67
+
68
+ Voice.Calls = Calls;
69
+ Voice.Tokens = Tokens;
70
+ Voice.Agents = Agents;
71
+ Voice.Catalogue = Catalogue;
72
+
73
+ export declare namespace Voice {
74
+ export {
75
+ Calls as Calls,
76
+ type APIResponseOfCall as APIResponseOfCall,
77
+ type APIResponseOfCallRecordings as APIResponseOfCallRecordings,
78
+ type APIResponseOfCallsList as APIResponseOfCallsList,
79
+ type Call as Call,
80
+ type CallParty as CallParty,
81
+ type CallRecording as CallRecording,
82
+ type CallRecordings as CallRecordings,
83
+ type CallTimelineEntry as CallTimelineEntry,
84
+ type CallsList as CallsList,
85
+ type CallsCallsPage as CallsCallsPage,
86
+ type CallRetrieveParams as CallRetrieveParams,
87
+ type CallListParams as CallListParams,
88
+ type CallHangupParams as CallHangupParams,
89
+ type CallListRecordingsParams as CallListRecordingsParams,
90
+ type CallRecordParams as CallRecordParams,
91
+ };
92
+
93
+ export {
94
+ Tokens as Tokens,
95
+ type APIResponseOfVoiceToken as APIResponseOfVoiceToken,
96
+ type VoiceToken as VoiceToken,
97
+ type TokenCreateParams as TokenCreateParams,
98
+ };
99
+
100
+ export {
101
+ Agents as Agents,
102
+ type APIResponseOfVoiceAgent as APIResponseOfVoiceAgent,
103
+ type APIResponseOfVoiceAgentSecret as APIResponseOfVoiceAgentSecret,
104
+ type APIResponseOfVoiceAgentsList as APIResponseOfVoiceAgentsList,
105
+ type VoiceAgent as VoiceAgent,
106
+ type VoiceAgentAudio as VoiceAgentAudio,
107
+ type VoiceAgentAudioSpec as VoiceAgentAudioSpec,
108
+ type VoiceAgentLimits as VoiceAgentLimits,
109
+ type VoiceAgentLimitsSpec as VoiceAgentLimitsSpec,
110
+ type VoiceAgentParty as VoiceAgentParty,
111
+ type VoiceAgentPartySpec as VoiceAgentPartySpec,
112
+ type VoiceAgentSecret as VoiceAgentSecret,
113
+ type VoiceAgentSpeech as VoiceAgentSpeech,
114
+ type VoiceAgentSpeechSpec as VoiceAgentSpeechSpec,
115
+ type VoiceAgentTranscripts as VoiceAgentTranscripts,
116
+ type VoiceAgentTranscriptsSpec as VoiceAgentTranscriptsSpec,
117
+ type VoiceAgentsList as VoiceAgentsList,
118
+ type VoiceAgentsVoiceAgentsPage as VoiceAgentsVoiceAgentsPage,
119
+ type AgentCreateParams as AgentCreateParams,
120
+ type AgentRetrieveParams as AgentRetrieveParams,
121
+ type AgentUpdateParams as AgentUpdateParams,
122
+ type AgentListParams as AgentListParams,
123
+ type AgentDeleteParams as AgentDeleteParams,
124
+ type AgentRotateSecretParams as AgentRotateSecretParams,
125
+ };
126
+
127
+ export {
128
+ Catalogue as Catalogue,
129
+ type APIResponseOfVoiceCatalogue as APIResponseOfVoiceCatalogue,
130
+ type VoiceCatalogue as VoiceCatalogue,
131
+ type VoiceCatalogueVoice as VoiceCatalogueVoice,
132
+ type CatalogueListParams as CatalogueListParams,
133
+ };
134
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './voice/index';
@@ -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
  */
@@ -443,8 +498,9 @@ export interface CallEventPayload {
443
498
  reason?: string | null;
444
499
 
445
500
  /**
446
- * The recording that became available, the same id GET /v3/calls/{id}/recordings
447
- * lists it under. Only on call.recording_ready, which is sent once per recording.
501
+ * The recording that became available, the same id GET
502
+ * /v3/voice/calls/{id}/recordings lists it under. Only on call.recording_ready,
503
+ * which is sent once per recording.
448
504
  */
449
505
  recording_id?: string | null;
450
506
 
@@ -1409,6 +1465,10 @@ export interface WebhookEventType {
1409
1465
  export interface WebhookResponse {
1410
1466
  id?: string;
1411
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
+ */
1412
1472
  consecutive_failures?: number;
1413
1473
 
1414
1474
  created_at?: string;
@@ -1429,17 +1489,62 @@ export interface WebhookResponse {
1429
1489
 
1430
1490
  is_active?: boolean;
1431
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
+ */
1432
1503
  last_delivery_attempt_at?: string | null;
1433
1504
 
1505
+ /**
1506
+ * When the webhook last received an event. Version 1 only: always null on a
1507
+ * version 2 webhook.
1508
+ */
1434
1509
  last_successful_delivery_at?: string | null;
1435
1510
 
1436
1511
  retry_count?: number;
1437
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
+
1438
1522
  signing_secret?: string | null;
1439
1523
 
1440
1524
  timeout_seconds?: number;
1441
1525
 
1442
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
+ }
1443
1548
  }
1444
1549
 
1445
1550
  /**
@@ -1838,7 +1943,16 @@ export interface WebhookCreateParams {
1838
1943
  event_types?: Array<string>;
1839
1944
 
1840
1945
  /**
1841
- * 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.
1842
1956
  */
1843
1957
  retry_count?: number;
1844
1958
 
@@ -1850,16 +1964,24 @@ export interface WebhookCreateParams {
1850
1964
 
1851
1965
  /**
1852
1966
  * Body param: Request-only: the events an organization webhook's sender profile
1853
- * clones receive, one clone per existing and future profile. Responses never
1854
- * return it.
1967
+ * clones receive, one clone per existing and future profile. A version 1 webhook's
1968
+ * responses report it as WebhookSenderProfileV3Response.
1855
1969
  */
1856
1970
  sender_profile?: WebhookCreateParams.SenderProfile | null;
1857
1971
 
1858
1972
  /**
1859
- * Body param
1973
+ * Body param: Delivery timeout. Applies to version 1 only.
1860
1974
  */
1861
1975
  timeout_seconds?: number;
1862
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
+
1863
1985
  /**
1864
1986
  * Header param: Unique key to ensure idempotent request processing. Must be 1-255
1865
1987
  * alphanumeric characters, hyphens, or underscores. Responses are cached for 24
@@ -1878,7 +2000,8 @@ export interface WebhookCreateParams {
1878
2000
  export namespace WebhookCreateParams {
1879
2001
  /**
1880
2002
  * Request-only: the events an organization webhook's sender profile clones
1881
- * 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.
1882
2005
  */
1883
2006
  export interface SenderProfile {
1884
2007
  event_filters?: { [key: string]: Array<string> } | null;
@@ -1916,6 +2039,13 @@ export interface WebhookUpdateParams {
1916
2039
  */
1917
2040
  event_types?: Array<string>;
1918
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
+
1919
2049
  /**
1920
2050
  * Body param
1921
2051
  */
@@ -1929,8 +2059,8 @@ export interface WebhookUpdateParams {
1929
2059
 
1930
2060
  /**
1931
2061
  * Body param: Request-only: the events an organization webhook's sender profile
1932
- * clones receive, one clone per existing and future profile. Responses never
1933
- * return it.
2062
+ * clones receive, one clone per existing and future profile. A version 1 webhook's
2063
+ * responses report it as WebhookSenderProfileV3Response.
1934
2064
  */
1935
2065
  sender_profile?: WebhookUpdateParams.SenderProfile | null;
1936
2066
 
@@ -1957,7 +2087,8 @@ export interface WebhookUpdateParams {
1957
2087
  export namespace WebhookUpdateParams {
1958
2088
  /**
1959
2089
  * Request-only: the events an organization webhook's sender profile clones
1960
- * 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.
1961
2092
  */
1962
2093
  export interface SenderProfile {
1963
2094
  event_filters?: { [key: string]: Array<string> } | null;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.45.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.45.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.45.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.45.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.45.0'; // x-release-please-version
1
+ export const VERSION = '0.47.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map