@talqing/sdk 0.11.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.
@@ -885,7 +885,8 @@ export class Calls extends HeyApiClient {
885
885
  { in: 'query', key: 'outcome' },
886
886
  { in: 'query', key: 'contact_key' },
887
887
  { in: 'query', key: 'close_reason' },
888
- { in: 'query', key: 'batch_id' }
888
+ { in: 'query', key: 'batch_id' },
889
+ { in: 'query', key: 'metadata' }
889
890
  ] }]);
890
891
  return (options?.client ?? this.client).get({
891
892
  responseStyle: 'data',
@@ -1073,8 +1074,9 @@ export class Calls extends HeyApiClient {
1073
1074
  *
1074
1075
  * Mint a token for a new web call that continues one that ended.
1075
1076
  *
1076
- * It answers with the agent that held the floor, with the context it had. 409
1077
- * if the call is not a web call, is still ending, or was already resumed.
1077
+ * It answers with the agent that held the floor, with the context it had, in the
1078
+ * dropped call's region unless you pass `region`. 409 if the call is not a web
1079
+ * call, is still ending, or was already resumed.
1078
1080
  */
1079
1081
  resume(parameters, options) {
1080
1082
  const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'session_id' }, { key: 'resumeCallRequest', map: 'body' }] }]);
@@ -1468,7 +1470,8 @@ export class Chats extends HeyApiClient {
1468
1470
  { in: 'query', key: 'offset' },
1469
1471
  { in: 'query', key: 'agent_id' },
1470
1472
  { in: 'query', key: 'contact_key' },
1471
- { in: 'query', key: 'status' }
1473
+ { in: 'query', key: 'status' },
1474
+ { in: 'query', key: 'metadata' }
1472
1475
  ] }]);
