@talqing/sdk 0.12.0 → 0.13.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.
@@ -195,7 +195,7 @@ export type AgentConfig = {
195
195
  /**
196
196
  * Greeting
197
197
  *
198
- * The opening line, spoken on connect and on the way in from a handoff; empty or null makes the agent wait for the caller to speak first. Voice and video only. Supports the same substitutions as the prompt, plus `{{consent.notice}}`, the recording disclosure's place in the line.
198
+ * The opening line, spoken on connect and on the way in from a handoff; empty or null makes the agent wait for the caller to speak first. Voice and video only. Supports the same substitutions as the prompt, plus `{{recording.notice}}`, the recording notice's place in the line.
199
199
  */
200
200
  greeting?: string | null;
201
201
  /**
@@ -210,6 +210,12 @@ export type AgentConfig = {
210
210
  * Where this agent may hand the conversation next. Each entry becomes one tool the model can call, so routing quality lives in its `description`. A target is a stored agent (`agent_id`) or a member of the team defined on the call.
211
211
  */
212
212
  handoffs?: Array<HandoffTarget>;
213
+ /**
214
+ * Inbound Webhook
215
+ *
216
+ * Before an inbound call or channel chat starts, ask the workspace's inbound webhook for its vars, secrets, overrides, metadata and userdata. Refused if it does not answer.
217
+ */
218
+ inbound_webhook?: boolean;
213
219
  keypad_input?: KeypadInputSpec;
214
220
  /**
215
221
  * Language
@@ -333,7 +339,7 @@ export type AgentOverride = {
333
339
  /**
334
340
  * Greeting
335
341
  *
336
- * The opening line, spoken on connect and on the way in from a handoff; empty or null makes the agent wait for the caller to speak first. Voice and video only. Supports the same substitutions as the prompt, plus `{{consent.notice}}`, the recording disclosure's place in the line.
342
+ * The opening line, spoken on connect and on the way in from a handoff; empty or null makes the agent wait for the caller to speak first. Voice and video only. Supports the same substitutions as the prompt, plus `{{recording.notice}}`, the recording notice's place in the line.
337
343
  */
338
344
  greeting?: string | null;
339
345
  /**
@@ -348,6 +354,12 @@ export type AgentOverride = {
348
354
  * Where this agent may hand the conversation next. Each entry becomes one tool the model can call, so routing quality lives in its `description`. A target is a stored agent (`agent_id`) or a member of the team defined on the call.
349
355
  */
350
356
  handoffs?: Array<HandoffTarget> | null;
357
+ /**
358
+ * Inbound Webhook
359
+ *
360
+ * Before an inbound call or channel chat starts, ask the workspace's inbound webhook for its vars, secrets, overrides, metadata and userdata. Refused if it does not answer.
361
+ */
362
+ inbound_webhook?: boolean | null;
351
363
  keypad_input?: KeypadInputSpecOverride | null;
352
364
  /**
353
365
  * Language
@@ -1215,6 +1227,20 @@ export type BuiltinToolSpec = {
1215
1227
  type: string;
1216
1228
  };
1217
1229
 
1230
+ /**
1231
+ * ButtonTap
1232
+ */
1233
+ export type ButtonTap = {
1234
+ /**
1235
+ * Payload
1236
+ */
1237
+ payload?: string | null;
1238
+ /**
1239
+ * Text
1240
+ */
1241
+ text: string;
1242
+ };
1243
+
1218
1244
  /**
1219
1245
  * CallBatchCounts
1220
1246
  */
@@ -1549,6 +1575,14 @@ export type CallSessionResponse = {
1549
1575
  * Livekit Room
1550
1576
  */
1551
1577
  livekit_room: string | null;
1578
+ /**
1579
+ * Metadata
1580
+ *
1581
+ * Your own labels for this session, set by your inbound webhook.
1582
+ */
1583
+ metadata: {
1584
+ [key: string]: string;
1585
+ };
1552
1586
  /**
1553
1587
  * Phone Number Id
1554
1588
  */
@@ -1687,6 +1721,14 @@ export type CallSummaryResponse = {
1687
1721
  * Message Count
1688
1722
  */
1689
1723
  message_count?: number;
1724
+ /**
1725
+ * Metadata
1726
+ *
1727
+ * Your own labels for this session, set by your inbound webhook.
1728
+ */
1729
+ metadata: {
1730
+ [key: string]: string;
1731
+ };
1690
1732
  /**
1691
1733
  * Outcome
1692
1734
  */
@@ -1951,6 +1993,14 @@ export type ChatResponse = {
1951
1993
  * Id
1952
1994
  */
1953
1995
  id: string;
1996
+ /**
1997
+ * Metadata
1998
+ *
1999
+ * Your own labels for this session, set by your inbound webhook.
2000
+ */
2001
+ metadata: {
2002
+ [key: string]: string;
2003
+ };
1954
2004
  /**
1955
2005
  * Started At
1956
2006
  */
@@ -2209,10 +2259,24 @@ export type ConversationItemResponse = {
2209
2259
  * Attachments
2210
2260
  */
2211
2261
  attachments: Array<ConversationAttachment>;
2262
+ /**
2263
+ * Who at your business posted this.
2264
+ */
2265
+ author: ItemAuthor | null;
2266
+ /**
2267
+ * Channel
2268
+ *
2269
+ * How this item reached us or the person; null for notes and instructions.
2270
+ */
2271
+ channel: 'phone_call' | 'whatsapp_call' | 'whatsapp_message' | 'web_call' | 'chat' | 'telegram' | 'stream' | 'copilot' | null;
2212
2272
  /**
2213
2273
  * Client Message Id
2214
2274
  */
2215
2275
  client_message_id: string | null;
2276
+ /**
2277
+ * What the person sent besides text; null for plain text.
2278
+ */
2279
+ content: InboundContent | null;
2216
2280
  /**
2217
2281
  * Conversation Id
2218
2282
  */
@@ -2225,7 +2289,7 @@ export type ConversationItemResponse = {
2225
2289
  /**
2226
2290
  * Delivery Status
2227
2291
  */
2228
- delivery_status: 'not_applicable' | 'pending' | 'sending' | 'sent' | 'failed' | 'skipped';
2292
+ delivery_status: 'not_applicable' | 'pending' | 'held' | 'sending' | 'queued' | 'sent' | 'delivered' | 'read' | 'undelivered' | 'failed' | 'skipped' | 'expired';
2229
2293
  /**
2230
2294
  * Direction
2231
2295
  */
@@ -2238,6 +2302,16 @@ export type ConversationItemResponse = {
2238
2302
  * Id
2239
2303
  */
2240
2304
  id: string;
2305
+ /**
2306
+ * Idempotency Key
2307
+ */
2308
+ idempotency_key: string | null;
2309
+ /**
2310
+ * Images Not Kept
2311
+ *
2312
+ * Images the person sent that were not stored, and why.
2313
+ */
2314
+ images_not_kept: Array<ImageNotKept>;
2241
2315
  latency: ReplyLatency | null;
2242
2316
  /**
2243
2317
  * Metadata
@@ -2250,6 +2324,12 @@ export type ConversationItemResponse = {
2250
2324
  * Origin
2251
2325
  */
2252
2326
  origin: 'speech' | 'typed' | 'keypad' | null;
2327
+ /**
2328
+ * Post Type
2329
+ *
2330
+ * What was posted through the API; null for everything else.
2331
+ */
2332
+ post_type: 'template' | 'agent_text' | 'note' | 'instruction' | null;
2253
2333
  /**
2254
2334
  * Provider Message Id
2255
2335
  */
@@ -2272,10 +2352,6 @@ export type ConversationItemResponse = {
2272
2352
  * Session Id
2273
2353
  */
2274
2354
  session_id: string | null;
2275
- /**
2276
- * Source
2277
- */
2278
- source: string | null;
2279
2355
  /**
2280
2356
  * Text
2281
2357
  */
@@ -2312,32 +2388,46 @@ export type ConversationItemResponse = {
2312
2388
  * The contact this conversation belongs to: key, binding, and what we know.
2313
2389
  */
2314
2390
  export type ConversationRefSummary = {
2315
- /**
2316
- * Bind Id
2317
- */
2318
- bind_id?: string | null;
2319
2391
  /**
2320
2392
  * Contact Key
2321
2393
  */
2322
- contact_key?: string | null;
2394
+ contact_key: string;
2323
2395
  /**
2324
2396
  * Display Name
2325
2397
  */
2326
- display_name?: string | null;
2398
+ display_name: string | null;
2327
2399
  /**
2328
2400
  * Integration Id
2329
2401
  */
2330
- integration_id?: string | null;
2402
+ integration_id: string | null;
2331
2403
  /**
2332
2404
  * Kind
2333
2405
  */
2334
- kind?: string | null;
2406
+ kind: 'phone' | 'integration' | 'stream' | 'web';
2335
2407
  /**
2336
2408
  * Metadata
2337
2409
  */
2338
- metadata?: {
2410
+ metadata: {
2339
2411
  [key: string]: unknown;
2340
2412
  };
2413
+ /**
2414
+ * Number
2415
+ *
2416
+ * Your number, on a phone contact.
2417
+ */
2418
+ number: string | null;
2419
+ /**
2420
+ * Peer
2421
+ *
2422
+ * Their number, on a phone contact.
2423
+ */
2424
+ peer: string | null;
2425
+ /**
2426
+ * Whatsapp Window Expires At
2427
+ *
2428
+ * When free-form WhatsApp messages stop being allowed; null if they never contacted you on WhatsApp.
2429
+ */
2430
+ whatsapp_window_expires_at: string | null;
2341
2431
  };
2342
2432
 
2343
2433
  /**
@@ -2467,6 +2557,14 @@ export type ConversationSessionResponse = {
2467
2557
  * Integration Id
2468
2558
  */
2469
2559
  integration_id: string | null;
2560
+ /**
2561
+ * Metadata
2562
+ *
2563
+ * Your own labels for this session, set by your inbound webhook.
2564
+ */
2565
+ metadata: {
2566
+ [key: string]: string;
2567
+ };
2470
2568
  metrics: SessionMetrics;
2471
2569
  /**
2472
2570
  * Started At
@@ -2984,7 +3082,7 @@ export type CreateCallBatchRequest = {
2984
3082
  /**
2985
3083
  * Vars
2986
3084
  *
2987
- * Values for the variables the agents on this session declare, read as {{vars.name}} in a prompt, a greeting and a tool. They override each agent's declared default and reach every agent the session runs, including a handoff target. Unlike `userdata`, which describes the PERSON and is kept on their contact record, these describe THIS session and are gone with it. Strings only; an empty string is a deliberate blank, not a request for the default. The model can see them, so put credentials in a workspace secret and read {{secrets.NAME}} from a tool instead.
3085
+ * Values for the variables the agents on this session declare, read as {{vars.name}} in a prompt, a greeting and a tool. They override each agent's declared default and reach every agent the session runs, including a handoff target. Unlike `userdata`, which describes the PERSON and is kept on their contact record, these describe THIS session and are gone with it. Strings only; an empty string is a deliberate blank, not a request for the default. The model can see them, so credentials go in `secrets` (this session's own, where the request takes them) or a workspace secret, read as {{secrets.NAME}} by a tool.
2988
3086
  */
2989
3087
  vars?: {
2990
3088
  [key: string]: string;
@@ -2996,7 +3094,8 @@ export type CreateCallBatchRequest = {
2996
3094
  *
2997
3095
  * Who the chat is with, what it starts knowing, and what runs.
2998
3096
  *
2999
- * `vars` comes from `AgentPlanRequest` and is fixed for the life of the chat.
3097
+ * `vars` comes from `AgentPlanRequest` and `secrets` from `SessionSecretsField`;
3098
+ * both are fixed for the life of the chat.
3000
3099
  */
3001
3100
  export type CreateChatRequest = {
3002
3101
  /**
@@ -3027,6 +3126,14 @@ export type CreateChatRequest = {
3027
3126
  * Contact Key
3028
3127
  */
3029
3128
  contact_key?: string | null;
3129
+ /**
3130
+ * Secrets
3131
+ *
3132
+ * Secrets for this session only, read by tools as {{secrets.NAME}}; a name here overrides the workspace secret. Never shown to the model or returned.
3133
+ */
3134
+ secrets?: {
3135
+ [key: string]: string;
3136
+ } | null;
3030
3137
  /**
3031
3138
  * Userdata
3032
3139
  */
@@ -3036,7 +3143,7 @@ export type CreateChatRequest = {
3036
3143
  /**
3037
3144
  * Vars
3038
3145
  *
3039
- * Values for the variables the agents on this session declare, read as {{vars.name}} in a prompt, a greeting and a tool. They override each agent's declared default and reach every agent the session runs, including a handoff target. Unlike `userdata`, which describes the PERSON and is kept on their contact record, these describe THIS session and are gone with it. Strings only; an empty string is a deliberate blank, not a request for the default. The model can see them, so put credentials in a workspace secret and read {{secrets.NAME}} from a tool instead.
3146
+ * Values for the variables the agents on this session declare, read as {{vars.name}} in a prompt, a greeting and a tool. They override each agent's declared default and reach every agent the session runs, including a handoff target. Unlike `userdata`, which describes the PERSON and is kept on their contact record, these describe THIS session and are gone with it. Strings only; an empty string is a deliberate blank, not a request for the default. The model can see them, so credentials go in `secrets` (this session's own, where the request takes them) or a workspace secret, read as {{secrets.NAME}} by a tool.
3040
3147
  */
3041
3148
  vars?: {
3042
3149
  [key: string]: string;
@@ -3795,9 +3902,16 @@ export type DeleteTaskRunsResponse = {
3795
3902
  *
3796
3903
  * Outbound delivery failure detail (provider HTTP / shadow-mode skips).
3797
3904
  *
3798
- * Writers always store `{"message": ...}` (see services.messaging.delivery).
3905
+ * Writers always store `{"message": ...}`, plus the provider's `code` when it
3906
+ * gave one (see services.messaging.delivery).
3799
3907
  */
3800
3908
  export type DeliveryError = {
3909
+ /**
3910
+ * Code
3911
+ *
3912
+ * The provider's error code, if any.
3913
+ */
3914
+ code: string | null;
3801
3915
  /**
3802
3916
  * Message
3803
3917
  */
@@ -4450,9 +4564,15 @@ export type EndpointingSpecOverride = {
4450
4564
  * of individual `errors` (used wherever we surface many problems at once,
4451
4565
  * including tool publish, op-tree checks, and request validation). The global
4452
4566
  * exception handlers normalize every API error to
4453
- * `{detail: {message, errors}}`, so SDKs can parse one shape consistently.
4567
+ * `{detail: {message, errors, code}}`, so SDKs can parse one shape consistently.
4454
4568
  */
4455
4569
  export type ErrorBody = {
4570
+ /**
4571
+ * Code
4572
+ *
4573
+ * A stable identifier for this error, when it has one.
4574
+ */
4575
+ code?: string | null;
4456
4576
  /**
4457
4577
  * Errors
4458
4578
  */
@@ -5219,6 +5339,16 @@ export type IfOperation = {
5219
5339
  then?: Array<HttpOperation | CodeOperation | FrontendRpcOperation | IfOperation | SetVariableOperation | SayOperation | GenerateReplyOperation | AddMessageOperation | EndCallOperation | HandoffOperation | TransferOperation | SendDtmfOperation> | null;
5220
5340
  };
5221
5341
 
5342
+ /**
5343
+ * ImageNotKept
5344
+ */
5345
+ export type ImageNotKept = {
5346
+ /**
5347
+ * Reason
5348
+ */
5349
+ reason: string;
5350
+ };
5351
+
5222
5352
  /**
5223
5353
  * ImportPhoneNumbersRequest
5224
5354
  */
@@ -5280,6 +5410,25 @@ export type ImportedNumberResult = {
5280
5410
  phone_number?: PhoneNumberResponse | null;
5281
5411
  };
5282
5412
 
5413
+ /**
5414
+ * InboundContent
5415
+ *
5416
+ * What the person sent besides text.
5417
+ */
5418
+ export type InboundContent = {
5419
+ button: ButtonTap;
5420
+ /**
5421
+ * Kind
5422
+ */
5423
+ kind: 'button';
5424
+ /**
5425
+ * Replied To
5426
+ *
5427
+ * Provider id of the message this answers, e.g. the template.
5428
+ */
5429
+ replied_to?: string | null;
5430
+ };
5431
+
5283
5432
  /**
5284
5433
  * InboundImage
5285
5434
  *
@@ -5296,6 +5445,36 @@ export type InboundImage = {
5296
5445
  filename?: string | null;
5297
5446
  };
5298
5447
 
5448
+ /**
5449
+ * InboundWebhookResponse
5450
+ *
5451
+ * The workspace's inbound session webhook.
5452
+ */
5453
+ export type InboundWebhookResponse = {
5454
+ /**
5455
+ * Created At
5456
+ */
5457
+ created_at: string;
5458
+ /**
5459
+ * Secret
5460
+ *
5461
+ * The signing secret, only when it was just created or rotated.
5462
+ */
5463
+ secret: string | null;
5464
+ /**
5465
+ * Secret Hint
5466
+ */
5467
+ secret_hint: string;
5468
+ /**
5469
+ * Updated At
5470
+ */
5471
+ updated_at: string;
5472
+ /**
5473
+ * Url
5474
+ */
5475
+ url: string;
5476
+ };
5477
+
5299
5478
  /**
5300
5479
  * InlineFaq
5301
5480
  *
@@ -5788,6 +5967,22 @@ export type InterruptionSpecOverride = {
5788
5967
  resume_false_interruption?: boolean | null;
5789
5968
  };
5790
5969
 
5970
+ /**
5971
+ * ItemAuthor
5972
+ *
5973
+ * Who at your business posted an item.
5974
+ */
5975
+ export type ItemAuthor = {
5976
+ /**
5977
+ * Id
5978
+ */
5979
+ id: string;
5980
+ /**
5981
+ * Name
5982
+ */
5983
+ name: string;
5984
+ };
5985
+
5791
5986
  /**
5792
5987
  * ItemCreatedEvent
5793
5988
  *
@@ -5806,10 +6001,24 @@ export type ItemCreatedEvent = {
5806
6001
  * Attachments
5807
6002
  */
5808
6003
  attachments: Array<ConversationAttachment>;
6004
+ /**
6005
+ * Who at your business posted this.
6006
+ */
6007
+ author: ItemAuthor | null;
6008
+ /**
6009
+ * Channel
6010
+ *
6011
+ * How this item reached us or the person; null for notes and instructions.
6012
+ */
6013
+ channel: 'phone_call' | 'whatsapp_call' | 'whatsapp_message' | 'web_call' | 'chat' | 'telegram' | 'stream' | 'copilot' | null;
5809
6014
  /**
5810
6015
  * Client Message Id
5811
6016
  */
5812
6017
  client_message_id: string | null;
6018
+ /**
6019
+ * What the person sent besides text; null for plain text.
6020
+ */
6021
+ content: InboundContent | null;
5813
6022
  /**
5814
6023
  * Conversation Id
5815
6024
  */
@@ -5822,7 +6031,7 @@ export type ItemCreatedEvent = {
5822
6031
  /**
5823
6032
  * Delivery Status
5824
6033
  */
5825
- delivery_status: 'not_applicable' | 'pending' | 'sending' | 'sent' | 'failed' | 'skipped';
6034
+ delivery_status: 'not_applicable' | 'pending' | 'held' | 'sending' | 'queued' | 'sent' | 'delivered' | 'read' | 'undelivered' | 'failed' | 'skipped' | 'expired';
5826
6035
  /**
5827
6036
  * Direction
5828
6037
  */
@@ -5839,6 +6048,16 @@ export type ItemCreatedEvent = {
5839
6048
  * Id
5840
6049
  */
5841
6050
  id: string;
6051
+ /**
6052
+ * Idempotency Key
6053
+ */
6054
+ idempotency_key: string | null;
6055
+ /**
6056
+ * Images Not Kept
6057
+ *
6058
+ * Images the person sent that were not stored, and why.
6059
+ */
6060
+ images_not_kept: Array<ImageNotKept>;
5842
6061
  latency: ReplyLatency | null;
5843
6062
  /**
5844
6063
  * Metadata
@@ -5851,6 +6070,12 @@ export type ItemCreatedEvent = {
5851
6070
  * Origin
5852
6071
  */
5853
6072
  origin: 'speech' | 'typed' | 'keypad' | null;
6073
+ /**
6074
+ * Post Type
6075
+ *
6076
+ * What was posted through the API; null for everything else.
6077
+ */
6078
+ post_type: 'template' | 'agent_text' | 'note' | 'instruction' | null;
5854
6079
  /**
5855
6080
  * Provider Message Id
5856
6081
  */
@@ -5873,10 +6098,6 @@ export type ItemCreatedEvent = {
5873
6098
  * Session Id
5874
6099
  */
5875
6100
  session_id: string | null;
5876
- /**
5877
- * Source
5878
- */
5879
- source: string | null;
5880
6101
  /**
5881
6102
  * Text
5882
6103
  */
@@ -5910,13 +6131,13 @@ export type ItemCreatedEvent = {
5910
6131
  /**
5911
6132
  * ItemDeliveryUpdatedEvent
5912
6133
  *
5913
- * An outbound item reached the provider, or failed to.
6134
+ * An outbound item's delivery moved: claimed, sent, held, a receipt, or a failure.
5914
6135
  */
5915
6136
  export type ItemDeliveryUpdatedEvent = {
5916
6137
  /**
5917
6138
  * Delivery Status
5918
6139
  */
5919
- delivery_status: 'not_applicable' | 'pending' | 'sending' | 'sent' | 'failed' | 'skipped';
6140
+ delivery_status: 'not_applicable' | 'pending' | 'held' | 'sending' | 'queued' | 'sent' | 'delivered' | 'read' | 'undelivered' | 'failed' | 'skipped' | 'expired';
5920
6141
  /**
5921
6142
  * Error
5922
6143
  */
@@ -7222,12 +7443,20 @@ export type OkResponse = {
7222
7443
  ok?: boolean;
7223
7444
  };
7224
7445
 
7446
+ /**
7447
+ * OpenerPolicy
7448
+ */
7449
+ export type OpenerPolicy = {
7450
+ opener: TemplateSend;
7451
+ };
7452
+
7225
7453
  /**
7226
7454
  * OutboundCallRequest
7227
7455
  *
7228
7456
  * One phone call: who to dial, from which of your numbers, and what runs.
7229
7457
  *
7230
- * `vars` comes from `AgentPlanRequest` and lasts exactly as long as this call.
7458
+ * `vars` comes from `AgentPlanRequest` and `secrets` from `SessionSecretsField`;
7459
+ * both last exactly as long as this call.
7231
7460
  */
7232
7461
  export type OutboundCallRequest = {
7233
7462
  /**
@@ -7258,6 +7487,14 @@ export type OutboundCallRequest = {
7258
7487
  * From Phone Number Id
7259
7488
  */
7260
7489
  from_phone_number_id: string;
7490
+ /**
7491
+ * Secrets
7492
+ *
7493
+ * Secrets for this session only, read by tools as {{secrets.NAME}}; a name here overrides the workspace secret. Never shown to the model or returned.
7494
+ */
7495
+ secrets?: {
7496
+ [key: string]: string;
7497
+ } | null;
7261
7498
  /**
7262
7499
  * To
7263
7500
  */
@@ -7271,7 +7508,7 @@ export type OutboundCallRequest = {
7271
7508
  /**
7272
7509
  * Vars
7273
7510
  *
7274
- * Values for the variables the agents on this session declare, read as {{vars.name}} in a prompt, a greeting and a tool. They override each agent's declared default and reach every agent the session runs, including a handoff target. Unlike `userdata`, which describes the PERSON and is kept on their contact record, these describe THIS session and are gone with it. Strings only; an empty string is a deliberate blank, not a request for the default. The model can see them, so put credentials in a workspace secret and read {{secrets.NAME}} from a tool instead.
7511
+ * Values for the variables the agents on this session declare, read as {{vars.name}} in a prompt, a greeting and a tool. They override each agent's declared default and reach every agent the session runs, including a handoff target. Unlike `userdata`, which describes the PERSON and is kept on their contact record, these describe THIS session and are gone with it. Strings only; an empty string is a deliberate blank, not a request for the default. The model can see them, so credentials go in `secrets` (this session's own, where the request takes them) or a workspace secret, read as {{secrets.NAME}} by a tool.
7275
7512
  */
7276
7513
  vars?: {
7277
7514
  [key: string]: string;
@@ -8626,6 +8863,78 @@ export type PlatformFeePerMinute = {
8626
8863
  voice: number;
8627
8864
  };
8628
8865
 
8866
+ /**
8867
+ * PostItemRequest
8868
+ */
8869
+ export type PostItemRequest = {
8870
+ /**
8871
+ * Who at your business posted this; shown in transcripts, never sent to the person or shown to the agent.
8872
+ */
8873
+ author?: ItemAuthor | null;
8874
+ /**
8875
+ * Idempotency Key
8876
+ */
8877
+ idempotency_key?: string | null;
8878
+ /**
8879
+ * On Window Closed
8880
+ *
8881
+ * fail refuses free text outside WhatsApp's 24h window; an opener sends that template and holds the message until they reply.
8882
+ */
8883
+ on_window_closed?: 'fail' | OpenerPolicy;
8884
+ /**
8885
+ * For `template` only.
8886
+ */
8887
+ template?: TemplateSend | null;
8888
+ /**
8889
+ * Text
8890
+ *
8891
+ * For the other three types.
8892
+ */
8893
+ text?: string | null;
8894
+ /**
8895
+ * The conversation, or your number and theirs to reach a person with no conversation yet.
8896
+ */
8897
+ to: PostTarget;
8898
+ /**
8899
+ * Type
8900
+ *
8901
+ * template and agent_text are delivered; note is never delivered; instruct has the agent write and send a message.
8902
+ */
8903
+ type: 'template' | 'agent_text' | 'note' | 'instruct';
8904
+ /**
8905
+ * Userdata
8906
+ *
8907
+ * Merged into the person's userdata and given to the agent that answers their reply.
8908
+ */
8909
+ userdata?: {
8910
+ [key: string]: unknown;
8911
+ } | null;
8912
+ };
8913
+
8914
+ /**
8915
+ * PostTarget
8916
+ *
8917
+ * `conversation_id`, or `number` and `peer`.
8918
+ */
8919
+ export type PostTarget = {
8920
+ /**
8921
+ * Conversation Id
8922
+ */
8923
+ conversation_id?: string | null;
8924
+ /**
8925
+ * Number
8926
+ *
8927
+ * Your business number, E.164.
8928
+ */
8929
+ number?: string | null;
8930
+ /**
8931
+ * Peer
8932
+ *
8933
+ * The person's number.
8934
+ */
8935
+ peer?: string | null;
8936
+ };
8937
+
8629
8938
  /**
8630
8939
  * PreemptiveGenerationSpec
8631
8940
  *
@@ -9446,30 +9755,24 @@ export type RecordingResponse = {
9446
9755
  /**
9447
9756
  * RecordingSpec
9448
9757
  *
9449
- * Whether calls with this agent are recorded, and what the caller is told.
9758
+ * Whether calls with this agent are recorded, and whether the caller is told.
9450
9759
  *
9451
9760
  * On by default: one stereo file per call, kept until the workspace's
9452
9761
  * retention policy deletes it.
9453
9762
  */
9454
9763
  export type RecordingSpec = {
9455
- /**
9456
- * Consent
9457
- *
9458
- * Set to 'disclosure' to tell the caller the call is recorded. The greeting must then contain `{{consent.notice}}` to say where, and the agent gains a tool to stop recording if the caller objects.
9459
- */
9460
- consent?: 'off' | 'disclosure';
9461
- /**
9462
- * Consent Notice
9463
- *
9464
- * The sentence `{{consent.notice}}` resolves to in the greeting.
9465
- */
9466
- consent_notice?: string;
9467
9764
  /**
9468
9765
  * Enabled
9469
9766
  *
9470
9767
  * Record the call audio. Voice and video agents only.
9471
9768
  */
9472
9769
  enabled?: boolean;
9770
+ /**
9771
+ * Notice
9772
+ *
9773
+ * Spoken where the greeting places {{recording.notice}}, uninterruptibly. Null: no notice.
9774
+ */
9775
+ notice?: string | null;
9473
9776
  };
9474
9777
 
9475
9778
  /**
@@ -9478,24 +9781,18 @@ export type RecordingSpec = {
9478
9781
  * A partial RecordingSpec: only the fields this call changes. Absent keeps the base value, an explicit null clears it, objects deep-merge and lists replace.
9479
9782
  */
9480
9783
  export type RecordingSpecOverride = {
9481
- /**
9482
- * Consent
9483
- *
9484
- * Set to 'disclosure' to tell the caller the call is recorded. The greeting must then contain `{{consent.notice}}` to say where, and the agent gains a tool to stop recording if the caller objects.
9485
- */
9486
- consent?: 'off' | 'disclosure' | null;
9487
- /**
9488
- * Consent Notice
9489
- *
9490
- * The sentence `{{consent.notice}}` resolves to in the greeting.
9491
- */
9492
- consent_notice?: string | null;
9493
9784
  /**
9494
9785
  * Enabled
9495
9786
  *
9496
9787
  * Record the call audio. Voice and video agents only.
9497
9788
  */
9498
9789
  enabled?: boolean | null;
9790
+ /**
9791
+ * Notice
9792
+ *
9793
+ * Spoken where the greeting places {{recording.notice}}, uninterruptibly. Null: no notice.
9794
+ */
9795
+ notice?: string | null;
9499
9796
  };
9500
9797
 
9501
9798
  /**
@@ -9503,7 +9800,7 @@ export type RecordingSpecOverride = {
9503
9800
  *
9504
9801
  * What a reader should do about it. `available` is the only playable one.
9505
9802
  */
9506
- export type RecordingState = 'none' | 'available' | 'pending' | 'expired' | 'failed' | 'not_shared' | 'consent_withdrawn' | 'deleted';
9803
+ export type RecordingState = 'none' | 'available' | 'pending' | 'expired' | 'failed' | 'not_shared' | 'deleted';
9507
9804
 
9508
9805
  /**
9509
9806
  * RedraftRequest
@@ -9622,6 +9919,14 @@ export type ResumeCallRequest = {
9622
9919
  * Region
9623
9920
  */
9624
9921
  region?: 'us' | 'in';
9922
+ /**
9923
+ * Secrets
9924
+ *
9925
+ * Secrets to add or replace for the resumed call; the dropped call's are kept.
9926
+ */
9927
+ secrets?: {
9928
+ [key: string]: string;
9929
+ } | null;
9625
9930
  };
9626
9931
 
9627
9932
  /**
@@ -9744,12 +10049,20 @@ export type RunToolRequest = {
9744
10049
  [key: string]: unknown;
9745
10050
  };
9746
10051
  /**
9747
- * Timezone
10052
+ * Secrets
9748
10053
  *
9749
- * The IANA timezone {{system_vars.now}}, {{system_vars.date}} and {{system_vars.time}} resolve against for this run. On a real call this comes from the agent.
10054
+ * Session secrets for this run; override workspace secrets of the same name.
9750
10055
  */
9751
- timezone?: string;
9752
- /**
10056
+ secrets?: {
10057
+ [key: string]: string;
10058
+ } | null;
10059
+ /**
10060
+ * Timezone
10061
+ *
10062
+ * The IANA timezone {{system_vars.now}}, {{system_vars.date}} and {{system_vars.time}} resolve against for this run. On a real call this comes from the agent.
10063
+ */
10064
+ timezone?: string;
10065
+ /**
9753
10066
  * Userdata
9754
10067
  */
9755
10068
  userdata?: {
@@ -10351,6 +10664,18 @@ export type SessionUsage = {
10351
10664
  tts: Array<TTSUsage>;
10352
10665
  };
10353
10666
 
10667
+ /**
10668
+ * SetInboundWebhookRequest
10669
+ */
10670
+ export type SetInboundWebhookRequest = {
10671
+ /**
10672
+ * Url
10673
+ *
10674
+ * An https URL on your server.
10675
+ */
10676
+ url: string;
10677
+ };
10678
+
10354
10679
  /**
10355
10680
  * SetProviderKeyRequest
10356
10681
  */
@@ -10647,6 +10972,12 @@ export type StreamResponse = {
10647
10972
  * One `{{system_vars.*}}` variable the platform fills in.
10648
10973
  */
10649
10974
  export type SystemVarResponse = {
10975
+ /**
10976
+ * Channels
10977
+ *
10978
+ * The session channels this has a value on; empty means every one.
10979
+ */
10980
+ channels: Array<'phone_call' | 'whatsapp_call' | 'whatsapp_message' | 'web_call' | 'chat' | 'telegram' | 'stream'>;
10650
10981
  /**
10651
10982
  * Description
10652
10983
  */
@@ -10659,10 +10990,6 @@ export type SystemVarResponse = {
10659
10990
  * Key
10660
10991
  */
10661
10992
  key: string;
10662
- /**
10663
- * Voice Only
10664
- */
10665
- voice_only: boolean;
10666
10993
  };
10667
10994
 
10668
10995
  /**
@@ -11965,6 +12292,84 @@ export type TelephonySetupStep = {
11965
12292
  user_confirmable: boolean;
11966
12293
  };
11967
12294
 
12295
+ /**
12296
+ * TemplateSend
12297
+ */
12298
+ export type TemplateSend = {
12299
+ /**
12300
+ * Id
12301
+ *
12302
+ * Twilio Content SID (HX…) or Gupshup template id.
12303
+ */
12304
+ id: string;
12305
+ /**
12306
+ * Variables
12307
+ *
12308
+ * Every placeholder, button variables included.
12309
+ */
12310
+ variables?: {
12311
+ [key: string]: string;
12312
+ };
12313
+ };
12314
+
12315
+ /**
12316
+ * TestInboundWebhookRequest
12317
+ */
12318
+ export type TestInboundWebhookRequest = {
12319
+ /**
12320
+ * Channel
12321
+ */
12322
+ channel: 'phone_call' | 'whatsapp_call' | 'whatsapp_message' | 'telegram';
12323
+ /**
12324
+ * Number
12325
+ *
12326
+ * Your number, as `to`.
12327
+ */
12328
+ number: string;
12329
+ /**
12330
+ * Peer
12331
+ *
12332
+ * Theirs, as `from`.
12333
+ */
12334
+ peer: string;
12335
+ };
12336
+
12337
+ /**
12338
+ * TestInboundWebhookResponse
12339
+ *
12340
+ * What your server answered to a sample `session.request`.
12341
+ */
12342
+ export type TestInboundWebhookResponse = {
12343
+ /**
12344
+ * Duration Ms
12345
+ */
12346
+ duration_ms: number;
12347
+ /**
12348
+ * Errors
12349
+ */
12350
+ errors: Array<string>;
12351
+ /**
12352
+ * Response
12353
+ *
12354
+ * The JSON object your server returned.
12355
+ */
12356
+ response: {
12357
+ [key: string]: unknown;
12358
+ } | null;
12359
+ /**
12360
+ * Status Code
12361
+ *
12362
+ * Null when no HTTP response arrived.
12363
+ */
12364
+ status_code: number | null;
12365
+ /**
12366
+ * Valid
12367
+ *
12368
+ * Whether a real session would have accepted this answer.
12369
+ */
12370
+ valid: boolean;
12371
+ };
12372
+
11968
12373
  /**
11969
12374
  * TimeWindow
11970
12375
  *
@@ -12003,7 +12408,8 @@ export type TimeWindow = {
12003
12408
  *
12004
12409
  * One browser call: who is on it, what it starts knowing, and what runs.
12005
12410
  *
12006
- * `vars` comes from `AgentPlanRequest` and lasts exactly as long as this call.
12411
+ * `vars` comes from `AgentPlanRequest` and `secrets` from `SessionSecretsField`;
12412
+ * both last exactly as long as this call.
12007
12413
  */
12008
12414
  export type TokenRequest = {
12009
12415
  /**
@@ -12038,6 +12444,14 @@ export type TokenRequest = {
12038
12444
  * Region
12039
12445
  */
12040
12446
  region?: 'us' | 'in';
12447
+ /**
12448
+ * Secrets
12449
+ *
12450
+ * Secrets for this session only, read by tools as {{secrets.NAME}}; a name here overrides the workspace secret. Never shown to the model or returned.
12451
+ */
12452
+ secrets?: {
12453
+ [key: string]: string;
12454
+ } | null;
12041
12455
  /**
12042
12456
  * Userdata
12043
12457
  */
@@ -12047,7 +12461,7 @@ export type TokenRequest = {
12047
12461
  /**
12048
12462
  * Vars
12049
12463
  *
12050
- * Values for the variables the agents on this session declare, read as {{vars.name}} in a prompt, a greeting and a tool. They override each agent's declared default and reach every agent the session runs, including a handoff target. Unlike `userdata`, which describes the PERSON and is kept on their contact record, these describe THIS session and are gone with it. Strings only; an empty string is a deliberate blank, not a request for the default. The model can see them, so put credentials in a workspace secret and read {{secrets.NAME}} from a tool instead.
12464
+ * Values for the variables the agents on this session declare, read as {{vars.name}} in a prompt, a greeting and a tool. They override each agent's declared default and reach every agent the session runs, including a handoff target. Unlike `userdata`, which describes the PERSON and is kept on their contact record, these describe THIS session and are gone with it. Strings only; an empty string is a deliberate blank, not a request for the default. The model can see them, so credentials go in `secrets` (this session's own, where the request takes them) or a workspace secret, read as {{secrets.NAME}} by a tool.
12051
12465
  */
12052
12466
  vars?: {
12053
12467
  [key: string]: string;
@@ -14162,6 +14576,12 @@ export type CallsListData = {
14162
14576
  * only calls placed by this outbound batch, retries included
14163
14577
  */
14164
14578
  batch_id?: string | null;
14579
+ /**
14580
+ * Metadata
14581
+ *
14582
+ * `key:value` pairs, all must match.
14583
+ */
14584
+ metadata?: Array<string>;
14165
14585
  };
14166
14586
  url: '/v1/calls';
14167
14587
  };
@@ -15673,6 +16093,12 @@ export type ChatsListData = {
15673
16093
  * Status
15674
16094
  */
15675
16095
  status?: 'open' | 'ended' | 'all';
16096
+ /**
16097
+ * Metadata
16098
+ *
16099
+ * `key:value` pairs, all must match.
16100
+ */
16101
+ metadata?: Array<string>;
15676
16102
  };
15677
16103
  url: '/v1/chats';
15678
16104
  };
@@ -16273,6 +16699,55 @@ export type ConversationsListResults = {
16273
16699
 
16274
16700
  export type ConversationsListResult = ConversationsListResults[keyof ConversationsListResults];
16275
16701
 
16702
+ export type ConversationsItemsCreateData = {
16703
+ body: PostItemRequest;
16704
+ path?: never;
16705
+ query?: never;
16706
+ url: '/v1/conversations/items';
16707
+ };
16708
+
16709
+ export type ConversationsItemsCreateErrors = {
16710
+ /**
16711
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
16712
+ */
16713
+ 400: ErrorResponse;
16714
+ /**
16715
+ * Missing credential, or one that is revoked or no longer a member of this organization.
16716
+ */
16717
+ 401: ErrorResponse;
16718
+ /**
16719
+ * Authenticated, but this organization role may not perform the operation.
16720
+ */
16721
+ 403: ErrorResponse;
16722
+ /**
16723
+ * The resource's current state forbids this — a name already taken, a job already running.
16724
+ */
16725
+ 409: ErrorResponse;
16726
+ /**
16727
+ * The request did not match this operation's schema; `detail.errors` lists each field.
16728
+ */
16729
+ 422: ErrorResponse;
16730
+ /**
16731
+ * Unexpected error. Every error this API returns carries this body.
16732
+ */
16733
+ default: ErrorResponse;
16734
+ };
16735
+
16736
+ export type ConversationsItemsCreateError = ConversationsItemsCreateErrors[keyof ConversationsItemsCreateErrors];
16737
+
16738
+ export type ConversationsItemsCreateResults = {
16739
+ /**
16740
+ * Idempotent replay.
16741
+ */
16742
+ 200: ConversationItemResponse;
16743
+ /**
16744
+ * Successful Response
16745
+ */
16746
+ 201: ConversationItemResponse;
16747
+ };
16748
+
16749
+ export type ConversationsItemsCreateResult = ConversationsItemsCreateResults[keyof ConversationsItemsCreateResults];
16750
+
16276
16751
  export type ConversationsGetData = {
16277
16752
  body?: never;
16278
16753
  path: {
@@ -18454,6 +18929,207 @@ export type FaqsEntriesUpdateResults = {
18454
18929
 
18455
18930
  export type FaqsEntriesUpdateResult = FaqsEntriesUpdateResults[keyof FaqsEntriesUpdateResults];
18456
18931
 
18932
+ export type InboundWebhookDeleteData = {
18933
+ body?: never;
18934
+ path?: never;
18935
+ query?: never;
18936
+ url: '/v1/inbound-webhook';
18937
+ };
18938
+
18939
+ export type InboundWebhookDeleteErrors = {
18940
+ /**
18941
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
18942
+ */
18943
+ 400: ErrorResponse;
18944
+ /**
18945
+ * Missing credential, or one that is revoked or no longer a member of this organization.
18946
+ */
18947
+ 401: ErrorResponse;
18948
+ /**
18949
+ * Authenticated, but this organization role may not perform the operation.
18950
+ */
18951
+ 403: ErrorResponse;
18952
+ /**
18953
+ * The resource's current state forbids this — a name already taken, a job already running.
18954
+ */
18955
+ 409: ErrorResponse;
18956
+ /**
18957
+ * Unexpected error. Every error this API returns carries this body.
18958
+ */
18959
+ default: ErrorResponse;
18960
+ };
18961
+
18962
+ export type InboundWebhookDeleteError = InboundWebhookDeleteErrors[keyof InboundWebhookDeleteErrors];
18963
+
18964
+ export type InboundWebhookDeleteResults = {
18965
+ /**
18966
+ * Successful Response
18967
+ */
18968
+ 200: OkResponse;
18969
+ };
18970
+
18971
+ export type InboundWebhookDeleteResult = InboundWebhookDeleteResults[keyof InboundWebhookDeleteResults];
18972
+
18973
+ export type InboundWebhookGetData = {
18974
+ body?: never;
18975
+ path?: never;
18976
+ query?: never;
18977
+ url: '/v1/inbound-webhook';
18978
+ };
18979
+
18980
+ export type InboundWebhookGetErrors = {
18981
+ /**
18982
+ * Missing credential, or one that is revoked or no longer a member of this organization.
18983
+ */
18984
+ 401: ErrorResponse;
18985
+ /**
18986
+ * Unexpected error. Every error this API returns carries this body.
18987
+ */
18988
+ default: ErrorResponse;
18989
+ };
18990
+
18991
+ export type InboundWebhookGetError = InboundWebhookGetErrors[keyof InboundWebhookGetErrors];
18992
+
18993
+ export type InboundWebhookGetResults = {
18994
+ /**
18995
+ * Successful Response
18996
+ */
18997
+ 200: InboundWebhookResponse;
18998
+ };
18999
+
19000
+ export type InboundWebhookGetResult = InboundWebhookGetResults[keyof InboundWebhookGetResults];
19001
+
19002
+ export type InboundWebhookSetData = {
19003
+ body: SetInboundWebhookRequest;
19004
+ path?: never;
19005
+ query?: never;
19006
+ url: '/v1/inbound-webhook';
19007
+ };
19008
+
19009
+ export type InboundWebhookSetErrors = {
19010
+ /**
19011
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
19012
+ */
19013
+ 400: ErrorResponse;
19014
+ /**
19015
+ * Missing credential, or one that is revoked or no longer a member of this organization.
19016
+ */
19017
+ 401: ErrorResponse;
19018
+ /**
19019
+ * Authenticated, but this organization role may not perform the operation.
19020
+ */
19021
+ 403: ErrorResponse;
19022
+ /**
19023
+ * The resource's current state forbids this — a name already taken, a job already running.
19024
+ */
19025
+ 409: ErrorResponse;
19026
+ /**
19027
+ * The request did not match this operation's schema; `detail.errors` lists each field.
19028
+ */
19029
+ 422: ErrorResponse;
19030
+ /**
19031
+ * Unexpected error. Every error this API returns carries this body.
19032
+ */
19033
+ default: ErrorResponse;
19034
+ };
19035
+
19036
+ export type InboundWebhookSetError = InboundWebhookSetErrors[keyof InboundWebhookSetErrors];
19037
+
19038
+ export type InboundWebhookSetResults = {
19039
+ /**
19040
+ * Successful Response
19041
+ */
19042
+ 200: InboundWebhookResponse;
19043
+ };
19044
+
19045
+ export type InboundWebhookSetResult = InboundWebhookSetResults[keyof InboundWebhookSetResults];
19046
+
19047
+ export type InboundWebhookRotateSecretData = {
19048
+ body?: never;
19049
+ path?: never;
19050
+ query?: never;
19051
+ url: '/v1/inbound-webhook/rotate-secret';
19052
+ };
19053
+
19054
+ export type InboundWebhookRotateSecretErrors = {
19055
+ /**
19056
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
19057
+ */
19058
+ 400: ErrorResponse;
19059
+ /**
19060
+ * Missing credential, or one that is revoked or no longer a member of this organization.
19061
+ */
19062
+ 401: ErrorResponse;
19063
+ /**
19064
+ * Authenticated, but this organization role may not perform the operation.
19065
+ */
19066
+ 403: ErrorResponse;
19067
+ /**
19068
+ * The resource's current state forbids this — a name already taken, a job already running.
19069
+ */
19070
+ 409: ErrorResponse;
19071
+ /**
19072
+ * Unexpected error. Every error this API returns carries this body.
19073
+ */
19074
+ default: ErrorResponse;
19075
+ };
19076
+
19077
+ export type InboundWebhookRotateSecretError = InboundWebhookRotateSecretErrors[keyof InboundWebhookRotateSecretErrors];
19078
+
19079
+ export type InboundWebhookRotateSecretResults = {
19080
+ /**
19081
+ * Successful Response
19082
+ */
19083
+ 200: InboundWebhookResponse;
19084
+ };
19085
+
19086
+ export type InboundWebhookRotateSecretResult = InboundWebhookRotateSecretResults[keyof InboundWebhookRotateSecretResults];
19087
+
19088
+ export type InboundWebhookTestData = {
19089
+ body: TestInboundWebhookRequest;
19090
+ path?: never;
19091
+ query?: never;
19092
+ url: '/v1/inbound-webhook/test';
19093
+ };
19094
+
19095
+ export type InboundWebhookTestErrors = {
19096
+ /**
19097
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
19098
+ */
19099
+ 400: ErrorResponse;
19100
+ /**
19101
+ * Missing credential, or one that is revoked or no longer a member of this organization.
19102
+ */
19103
+ 401: ErrorResponse;
19104
+ /**
19105
+ * Authenticated, but this organization role may not perform the operation.
19106
+ */
19107
+ 403: ErrorResponse;
19108
+ /**
19109
+ * The resource's current state forbids this — a name already taken, a job already running.
19110
+ */
19111
+ 409: ErrorResponse;
19112
+ /**
19113
+ * The request did not match this operation's schema; `detail.errors` lists each field.
19114
+ */
19115
+ 422: ErrorResponse;
19116
+ /**
19117
+ * Unexpected error. Every error this API returns carries this body.
19118
+ */
19119
+ default: ErrorResponse;
19120
+ };
19121
+
19122
+ export type InboundWebhookTestError = InboundWebhookTestErrors[keyof InboundWebhookTestErrors];
19123
+
19124
+ export type InboundWebhookTestResults = {
19125
+ /**
19126
+ * Successful Response
19127
+ */
19128
+ 200: TestInboundWebhookResponse;
19129
+ };
19130
+
19131
+ export type InboundWebhookTestResult = InboundWebhookTestResults[keyof InboundWebhookTestResults];
19132
+
18457
19133
  export type IntegrationsListData = {
18458
19134
  body?: never;
18459
19135
  path?: never;