@talqing/sdk 0.13.2 → 0.14.1

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.
@@ -1855,6 +1855,10 @@ export type CatalogResponse = {
1855
1855
  * Turn Detector Languages
1856
1856
  */
1857
1857
  turn_detector_languages: Array<LanguageOption>;
1858
+ /**
1859
+ * Whatsapp Template Languages
1860
+ */
1861
+ whatsapp_template_languages: Array<string>;
1858
1862
  };
1859
1863
  /**
1860
1864
  * ChatDetailResponse
@@ -3558,8 +3562,34 @@ export type CreateWebhookRequest = {
3558
3562
  };
3559
3563
  /**
3560
3564
  * CreateWhatsAppBatchRequest
3565
+ *
3566
+ * The agent fields choose who answers replies; omit them for the number's agent.
3561
3567
  */
3562
3568
  export type CreateWhatsAppBatchRequest = {
3569
+ /**
3570
+ * A complete agent definition, run for this call and stored nowhere. Mutually exclusive with `agent_id`.
3571
+ */
3572
+ agent?: AgentConfig | null;
3573
+ /**
3574
+ * Agent Id
3575
+ *
3576
+ * An agent in this workspace. Mutually exclusive with `agent`.
3577
+ */
3578
+ agent_id?: string | null;
3579
+ /**
3580
+ * Changes layered on top of whichever base was named. Absent keys keep the base value, an explicit null clears the field, objects deep-merge and lists replace.
3581
+ */
3582
+ agent_override?: AgentOverride | null;
3583
+ /**
3584
+ * Run several agents on this call, defined here. Mutually exclusive with `agent_id` / `agent` / `agent_version` / `agent_override`.
3585
+ */
3586
+ agent_team?: AgentTeam | null;
3587
+ /**
3588
+ * Agent Version
3589
+ *
3590
+ * Which version of `agent_id` to run. Omit for the published one. `"draft"` runs the unpublished working copy — validated and tool-pinned at request time, and refused with the publish errors if it does not hold together.
3591
+ */
3592
+ agent_version?: number | 'draft' | null;
3563
3593
  /**
3564
3594
  * Delivery Attempts
3565
3595
  *
@@ -3622,8 +3652,73 @@ export type CreateWhatsAppBatchRequest = {
3622
3652
  variable_map: {
3623
3653
  [key: string]: string;
3624
3654
  };
3655
+ /**
3656
+ * Vars
3657
+ *
3658
+ * 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.
3659
+ */
3660
+ vars?: {
3661
+ [key: string]: string;
3662
+ } | null;
3625
3663
  window?: TimeWindow | null;
3626
3664
  };
3665
+ /**
3666
+ * CreateWhatsAppTemplateRequest
3667
+ */
3668
+ export type CreateWhatsAppTemplateRequest = {
3669
+ /**
3670
+ * Body
3671
+ *
3672
+ * Variables are named: `{{first_name}}`.
3673
+ */
3674
+ body: string;
3675
+ /**
3676
+ * Buttons
3677
+ */
3678
+ buttons?: Array<WhatsAppTemplateQuickReplyButtonInput | WhatsAppTemplateUrlButtonInput | WhatsAppTemplatePhoneButtonInput | WhatsAppTemplateVoiceCallButtonInput | WhatsAppTemplateCopyCodeButtonInput>;
3679
+ /**
3680
+ * Category
3681
+ */
3682
+ category: 'marketing' | 'utility';
3683
+ /**
3684
+ * Examples
3685
+ *
3686
+ * A realistic sample for every variable; WhatsApp reviews them.
3687
+ */
3688
+ examples?: {
3689
+ [key: string]: string;
3690
+ };
3691
+ /**
3692
+ * Footer
3693
+ */
3694
+ footer?: string | null;
3695
+ /**
3696
+ * Header
3697
+ */
3698
+ header?: ({
3699
+ type: 'text';
3700
+ } & WhatsAppTemplateTextHeaderInput) | ({
3701
+ type: 'document' | 'image' | 'video';
3702
+ } & WhatsAppTemplateMediaHeaderInput) | null;
3703
+ /**
3704
+ * Integration Id
3705
+ *
3706
+ * A Twilio WhatsApp sender; the template is account-wide.
3707
+ */
3708
+ integration_id: string;
3709
+ /**
3710
+ * Language
3711
+ *
3712
+ * One of the catalog's `whatsapp_template_languages`.
3713
+ */
3714
+ language: string;
3715
+ /**
3716
+ * Name
3717
+ *
3718
+ * Lowercase letters, digits and `_`.
3719
+ */
3720
+ name: string;
3721
+ };
3627
3722
  /**
3628
3723
  * CreditBalanceResponse
3629
3724
  *
@@ -8446,8 +8541,35 @@ export type PatchWebhookRequest = {
8446
8541
  * PatchWhatsAppBatchRequest
8447
8542
  *
8448
8543
  * Edits. ``window``, ``start_at`` and ``send_daily_cap`` take ``null`` to clear.
8544
+ *
8545
+ * Any agent field replaces the batch's agent wholesale; all of them null returns
8546
+ * replies to the number's agent.
8449
8547
  */