1473
1476
  return (options?.client ?? this.client).get({
1474
1477
  responseStyle: 'data',
@@ -1599,6 +1602,30 @@ export class Chats extends HeyApiClient {
1599
1602
  }
1600
1603
  }
1601
1604
  export class Items2 extends HeyApiClient {
1605
+ /**
1606
+ * Create Conversation Item
1607
+ *
1608
+ * Post a template, agent text, note or instruction into a conversation, or start one with a person.
1609
+ */
1610
+ create(parameters, options) {
1611
+ const params = buildClientParams([parameters], [{ args: [{ key: 'postItemRequest', map: 'body' }] }]);
1612
+ return (options?.client ?? this.client).post({
1613
+ responseStyle: 'data',
1614
+ security: [{ scheme: 'bearer', type: 'http' }, {
1615
+ in: 'cookie',
1616
+ name: 'talqing_sid',
1617
+ type: 'apiKey'
1618
+ }],
1619
+ url: '/v1/conversations/items',
1620
+ ...options,
1621
+ ...params,
1622
+ headers: {
1623
+ 'Content-Type': 'application/json',
1624
+ ...options?.headers,
1625
+ ...params.headers
1626
+ }
1627
+ });
1628
+ }
1602
1629
  /**
1603
1630
  * List Conversation Items
1604
1631
  *
@@ -2748,6 +2775,107 @@ export class Faqs extends HeyApiClient {
2748
2775
  return this._entries ?? (this._entries = new Entries({ client: this.client }));
2749
2776
  }
2750
2777
  }
2778
+ export class InboundWebhook extends HeyApiClient {
2779
+ /**
2780
+ * Delete Inbound Webhook
2781
+ *
2782
+ * Remove the inbound session webhook.
2783
+ */
2784
+ delete(options) {
2785
+ return (options?.client ?? this.client).delete({
2786
+ responseStyle: 'data',
2787
+ security: [{ scheme: 'bearer', type: 'http' }, {
2788
+ in: 'cookie',
2789
+ name: 'talqing_sid',
2790
+ type: 'apiKey'
2791
+ }],
2792
+ url: '/v1/inbound-webhook',
2793
+ ...options
2794
+ });
2795
+ }
2796
+ /**
2797
+ * Get Inbound Webhook
2798
+ *
2799
+ * Get the workspace's inbound session webhook.
2800
+ */
2801
+ get(options) {
2802
+ return (options?.client ?? this.client).get({
2803
+ responseStyle: 'data',
2804
+ security: [{ scheme: 'bearer', type: 'http' }, {
2805
+ in: 'cookie',
2806
+ name: 'talqing_sid',
2807
+ type: 'apiKey'
2808
+ }],
2809
+ url: '/v1/inbound-webhook',
2810
+ ...options
2811
+ });
2812
+ }
2813
+ /**
2814
+ * Set Inbound Webhook
2815
+ *
2816
+ * Set the URL asked for an inbound session's configuration.
2817
+ */
2818
+ set(parameters, options) {
2819
+ const params = buildClientParams([parameters], [{ args: [{ key: 'setInboundWebhookRequest', map: 'body' }] }]);
2820
+ return (options?.client ?? this.client).put({
2821
+ responseStyle: 'data',
2822
+ security: [{ scheme: 'bearer', type: 'http' }, {
2823
+ in: 'cookie',
2824
+ name: 'talqing_sid',
2825
+ type: 'apiKey'
2826
+ }],
2827
+ url: '/v1/inbound-webhook',
2828
+ ...options,
2829
+ ...params,
2830
+ headers: {
2831
+ 'Content-Type': 'application/json',
2832
+ ...options?.headers,
2833
+ ...params.headers
2834
+ }
2835
+ });
2836
+ }
2837
+ /**
2838
+ * Rotate Inbound Webhook Secret
2839
+ *
2840
+ * Issue a new signing secret; the old one stops working at once.
2841
+ */
2842
+ rotateSecret(options) {
2843
+ return (options?.client ?? this.client).post({
2844
+ responseStyle: 'data',
2845
+ security: [{ scheme: 'bearer', type: 'http' }, {
2846
+ in: 'cookie',
2847
+ name: 'talqing_sid',
2848
+ type: 'apiKey'
2849
+ }],
2850
+ url: '/v1/inbound-webhook/rotate-secret',
2851
+ ...options
2852
+ });
2853
+ }
2854
+ /**
2855
+ * Test Inbound Webhook
2856
+ *
2857
+ * Send a sample request and check the reply against the response schema.
2858
+ */
2859
+ test(parameters, options) {
2860
+ const params = buildClientParams([parameters], [{ args: [{ key: 'testInboundWebhookRequest', map: 'body' }] }]);
2861
+ return (options?.client ?? this.client).post({
2862
+ responseStyle: 'data',
2863
+ security: [{ scheme: 'bearer', type: 'http' }, {
2864
+ in: 'cookie',
2865
+ name: 'talqing_sid',
2866
+ type: 'apiKey'
2867
+ }],
2868
+ url: '/v1/inbound-webhook/test',
2869
+ ...options,
2870
+ ...params,
2871
+ headers: {
2872
+ 'Content-Type': 'application/json',
2873
+ ...options?.headers,
2874
+ ...params.headers
2875
+ }
2876
+ });
2877
+ }
2878
+ }
2751
2879
  export class McpTools extends HeyApiClient {
2752
2880
  /**
2753
2881
  * List Integration Mcp Tools
@@ -3736,18 +3864,19 @@ export class Telephony extends HeyApiClient {
3736
3864
  return this._providers ?? (this._providers = new Providers({ client: this.client }));
3737
3865
  }
3738
3866
  }
3739
- export class Runs extends HeyApiClient {
3867
+ export class TaskRuns extends HeyApiClient {
3740
3868
  /**
3741
3869
  * List Task Runs
3742
3870
  *
3743
- * This task's runs, newest first, each with its output, trace and cost.
3744
- *
3745
- * `task_version` says which published definition each one ran, and is null for
3746
- * a run of the draft.
3871
+ * Task runs, newest first, without traces or inputs.
3747
3872
  */
3748
3873
  list(parameters, options) {
3749
3874
  const params = buildClientParams([parameters], [{ args: [
3750
- { in: 'path', key: 'task_id' },
3875
+ { in: 'query', key: 'task_id' },
3876
+ { in: 'query', key: 'status' },
3877
+ { in: 'query', key: 'metadata' },
3878
+ { in: 'query', key: 'created_after' },
3879
+ { in: 'query', key: 'created_before' },
3751
3880
  { in: 'query', key: 'limit' },
3752
3881
  { in: 'query', key: 'offset' }
3753
3882
  ] }]);
@@ -3758,7 +3887,7 @@ export class Runs extends HeyApiClient {
3758
3887
  name: 'talqing_sid',
3759
3888
  type: 'apiKey'
3760
3889
  }],
3761
- url: '/v1/tasks/{task_id}/runs',
3890
+ url: '/v1/task-runs',
3762
3891
  ...options,
3763
3892
  ...params
3764
3893
  });
