@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.
@@ -1913,6 +1913,10 @@ export type CatalogResponse = {
1913
1913
  * Turn Detector Languages
1914
1914
  */
1915
1915
  turn_detector_languages: Array<LanguageOption>;
1916
+ /**
1917
+ * Whatsapp Template Languages
1918
+ */
1919
+ whatsapp_template_languages: Array<string>;
1916
1920
  };
1917
1921
 
1918
1922
  /**
@@ -3664,8 +3668,34 @@ export type CreateWebhookRequest = {
3664
3668
 
3665
3669
  /**
3666
3670
  * CreateWhatsAppBatchRequest
3671
+ *
3672
+ * The agent fields choose who answers replies; omit them for the number's agent.
3667
3673
  */
3668
3674
  export type CreateWhatsAppBatchRequest = {
3675
+ /**
3676
+ * A complete agent definition, run for this call and stored nowhere. Mutually exclusive with `agent_id`.
3677
+ */
3678
+ agent?: AgentConfig | null;
3679
+ /**
3680
+ * Agent Id
3681
+ *
3682
+ * An agent in this workspace. Mutually exclusive with `agent`.
3683
+ */
3684
+ agent_id?: string | null;
3685
+ /**
3686
+ * 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.
3687
+ */
3688
+ agent_override?: AgentOverride | null;
3689
+ /**
3690
+ * Run several agents on this call, defined here. Mutually exclusive with `agent_id` / `agent` / `agent_version` / `agent_override`.
3691
+ */
3692
+ agent_team?: AgentTeam | null;
3693
+ /**
3694
+ * Agent Version
3695
+ *
3696
+ * 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.
3697
+ */
3698
+ agent_version?: number | 'draft' | null;
3669
3699
  /**
3670
3700
  * Delivery Attempts
3671
3701
  *
@@ -3728,9 +3758,75 @@ export type CreateWhatsAppBatchRequest = {
3728
3758
  variable_map: {
3729
3759
  [key: string]: string;
3730
3760
  };
3761
+ /**
3762
+ * Vars
3763
+ *
3764
+ * 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.
3765
+ */
3766
+ vars?: {
3767
+ [key: string]: string;
3768
+ } | null;
3731
3769
  window?: TimeWindow | null;
3732
3770
  };
3733
3771
 
3772
+ /**
3773
+ * CreateWhatsAppTemplateRequest
3774
+ */
3775
+ export type CreateWhatsAppTemplateRequest = {
3776
+ /**
3777
+ * Body
3778
+ *
3779
+ * Variables are named: `{{first_name}}`.
3780
+ */
3781
+ body: string;
3782
+ /**
3783
+ * Buttons
3784
+ */
3785
+ buttons?: Array<WhatsAppTemplateQuickReplyButtonInput | WhatsAppTemplateUrlButtonInput | WhatsAppTemplatePhoneButtonInput | WhatsAppTemplateVoiceCallButtonInput | WhatsAppTemplateCopyCodeButtonInput>;
3786
+ /**
3787
+ * Category
3788
+ */
3789
+ category: 'marketing' | 'utility';
3790
+ /**
3791
+ * Examples
3792
+ *
3793
+ * A realistic sample for every variable; WhatsApp reviews them.
3794
+ */
3795
+ examples?: {
3796
+ [key: string]: string;
3797
+ };
3798
+ /**
3799
+ * Footer
3800
+ */
3801
+ footer?: string | null;
3802
+ /**
3803
+ * Header
3804
+ */
3805
+ header?: ({
3806
+ type: 'text';
3807
+ } & WhatsAppTemplateTextHeaderInput) | ({
3808
+ type: 'document' | 'image' | 'video';
3809
+ } & WhatsAppTemplateMediaHeaderInput) | null;
3810
+ /**
3811
+ * Integration Id
3812
+ *
3813
+ * A Twilio WhatsApp sender; the template is account-wide.
3814
+ */
3815
+ integration_id: string;
3816
+ /**
3817
+ * Language
3818
+ *
3819
+ * One of the catalog's `whatsapp_template_languages`.
3820
+ */
3821
+ language: string;
3822
+ /**
3823
+ * Name
3824
+ *
3825
+ * Lowercase letters, digits and `_`.
3826
+ */
3827
+ name: string;
3828
+ };
3829
+
3734
3830
  /**
3735
3831
  * CreditBalanceResponse
3736
3832
  *
@@ -8721,8 +8817,35 @@ export type PatchWebhookRequest = {
8721
8817
  * PatchWhatsAppBatchRequest
8722
8818
  *
8723
8819
  * Edits. ``window``, ``start_at`` and ``send_daily_cap`` take ``null`` to clear.
8820
+ *
8821
+ * Any agent field replaces the batch's agent wholesale; all of them null returns
8822
+ * replies to the number's agent.
8724
8823
  */