8450
8548
  export type PatchWhatsAppBatchRequest = {
8549
+ /**
8550
+ * A complete agent definition, run for this call and stored nowhere. Mutually exclusive with `agent_id`.
8551
+ */
8552
+ agent?: AgentConfig | null;
8553
+ /**
8554
+ * Agent Id
8555
+ *
8556
+ * An agent in this workspace. Mutually exclusive with `agent`.
8557
+ */
8558
+ agent_id?: string | null;
8559
+ /**
8560
+ * Changes layered on top of whichever base was named. Absent keys keep the base value, an explicit null clears the field, objects deep-merge and lists replace.
8561
+ */
8562
+ agent_override?: AgentOverride | null;
8563
+ /**
8564
+ * Run several agents on this call, defined here. Mutually exclusive with `agent_id` / `agent` / `agent_version` / `agent_override`.
8565
+ */
8566
+ agent_team?: AgentTeam | null;
8567
+ /**
8568
+ * Agent Version
8569
+ *
8570
+ * Which version of `agent_id` to run. Omit for the published one. `"draft"` runs the unpublished working copy — validated and tool-pinned at request time, and refused with the publish errors if it does not hold together.
8571
+ */
8572
+ agent_version?: number | 'draft' | null;
8451
8573
  /**
8452
8574
  * Delivery Attempts
8453
8575
  *
@@ -8490,6 +8612,14 @@ export type PatchWhatsAppBatchRequest = {
8490
8612
  variable_map?: {
8491
8613
  [key: string]: string;
8492
8614
  };
8615
+ /**
8616
+ * Vars
8617
+ *
8618
+ * 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.
8619
+ */
8620
+ vars?: {
8621
+ [key: string]: string;
8622
+ } | null;
8493
8623
  window?: TimeWindow | null;
8494
8624
  };
8495
8625
  /**
@@ -8617,8 +8747,34 @@ export type PlatformFeePerMinute = {
8617
8747
  };
8618
8748
  /**
8619
8749
  * PostItemRequest
8750
+ *
8751
+ * The agent fields make that agent answer this person; omit them to continue whatever runs.
8620
8752
  */