@@ -3766,21 +3895,12 @@ export class Runs extends HeyApiClient {
3766
3895
  /**
3767
3896
  * Run Task
3768
3897
  *
3769
- * Run the task once with the variables you supply, and wait for the result.
3770
- *
3771
- * **This executes for real**: the tools call your endpoints with your secrets,
3772
- * the MCP servers spend your credits, and the model spends your tokens. A task
3773
- * that books a slot, charges a card or sends a message will do so.
3898
+ * Run a task for real: its tools, MCP servers and model all act and spend.
3774
3899
  *
3775
- * Runs the published version unless `version` names another one, or `"draft"`
3776
- * to run the unpublished config. `vars` must match what that version declares
3777
- * — an unknown name is refused rather than dropped. The response is the whole
3778
- * run: the structured `output`, a `trace` of every tool call, the steps used
3779
- * and what the tokens cost. On failure `error.type` says whose problem it is.
3780
- * Secrets are redacted.
3900
+ * Waits and returns the finished run, or with `background: true` queues it and returns 202.
3781
3901
  */
3782
3902
  create(parameters, options) {
3783
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'runTaskRequest', map: 'body' }] }]);
3903
+ const params = buildClientParams([parameters], [{ args: [{ key: 'createTaskRunRequest', map: 'body' }] }]);
3784
3904
  return (options?.client ?? this.client).post({
3785
3905
  responseStyle: 'data',
3786
3906
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -3788,7 +3908,7 @@ export class Runs extends HeyApiClient {
3788
3908
  name: 'talqing_sid',
3789
3909
  type: 'apiKey'
3790
3910
  }],
3791
- url: '/v1/tasks/{task_id}/runs',
3911
+ url: '/v1/task-runs',
3792
3912
  ...options,
3793
3913
  ...params,
3794
3914
  headers: {
@@ -3799,17 +3919,79 @@ export class Runs extends HeyApiClient {
3799
3919
  });
3800
3920
  }
3801
3921
  /**
3802
- * Get Task Run
3922
+ * Run Task Batch
3803
3923
  *
3804
- * One run in full: what it produced, every tool it called on the way, and
3805
- * what it cost.
3924
+ * Queue up to 1000 runs of one task, in the background. One invalid item refuses all.
3925
+ */
3926
+ createBatch(parameters, options) {
3927
+ const params = buildClientParams([parameters], [{ args: [{ key: 'createTaskRunBatchRequest', map: 'body' }] }]);
3928
+ return (options?.client ?? this.client).post({
3929
+ responseStyle: 'data',
3930
+ security: [{ scheme: 'bearer', type: 'http' }, {
3931
+ in: 'cookie',
3932
+ name: 'talqing_sid',
3933
+ type: 'apiKey'
3934
+ }],
3935
+ url: '/v1/task-runs/batch',
3936
+ ...options,
3937
+ ...params,
3938
+ headers: {
3939
+ 'Content-Type': 'application/json',
3940
+ ...options?.headers,
3941
+ ...params.headers
3942
+ }
3943
+ });
3944
+ }
3945
+ /**
3946
+ * Delete Task Runs
3806
3947
  *
3807
- * This is what answers "why did it write that" for a caller holding one run id
3808
- * — an email batch's review table links each drafted row here. Secret values
3809
- * are redacted from the trace, and a trace that was cut reports it.
3948
+ * Delete the content of every run whose metadata matches, as `delete_task_run` does.
3949
+ */
3950
+ deleteMany(parameters, options) {
3951
+ const params = buildClientParams([parameters], [{ args: [{ key: 'deleteTaskRunsRequest', map: 'body' }] }]);
3952
+ return (options?.client ?? this.client).post({
3953
+ responseStyle: 'data',
3954
+ security: [{ scheme: 'bearer', type: 'http' }, {
3955
+ in: 'cookie',
3956
+ name: 'talqing_sid',
3957
+ type: 'apiKey'
3958
+ }],
3959
+ url: '/v1/task-runs/delete',
3960
+ ...options,
3961
+ ...params,
3962
+ headers: {
3963
+ 'Content-Type': 'application/json',
3964
+ ...options?.headers,
3965
+ ...params.headers
3966
+ }
3967
+ });
3968
+ }
3969
+ /**
3970
+ * Delete Task Run
3971
+ *
3972
+ * Delete a run's inputs, files, output and trace; its cost and metadata stay.
3973
+ */
3974
+ delete(parameters, options) {
3975
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'run_id' }] }]);
3976
+ return (options?.client ?? this.client).delete({
3977
+ responseStyle: 'data',
3978
+ security: [{ scheme: 'bearer', type: 'http' }, {
3979
+ in: 'cookie',
3980
+ name: 'talqing_sid',
3981
+ type: 'apiKey'
3982
+ }],
3983
+ url: '/v1/task-runs/{run_id}',
3984
+ ...options,
3985
+ ...params
3986
+ });
3987
+ }
3988
+ /**
3989
+ * Get Task Run
3990
+ *
3991
+ * One run in full: its config, inputs, output, trace and cost. Secrets are redacted.
3810
3992
  */