8725
8824
  export type PatchWhatsAppBatchRequest = {
8825
+ /**
8826
+ * A complete agent definition, run for this call and stored nowhere. Mutually exclusive with `agent_id`.
8827
+ */
8828
+ agent?: AgentConfig | null;
8829
+ /**
8830
+ * Agent Id
8831
+ *
8832
+ * An agent in this workspace. Mutually exclusive with `agent`.
8833
+ */
8834
+ agent_id?: string | null;
8835
+ /**
8836
+ * 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.
8837
+ */
8838
+ agent_override?: AgentOverride | null;
8839
+ /**
8840
+ * Run several agents on this call, defined here. Mutually exclusive with `agent_id` / `agent` / `agent_version` / `agent_override`.
8841
+ */
8842
+ agent_team?: AgentTeam | null;
8843
+ /**
8844
+ * Agent Version
8845
+ *
8846
+ * 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.
8847
+ */
8848
+ agent_version?: number | 'draft' | null;
8726
8849
  /**
8727
8850
  * Delivery Attempts
8728
8851
  *
@@ -8765,6 +8888,14 @@ export type PatchWhatsAppBatchRequest = {
8765
8888
  variable_map?: {
8766
8889
  [key: string]: string;
8767
8890
  };
8891
+ /**
8892
+ * Vars
8893
+ *
8894
+ * 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.
8895
+ */
8896
+ vars?: {
8897
+ [key: string]: string;
8898
+ } | null;
8768
8899
  window?: TimeWindow | null;
8769
8900
  };
8770
8901
 