8621
8753
  export type PostItemRequest = {
8754
+ /**
8755
+ * A complete agent definition, run for this call and stored nowhere. Mutually exclusive with `agent_id`.
8756
+ */
8757
+ agent?: AgentConfig | null;
8758
+ /**
8759
+ * Agent Id
8760
+ *
8761
+ * An agent in this workspace. Mutually exclusive with `agent`.
8762
+ */
8763
+ agent_id?: string | null;
8764
+ /**
8765
+ * Changes layered on top of whichever base was named. Absent keys keep the base value, an explicit null clears the field, objects deep-merge and lists replace.
8766
+ */
8767
+ agent_override?: AgentOverride | null;
8768
+ /**
8769
+ * Run several agents on this call, defined here. Mutually exclusive with `agent_id` / `agent` / `agent_version` / `agent_override`.
8770
+ */
8771
+ agent_team?: AgentTeam | null;
8772
+ /**
8773
+ * Agent Version
8774
+ *
8775
+ * Which version of `agent_id` to run. Omit for the published one. `"draft"` runs the unpublished working copy — validated and tool-pinned at request time, and refused with the publish errors if it does not hold together.
8776
+ */
8777
+ agent_version?: number | 'draft' | null;
8622
8778
  /**
8623
8779
  * Who at your business posted this; shown in transcripts, never sent to the person or shown to the agent.
8624
8780
  */
@@ -8633,6 +8789,14 @@ export type PostItemRequest = {
8633
8789
  * fail refuses free text outside WhatsApp's 24h window; an opener sends that template and holds the message until they reply.
8634
8790
  */
8635
8791
  on_window_closed?: 'fail' | OpenerPolicy;
8792
+ /**
8793
+ * Secrets
8794
+ *
8795
+ * 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.
8796
+ */
8797
+ secrets?: {
8798
+ [key: string]: string;
8799
+ } | null;
8636
8800
  /**
8637
8801
  * For `template` only.
8638
8802
  */
@@ -8661,6 +8825,14 @@ export type PostItemRequest = {
8661
8825
  userdata?: {
8662
8826
  [key: string]: unknown;
8663
8827
  } | null;
8828
+ /**
8829
+ * Vars
8830
+ *
8831
+ * 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.
8832
+ */
8833
+ vars?: {
8834
+ [key: string]: string;
8835
+ } | null;
8664
8836
  };
8665
8837
  /**
8666
8838
  * PostTarget
@@ -13137,6 +13309,7 @@ export type WhatsAppBatchResponse = {
13137
13309
  * Agent Name
13138
13310
  */
13139
13311
  agent_name: string | null;
13312
+ agent_plan: StoredAgentPlan | null;
13140
13313
  counts: WhatsAppBatchCounts;
13141
13314
  /**
13142
13315
  * Created At
@@ -13186,6 +13359,10 @@ export type WhatsAppBatchResponse = {
13186
13359
  * Next Send Reason
13187
13360
  */
13188
13361
  next_send_reason: 'start' | 'window' | 'daily_cap' | 'retry' | 'gap' | null;
13362
+ /**
13363
+ * Own Agent
13364
+ */
13365
+ own_agent: boolean;
13189
13366
  /**
13190
13367
  * Send Daily Cap
13191
13368
  */
@@ -13222,7 +13399,7 @@ export type WhatsAppBatchResponse = {
13222
13399
  * Status
13223
13400
  */
13224
13401
  status: 'draft' | 'scheduled' | 'sending' | 'paused' | 'completed' | 'canceled' | 'failed';
13225
- template: WhatsAppTemplate;
13402
+ template: WhatsAppTemplateSnapshot;
13226
13403
  /**
13227
13404
  * Timezone
13228
13405
  */
@@ -13237,6 +13414,12 @@ export type WhatsAppBatchResponse = {
13237
13414
  variable_map: {
13238
13415
  [key: string]: string;
13239
13416
  };
13417
+ /**
13418
+ * Vars
13419
+ */
13420
+ vars: {
13421
+ [key: string]: string;
13422
+ } | null;
13240
13423
  window: TimeWindow | null;
13241
13424
  };
13242
13425
  /**
@@ -13340,7 +13523,7 @@ export type WhatsAppRecipientResponse = {
13340
13523
  /**
13341
13524
  * WhatsAppTemplate
13342
13525
  *
13343
- * The whole message: header, body, footer and buttons.
13526
+ * A template and where WhatsApp's review of it stands. Only `approved` can be sent.
13344
13527
  */
13345
13528
  export type WhatsAppTemplate = {
13346
13529
  /**
@@ -13354,7 +13537,17 @@ export type WhatsAppTemplate = {
13354
13537
  /**
13355
13538
  * Category
13356
13539
  */
13357
- category: string;
13540
+ category: 'marketing' | 'utility' | 'authentication';
13541
+ /**
13542
+ * Created At
13543
+ */
13544
+ created_at: string;
13545
+ /**
13546
+ * Examples
13547
+ */
13548
+ examples: {
13549
+ [key: string]: string;
13550
+ };
13358
13551
  /**
13359
13552
  * Footer
13360
13553
  */
@@ -13372,6 +13565,14 @@ export type WhatsAppTemplate = {
13372
13565
  * Name
13373
13566
  */
13374
13567
  name: string;
13568
+ /**
13569
+ * Rejection Reason
13570
+ */
13571
+ rejection_reason: string | null;
13572
+ /**
13573
+ * Status
13574
+ */
13575
+ status: 'pending' | 'approved' | 'rejected' | 'paused' | 'disabled';
13375
13576
  /**
13376
13577
  * Unsupported Reason
13377
13578
  */
@@ -13397,6 +13598,10 @@ export type WhatsAppTemplateButton = {
13397
13598
  * Text
13398
13599
  */
13399
13600
  text: string;
13601
+ /**
13602
+ * Ttl Minutes
13603
+ */
13604
+ ttl_minutes: number | null;
13400
13605
  /**
13401
13606
  * Type
13402
13607
  */
@@ -13406,6 +13611,21 @@ export type WhatsAppTemplateButton = {
13406
13611
  */
13407
13612
  url: string | null;
13408
13613
  };
13614
+ /**
13615
+ * WhatsAppTemplateCopyCodeButtonInput
13616
+ *
13617
+ * WhatsApp labels it "Copy Code".
13618
+ */
13619
+ export type WhatsAppTemplateCopyCodeButtonInput = {
13620
+ /**
13621
+ * Code
13622
+ */
13623
+ code: string;
13624
+ /**
13625
+ * Type
13626
+ */
13627
+ type: 'copy_code';
13628
+ };
13409
13629
  /**
13410
13630
  * WhatsAppTemplateHeader
13411
13631
  */
@@ -13423,6 +13643,144 @@ export type WhatsAppTemplateHeader = {
13423
13643
  */
13424
13644
  url: string | null;
13425
13645
  };
13646
+ /**
13647
+ * WhatsAppTemplateMediaHeaderInput
13648
+ */
13649
+ export type WhatsAppTemplateMediaHeaderInput = {
13650
+ /**
13651
+ * Type
13652
+ */
13653
+ type: 'image' | 'video' | 'document';
13654
+ /**
13655
+ * Url
13656
+ *
13657
+ * A public https file; WhatsApp downloads it.
13658
+ */
13659
+ url: string;
13660
+ };
13661
+ /**
13662
+ * WhatsAppTemplatePhoneButtonInput
13663
+ */
13664
+ export type WhatsAppTemplatePhoneButtonInput = {
13665
+ /**
13666
+ * Phone Number
13667
+ */
13668
+ phone_number: string;
13669
+ /**
13670
+ * Text
13671
+ */
13672
+ text: string;
13673
+ /**
13674
+ * Type
13675
+ */
13676
+ type: 'phone_number';
13677
+ };
13678
+ /**
13679
+ * WhatsAppTemplateQuickReplyButtonInput
13680
+ */
13681
+ export type WhatsAppTemplateQuickReplyButtonInput = {
13682
+ /**
13683
+ * Text
13684
+ */
13685
+ text: string;
13686
+ /**
13687
+ * Type
13688
+ */
13689
+ type: 'quick_reply';
13690
+ };
13691
+ /**
13692
+ * WhatsAppTemplateSnapshot
13693
+ *
13694
+ * The whole message as a batch sends it: header, body, footer and buttons.
13695
+ */
13696
+ export type WhatsAppTemplateSnapshot = {
13697
+ /**
13698
+ * Body
13699
+ */
13700
+ body: string;
13701
+ /**
13702
+ * Buttons
13703
+ */
13704
+ buttons: Array<WhatsAppTemplateButton>;
13705
+ /**
13706
+ * Category
13707
+ */
13708
+ category: 'marketing' | 'utility' | 'authentication';
13709
+ /**
13710
+ * Footer
13711
+ */
13712
+ footer: string | null;
13713
+ header: WhatsAppTemplateHeader | null;
13714
+ /**
13715
+ * Id
13716
+ */
13717
+ id: string;
13718
+ /**
13719
+ * Language
13720
+ */
13721
+ language: string;
13722
+ /**
13723
+ * Name
13724
+ */
13725
+ name: string;
13726
+ /**
13727
+ * Variables
13728
+ */
13729
+ variables: Array<string>;
13730
+ };
13731
+ /**
13732
+ * WhatsAppTemplateTextHeaderInput
13733
+ */
13734
+ export type WhatsAppTemplateTextHeaderInput = {
13735
+ /**
13736
+ * Text
13737
+ */
13738
+ text: string;
13739
+ /**
13740
+ * Type
13741
+ */
13742
+ type: 'text';
13743
+ };
13744
+ /**
13745
+ * WhatsAppTemplateUrlButtonInput
13746
+ */
13747
+ export type WhatsAppTemplateUrlButtonInput = {
13748
+ /**
13749
+ * Text
13750
+ */
13751
+ text: string;
13752
+ /**
13753
+ * Type
13754
+ */
13755
+ type: 'url';
13756
+ /**
13757
+ * Url
13758
+ *
13759
+ * May end in one variable, after a `/`.
13760
+ */
13761
+ url: string;
13762
+ };
13763
+ /**
13764
+ * WhatsAppTemplateVoiceCallButtonInput
13765
+ *
13766
+ * Starts a WhatsApp call to the sending number.
13767
+ */
13768
+ export type WhatsAppTemplateVoiceCallButtonInput = {
13769
+ /**
13770
+ * Text
13771
+ */
13772
+ text: string;
13773
+ /**
13774
+ * Ttl Minutes
13775
+ *
13776
+ * How long the button works after sending. Default 7 days.
13777
+ */
13778
+ ttl_minutes?: number | null;
13779
+ /**
13780
+ * Type
13781
+ */
13782
+ type: 'voice_call';
13783
+ };
13426
13784
  /**
13427
13785
  * WhatsAppTemplatesResponse
13428
13786
  */
@@ -22164,6 +22522,10 @@ export type WhatsappTemplatesListData = {
22164
22522
  * A connected WhatsApp sender.
22165
22523
  */
22166
22524
  integration_id: string;
22525
+ /**
22526
+ * Status
22527
+ */
22528
+ status?: Array<'pending' | 'approved' | 'rejected' | 'paused' | 'disabled'> | null;
22167
22529
  };
22168
22530
  url: '/v1/whatsapp/templates';
22169
22531
  };
@@ -22189,6 +22551,102 @@ export type WhatsappTemplatesListResults = {
22189
22551
  200: WhatsAppTemplatesResponse;
22190
22552
  };
22191
22553
  export type WhatsappTemplatesListResult = WhatsappTemplatesListResults[keyof WhatsappTemplatesListResults];
22554
+ export type WhatsappTemplatesCreateData = {
22555
+ body: CreateWhatsAppTemplateRequest;
22556
+ path?: never;
22557
+ query?: never;
22558
+ url: '/v1/whatsapp/templates';
22559
+ };
22560
+ export type WhatsappTemplatesCreateErrors = {
22561
+ /**
22562
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
22563
+ */
22564
+ 400: ErrorResponse;
22565
+ /**
22566
+ * Missing credential, or one that is revoked or no longer a member of this organization.
22567
+ */
22568
+ 401: ErrorResponse;
22569
+ /**
22570
+ * Authenticated, but this organization role may not perform the operation.
22571
+ */
22572
+ 403: ErrorResponse;
22573
+ /**
22574
+ * The resource's current state forbids this — a name already taken, a job already running.
22575
+ */
22576
+ 409: ErrorResponse;
22577
+ /**
22578
+ * The request did not match this operation's schema; `detail.errors` lists each field.
22579
+ */
22580
+ 422: ErrorResponse;
22581
+ /**
22582
+ * Unexpected error. Every error this API returns carries this body.
22583
+ */
22584
+ default: ErrorResponse;
22585
+ };
22586
+ export type WhatsappTemplatesCreateError = WhatsappTemplatesCreateErrors[keyof WhatsappTemplatesCreateErrors];
22587
+ export type WhatsappTemplatesCreateResults = {
22588
+ /**
22589
+ * Successful Response
22590
+ */
22591
+ 201: WhatsAppTemplate;
22592
+ };
22593
+ export type WhatsappTemplatesCreateResult = WhatsappTemplatesCreateResults[keyof WhatsappTemplatesCreateResults];
22594
+ export type WhatsappTemplatesDeleteData = {
22595
+ body?: never;
22596
+ path: {
22597
+ /**
22598
+ * Template Id
22599
+ */
22600
+ template_id: string;
22601
+ };
22602
+ query: {
22603
+ /**
22604
+ * Integration Id
22605
+ *
22606
+ * A WhatsApp sender on the template's account.
22607
+ */
22608
+ integration_id: string;
22609
+ };
22610
+ url: '/v1/whatsapp/templates/{template_id}';
22611
+ };
22612
+ export type WhatsappTemplatesDeleteErrors = {
22613
+ /**
22614
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
22615
+ */
22616
+ 400: ErrorResponse;
22617
+ /**
22618
+ * Missing credential, or one that is revoked or no longer a member of this organization.
22619
+ */
22620
+ 401: ErrorResponse;
22621
+ /**
22622
+ * Authenticated, but this organization role may not perform the operation.
22623
+ */
22624
+ 403: ErrorResponse;
22625
+ /**
22626
+ * No such resource in this organization.
22627
+ */
22628
+ 404: ErrorResponse;
22629
+ /**
22630
+ * The resource's current state forbids this — a name already taken, a job already running.
22631
+ */
22632
+ 409: ErrorResponse;
22633
+ /**
22634
+ * The request did not match this operation's schema; `detail.errors` lists each field.
22635
+ */
22636
+ 422: ErrorResponse;
22637
+ /**
22638
+ * Unexpected error. Every error this API returns carries this body.
22639
+ */
22640
+ default: ErrorResponse;
22641
+ };
22642
+ export type WhatsappTemplatesDeleteError = WhatsappTemplatesDeleteErrors[keyof WhatsappTemplatesDeleteErrors];
22643
+ export type WhatsappTemplatesDeleteResults = {
22644
+ /**
22645
+ * Successful Response
22646
+ */
22647
+ 200: OkResponse;
22648
+ };
22649
+ export type WhatsappTemplatesDeleteResult = WhatsappTemplatesDeleteResults[keyof WhatsappTemplatesDeleteResults];
22192
22650
  export type WhatsappTwilioSendersListData = {
22193
22651
  body: TwilioSendersRequest;
22194
22652
  path?: never;