3811
3993
  get(parameters, options) {
3812
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'run_id' }] }]);
3994
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'run_id' }] }]);
3813
3995
  return (options?.client ?? this.client).get({
3814
3996
  responseStyle: 'data',
3815
3997
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -3817,7 +3999,26 @@ export class Runs extends HeyApiClient {
3817
3999
  name: 'talqing_sid',
3818
4000
  type: 'apiKey'
3819
4001
  }],
3820
- url: '/v1/tasks/{task_id}/runs/{run_id}',
4002
+ url: '/v1/task-runs/{run_id}',
4003
+ ...options,
4004
+ ...params
4005
+ });
4006
+ }
4007
+ /**
4008
+ * Cancel Task Run
4009
+ *
4010
+ * Cancel a queued or background run. A running one stops within seconds.
4011
+ */
4012
+ cancel(parameters, options) {
4013
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'run_id' }] }]);
4014
+ return (options?.client ?? this.client).post({
4015
+ responseStyle: 'data',
4016
+ security: [{ scheme: 'bearer', type: 'http' }, {
4017
+ in: 'cookie',
4018
+ name: 'talqing_sid',
4019
+ type: 'apiKey'
4020
+ }],
4021
+ url: '/v1/task-runs/{run_id}/cancel',
3821
4022
  ...options,
3822
4023
  ...params
3823
4024
  });
@@ -3906,7 +4107,7 @@ export class Tasks2 extends HeyApiClient {
3906
4107
  * `output` is what makes this a task rather than a chat agent — declare the
3907
4108
  * fields the model must produce and it is given a `submit_result` tool built
3908
4109
  * from them. `vars` are its inputs, read as `{{vars.name}}`. The task starts
3909
- * unpublished; publish it before running it.
4110
+ * unpublished; publish it before running it with `POST /task-runs`.
3910
4111
  */
3911
4112
  create(parameters, options) {
3912
4113
  const params = buildClientParams([parameters], [{ args: [{ key: 'createTaskRequest', map: 'body' }] }]);
@@ -4041,9 +4242,6 @@ export class Tasks2 extends HeyApiClient {
4041
4242
  ...params
4042
4243
  });
4043
4244
  }
4044
- get runs() {
4045
- return this._runs ?? (this._runs = new Runs({ client: this.client }));
4046
- }
4047
4245
  get versions() {
4048
4246
  return this._versions ?? (this._versions = new Versions2({ client: this.client }));
4049
4247
  }
@@ -4911,6 +5109,9 @@ export class TalqingApi extends HeyApiClient {
4911
5109
  get faqs() {
4912
5110
  return this._faqs ?? (this._faqs = new Faqs({ client: this.client }));
4913
5111
  }
5112
+ get inboundWebhook() {
5113
+ return this._inboundWebhook ?? (this._inboundWebhook = new InboundWebhook({ client: this.client }));
5114
+ }
4914
5115
  get integrations() {
4915
5116
  return this._integrations ?? (this._integrations = new Integrations({ client: this.client }));
4916
5117
  }
@@ -4926,6 +5127,9 @@ export class TalqingApi extends HeyApiClient {
4926
5127
  get telephony() {
4927
5128
  return this._telephony ?? (this._telephony = new Telephony({ client: this.client }));
4928
5129
  }
5130
+ get taskRuns() {
5131
+ return this._taskRuns ?? (this._taskRuns = new TaskRuns({ client: this.client }));
5132
+ }
4929
5133
  get tasks() {
4930
5134
  return this._tasks ?? (this._tasks = new Tasks2({ client: this.client }));
4931
5135
  }