@@ -8897,8 +9028,34 @@ export type PlatformFeePerMinute = {
8897
9028
 
8898
9029
  /**
8899
9030
  * PostItemRequest
9031
+ *
9032
+ * The agent fields make that agent answer this person; omit them to continue whatever runs.
8900
9033
  */
8901
9034
  export type PostItemRequest = {
9035
+ /**
9036
+ * A complete agent definition, run for this call and stored nowhere. Mutually exclusive with `agent_id`.
9037
+ */
9038
+ agent?: AgentConfig | null;
9039
+ /**
9040
+ * Agent Id
9041
+ *
9042
+ * An agent in this workspace. Mutually exclusive with `agent`.
9043
+ */
9044
+ agent_id?: string | null;
9045
+ /**
9046
+ * 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.
9047
+ */
9048
+ agent_override?: AgentOverride | null;
9049
+ /**
9050
+ * Run several agents on this call, defined here. Mutually exclusive with `agent_id` / `agent` / `agent_version` / `agent_override`.
9051
+ */
9052
+ agent_team?: AgentTeam | null;
9053
+ /**
9054
+ * Agent Version
9055
+ *
9056
+ * 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.
9057
+ */
9058
+ agent_version?: number | 'draft' | null;
8902
9059
  /**
8903
9060
  * Who at your business posted this; shown in transcripts, never sent to the person or shown to the agent.
8904
9061
  */
@@ -8913,6 +9070,14 @@ export type PostItemRequest = {
8913
9070
  * fail refuses free text outside WhatsApp's 24h window; an opener sends that template and holds the message until they reply.
8914
9071
  */
8915
9072
  on_window_closed?: 'fail' | OpenerPolicy;
9073
+ /**
9074
+ * Secrets
9075
+ *
9076
+ * 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.
9077
+ */
9078
+ secrets?: {
9079
+ [key: string]: string;
9080
+ } | null;
8916
9081
  /**
8917
9082
  * For `template` only.
8918
9083
  */
@@ -8941,6 +9106,14 @@ export type PostItemRequest = {
8941
9106
  userdata?: {
8942
9107
  [key: string]: unknown;
8943
9108
  } | null;
9109
+ /**
9110
+ * Vars
9111
+ *
9112
+ * 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.
9113
+ */
9114
+ vars?: {
9115
+ [key: string]: string;
9116
+ } | null;
8944
9117
  };
8945
9118
 
8946
9119
  /**
@@ -13568,6 +13741,7 @@ export type WhatsAppBatchResponse = {
13568
13741
  * Agent Name
13569
13742
  */
13570
13743
  agent_name: string | null;
13744
+ agent_plan: StoredAgentPlan | null;
13571
13745
  counts: WhatsAppBatchCounts;
13572
13746
  /**
13573
13747
  * Created At
@@ -13617,6 +13791,10 @@ export type WhatsAppBatchResponse = {
13617
13791
  * Next Send Reason
13618
13792
  */
13619
13793
  next_send_reason: 'start' | 'window' | 'daily_cap' | 'retry' | 'gap' | null;
13794
+ /**
13795
+ * Own Agent
13796
+ */
13797
+ own_agent: boolean;
13620
13798
  /**
13621
13799
  * Send Daily Cap
13622
13800
  */
@@ -13653,7 +13831,7 @@ export type WhatsAppBatchResponse = {
13653
13831
  * Status
13654
13832
  */
13655
13833
  status: 'draft' | 'scheduled' | 'sending' | 'paused' | 'completed' | 'canceled' | 'failed';
13656
- template: WhatsAppTemplate;
13834
+ template: WhatsAppTemplateSnapshot;
13657
13835
  /**
13658
13836
  * Timezone
13659
13837
  */
@@ -13668,6 +13846,12 @@ export type WhatsAppBatchResponse = {
13668
13846
  variable_map: {
13669
13847
  [key: string]: string;
13670
13848
  };
13849
+ /**
13850
+ * Vars
13851
+ */
13852
+ vars: {
13853
+ [key: string]: string;
13854
+ } | null;
13671
13855
  window: TimeWindow | null;
13672
13856
  };
13673
13857
 
@@ -13774,7 +13958,7 @@ export type WhatsAppRecipientResponse = {
13774
13958
  /**
13775
13959
  * WhatsAppTemplate
13776
13960
  *
13777
- * The whole message: header, body, footer and buttons.
13961
+ * A template and where WhatsApp's review of it stands. Only `approved` can be sent.
13778
13962
  */
13779
13963
  export type WhatsAppTemplate = {
13780
13964
  /**
@@ -13788,7 +13972,17 @@ export type WhatsAppTemplate = {
13788
13972
  /**
13789
13973
  * Category
13790
13974
  */
13791
- category: string;
13975
+ category: 'marketing' | 'utility' | 'authentication';
13976
+ /**
13977
+ * Created At
13978
+ */
13979
+ created_at: string;
13980
+ /**
13981
+ * Examples
13982
+ */
13983
+ examples: {
13984
+ [key: string]: string;
13985
+ };
13792
13986
  /**
13793
13987
  * Footer
13794
13988
  */
@@ -13806,6 +14000,14 @@ export type WhatsAppTemplate = {
13806
14000
  * Name
13807
14001
  */
13808
14002
  name: string;
14003
+ /**
14004
+ * Rejection Reason
14005
+ */
14006
+ rejection_reason: string | null;
14007
+ /**
14008
+ * Status
14009
+ */
14010
+ status: 'pending' | 'approved' | 'rejected' | 'paused' | 'disabled';
13809
14011
  /**
13810
14012
  * Unsupported Reason
13811
14013
  */
@@ -13832,6 +14034,10 @@ export type WhatsAppTemplateButton = {
13832
14034
  * Text
13833
14035
  */
13834
14036
  text: string;
14037
+ /**
14038
+ * Ttl Minutes
14039
+ */
14040
+ ttl_minutes: number | null;
13835
14041
  /**
13836
14042
  * Type
13837
14043
  */
@@ -13842,6 +14048,22 @@ export type WhatsAppTemplateButton = {
13842
14048
  url: string | null;
13843
14049
  };
13844
14050
 
14051
+ /**
14052
+ * WhatsAppTemplateCopyCodeButtonInput
14053
+ *
14054
+ * WhatsApp labels it "Copy Code".
14055
+ */
14056
+ export type WhatsAppTemplateCopyCodeButtonInput = {
14057
+ /**
14058
+ * Code
14059
+ */
14060
+ code: string;
14061
+ /**
14062
+ * Type
14063
+ */
14064
+ type: 'copy_code';
14065
+ };
14066
+
13845
14067
  /**
13846
14068
  * WhatsAppTemplateHeader
13847
14069
  */
@@ -13860,6 +14082,151 @@ export type WhatsAppTemplateHeader = {
13860
14082
  url: string | null;
13861
14083
  };
13862
14084
 
14085
+ /**
14086
+ * WhatsAppTemplateMediaHeaderInput
14087
+ */
14088
+ export type WhatsAppTemplateMediaHeaderInput = {
14089
+ /**
14090
+ * Type
14091
+ */
14092
+ type: 'image' | 'video' | 'document';
14093
+ /**
14094
+ * Url
14095
+ *
14096
+ * A public https file; WhatsApp downloads it.
14097
+ */
14098
+ url: string;
14099
+ };
14100
+
14101
+ /**
14102
+ * WhatsAppTemplatePhoneButtonInput
14103
+ */
14104
+ export type WhatsAppTemplatePhoneButtonInput = {
14105
+ /**
14106
+ * Phone Number
14107
+ */
14108
+ phone_number: string;
14109
+ /**
14110
+ * Text
14111
+ */
14112
+ text: string;
14113
+ /**
14114
+ * Type
14115
+ */
14116
+ type: 'phone_number';
14117
+ };
14118
+
14119
+ /**
14120
+ * WhatsAppTemplateQuickReplyButtonInput
14121
+ */
14122
+ export type WhatsAppTemplateQuickReplyButtonInput = {
14123
+ /**
14124
+ * Text
14125
+ */
14126
+ text: string;
14127
+ /**
14128
+ * Type
14129
+ */
14130
+ type: 'quick_reply';
14131
+ };
14132
+
14133
+ /**
14134
+ * WhatsAppTemplateSnapshot
14135
+ *
14136
+ * The whole message as a batch sends it: header, body, footer and buttons.
14137
+ */
14138
+ export type WhatsAppTemplateSnapshot = {
14139
+ /**
14140
+ * Body
14141
+ */
14142
+ body: string;
14143
+ /**
14144
+ * Buttons
14145
+ */
14146
+ buttons: Array<WhatsAppTemplateButton>;
14147
+ /**
14148
+ * Category
14149
+ */
14150
+ category: 'marketing' | 'utility' | 'authentication';
14151
+ /**
14152
+ * Footer
14153
+ */
14154
+ footer: string | null;
14155
+ header: WhatsAppTemplateHeader | null;
14156
+ /**
14157
+ * Id
14158
+ */
14159
+ id: string;
14160
+ /**
14161
+ * Language
14162
+ */
14163
+ language: string;
14164
+ /**
14165
+ * Name
14166
+ */
14167
+ name: string;
14168
+ /**
14169
+ * Variables
14170
+ */
14171
+ variables: Array<string>;
14172
+ };
14173
+
14174
+ /**
14175
+ * WhatsAppTemplateTextHeaderInput
14176
+ */
14177
+ export type WhatsAppTemplateTextHeaderInput = {
14178
+ /**
14179
+ * Text
14180
+ */
14181
+ text: string;
14182
+ /**
14183
+ * Type
14184
+ */
14185
+ type: 'text';
14186
+ };
14187
+
14188
+ /**
14189
+ * WhatsAppTemplateUrlButtonInput
14190
+ */
14191
+ export type WhatsAppTemplateUrlButtonInput = {
14192
+ /**
14193
+ * Text
14194
+ */
14195
+ text: string;
14196
+ /**
14197
+ * Type
14198
+ */
14199
+ type: 'url';
14200
+ /**
14201
+ * Url
14202
+ *
14203
+ * May end in one variable, after a `/`.
14204
+ */
14205
+ url: string;
14206
+ };
14207
+
14208
+ /**
14209
+ * WhatsAppTemplateVoiceCallButtonInput
14210
+ *
14211
+ * Starts a WhatsApp call to the sending number.
14212
+ */
14213
+ export type WhatsAppTemplateVoiceCallButtonInput = {
14214
+ /**
14215
+ * Text
14216
+ */
14217
+ text: string;
14218
+ /**
14219
+ * Ttl Minutes
14220
+ *
14221
+ * How long the button works after sending. Default 7 days.
14222
+ */
14223
+ ttl_minutes?: number | null;
14224
+ /**
14225
+ * Type
14226
+ */
14227
+ type: 'voice_call';
14228
+ };
14229
+
13863
14230
  /**
13864
14231
  * WhatsAppTemplatesResponse
13865
14232
  */
@@ -23568,6 +23935,10 @@ export type WhatsappTemplatesListData = {
23568
23935
  * A connected WhatsApp sender.
23569
23936
  */
23570
23937
  integration_id: string;
23938
+ /**
23939
+ * Status
23940
+ */
23941
+ status?: Array<'pending' | 'approved' | 'rejected' | 'paused' | 'disabled'> | null;
23571
23942
  };
23572
23943
  url: '/v1/whatsapp/templates';
23573
23944
  };
@@ -23598,6 +23969,112 @@ export type WhatsappTemplatesListResults = {
23598
23969
 
23599
23970
  export type WhatsappTemplatesListResult = WhatsappTemplatesListResults[keyof WhatsappTemplatesListResults];
23600
23971
 
23972
+ export type WhatsappTemplatesCreateData = {
23973
+ body: CreateWhatsAppTemplateRequest;
23974
+ path?: never;
23975
+ query?: never;
23976
+ url: '/v1/whatsapp/templates';
23977
+ };
23978
+
23979
+ export type WhatsappTemplatesCreateErrors = {
23980
+ /**
23981
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
23982
+ */
23983
+ 400: ErrorResponse;
23984
+ /**
23985
+ * Missing credential, or one that is revoked or no longer a member of this organization.
23986
+ */
23987
+ 401: ErrorResponse;
23988
+ /**
23989
+ * Authenticated, but this organization role may not perform the operation.
23990
+ */
23991
+ 403: ErrorResponse;
23992
+ /**
23993
+ * The resource's current state forbids this — a name already taken, a job already running.
23994
+ */
23995
+ 409: ErrorResponse;
23996
+ /**
23997
+ * The request did not match this operation's schema; `detail.errors` lists each field.
23998
+ */
23999
+ 422: ErrorResponse;
24000
+ /**
24001
+ * Unexpected error. Every error this API returns carries this body.
24002
+ */
24003
+ default: ErrorResponse;
24004
+ };
24005
+
24006
+ export type WhatsappTemplatesCreateError = WhatsappTemplatesCreateErrors[keyof WhatsappTemplatesCreateErrors];
24007
+
24008
+ export type WhatsappTemplatesCreateResults = {
24009
+ /**
24010
+ * Successful Response
24011
+ */
24012
+ 201: WhatsAppTemplate;
24013
+ };
24014
+
24015
+ export type WhatsappTemplatesCreateResult = WhatsappTemplatesCreateResults[keyof WhatsappTemplatesCreateResults];
24016
+
24017
+ export type WhatsappTemplatesDeleteData = {
24018
+ body?: never;
24019
+ path: {
24020
+ /**
24021
+ * Template Id
24022
+ */
24023
+ template_id: string;
24024
+ };
24025
+ query: {
24026
+ /**
24027
+ * Integration Id
24028
+ *
24029
+ * A WhatsApp sender on the template's account.
24030
+ */
24031
+ integration_id: string;
24032
+ };
24033
+ url: '/v1/whatsapp/templates/{template_id}';
24034
+ };
24035
+
24036
+ export type WhatsappTemplatesDeleteErrors = {
24037
+ /**
24038
+ * Well-formed, but rejected by a rule; `detail.errors` lists each problem.
24039
+ */
24040
+ 400: ErrorResponse;
24041
+ /**
24042
+ * Missing credential, or one that is revoked or no longer a member of this organization.
24043
+ */
24044
+ 401: ErrorResponse;
24045
+ /**
24046
+ * Authenticated, but this organization role may not perform the operation.
24047
+ */
24048
+ 403: ErrorResponse;
24049
+ /**
24050
+ * No such resource in this organization.
24051
+ */
24052
+ 404: ErrorResponse;
24053
+ /**
24054
+ * The resource's current state forbids this — a name already taken, a job already running.
24055
+ */
24056
+ 409: ErrorResponse;
24057
+ /**
24058
+ * The request did not match this operation's schema; `detail.errors` lists each field.
24059
+ */
24060
+ 422: ErrorResponse;
24061
+ /**
24062
+ * Unexpected error. Every error this API returns carries this body.
24063
+ */
24064
+ default: ErrorResponse;
24065
+ };
24066
+
24067
+ export type WhatsappTemplatesDeleteError = WhatsappTemplatesDeleteErrors[keyof WhatsappTemplatesDeleteErrors];
24068
+
24069
+ export type WhatsappTemplatesDeleteResults = {
24070
+ /**
24071
+ * Successful Response
24072
+ */
24073
+ 200: OkResponse;
24074
+ };
24075
+
24076
+ export type WhatsappTemplatesDeleteResult = WhatsappTemplatesDeleteResults[keyof WhatsappTemplatesDeleteResults];
24077
+
23601
24078
  export type WhatsappTwilioSendersListData = {
23602
24079
  body: TwilioSendersRequest;
23603
24080
  path?: never;