@arbol-ai/sdk 5.38.1 → 5.40.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.
@@ -22,7 +22,7 @@ export interface AccountPermission {
22
22
  /**
23
23
  * The product or integration the permission belongs to.
24
24
  */
25
- group: "raiz" | "agenda" | "ambar" | "sura" | "visoft" | "salud-total" | "nueva-eps" | "comfachoco" | "account";
25
+ group: "raiz" | "agenda" | "ambar" | "sura" | "visoft" | "salud-total" | "nueva-eps" | "comfachoco" | "oficlinic" | "sanitas" | "account";
26
26
  value: string;
27
27
  }
28
28
  export interface AccountPermissionPage {
@@ -1,6 +1,7 @@
1
1
  import { type BaseClientOptions, Transport } from "../_/index.js";
2
2
  import { type Client as AuthorizationsClient } from "./authorizations/client.js";
3
3
  import { type Client as ConnectionsClient } from "./connections/client.js";
4
+ import { type Client as CoverageClient } from "./coverage/client.js";
4
5
  import { type Client as EligibilityClient } from "./eligibility/client.js";
5
6
  import { type Client as ProviderClient } from "./provider/client.js";
6
7
  export interface ClientOptions extends BaseClientOptions {
@@ -12,6 +13,7 @@ export interface ClientOptions extends BaseClientOptions {
12
13
  export interface Client {
13
14
  readonly authorizations: AuthorizationsClient;
14
15
  readonly connections: ConnectionsClient;
16
+ readonly coverage: CoverageClient;
15
17
  readonly eligibility: EligibilityClient;
16
18
  readonly provider: ProviderClient;
17
19
  }
@@ -3,6 +3,7 @@
3
3
  import { Transport } from "../_/index.js";
4
4
  import { bind as bindAuthorizations, } from "./authorizations/client.js";
5
5
  import { bind as bindConnections, } from "./connections/client.js";
6
+ import { bind as bindCoverage, } from "./coverage/client.js";
6
7
  import { bind as bindEligibility, } from "./eligibility/client.js";
7
8
  import { bind as bindProvider, } from "./provider/client.js";
8
9
  export function createClient(options) {
@@ -11,6 +12,7 @@ export function createClient(options) {
11
12
  export function bind(transport) {
12
13
  let authorizationsClient;
13
14
  let connectionsClient;
15
+ let coverageClient;
14
16
  let eligibilityClient;
15
17
  let providerClient;
16
18
  return {
@@ -20,6 +22,9 @@ export function bind(transport) {
20
22
  get connections() {
21
23
  return (connectionsClient ??= bindConnections(transport));
22
24
  },
25
+ get coverage() {
26
+ return (coverageClient ??= bindCoverage(transport));
27
+ },
23
28
  get eligibility() {
24
29
  return (eligibilityClient ??= bindEligibility(transport));
25
30
  },
@@ -0,0 +1,24 @@
1
+ import { type BaseClientOptions, type RequestOptions, Transport } from "../../_/index.js";
2
+ import type { AxxaLookupCoverageBody, AxxaLookupCoverageResultResponse } from "./models.js";
3
+ export interface ClientOptions extends BaseClientOptions {
4
+ /**
5
+ * The URL the paths of the API are relative to.
6
+ */
7
+ baseUrl: string;
8
+ }
9
+ export interface Client {
10
+ /**
11
+ * Look up coverage of a service
12
+ *
13
+ * Read whether a person's plan and this provider cover one exact service code
14
+ * in one service category, whether it requires an authorization and, when
15
+ * both cover it, the voucher quote. AXA lists each service under one
16
+ * category, so service_not_found there does not mean it is not covered.
17
+ * Generates no authorization.
18
+ */
19
+ lookup(request: LookupRequest, options?: RequestOptions): Promise<LookupResponse>;
20
+ }
21
+ export declare function createClient(options: ClientOptions): Client;
22
+ export declare function bind(transport: Transport): Client;
23
+ export type LookupRequest = AxxaLookupCoverageBody;
24
+ export type LookupResponse = AxxaLookupCoverageResultResponse;
@@ -0,0 +1,18 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ import { Transport, } from "../../_/index.js";
4
+ export function createClient(options) {
5
+ return bind(new Transport(options));
6
+ }
7
+ export function bind(transport) {
8
+ return {
9
+ lookup: (request, options) => transport.send(LookupOperation, request, options),
10
+ };
11
+ }
12
+ const LookupOperation = {
13
+ method: "POST",
14
+ route: "/v1/axxa/coverage/lookup",
15
+ body: "flat",
16
+ response: null,
17
+ errors: { "400": true, "401": true, "403": true, "404": true, "409": true, "413": true, "415": true, "428": true, "429": true, "500": true, "502": true, "503": true, "504": true },
18
+ };
@@ -0,0 +1,5 @@
1
+ export { ApiError } from "../../_/index.js";
2
+ export type { RequestOptions } from "../../_/index.js";
3
+ export { createClient } from "./client.js";
4
+ export type { Client, ClientOptions, LookupRequest, LookupResponse, } from "./client.js";
5
+ export type { AxxaLookupCoverageBadGatewayError, AxxaLookupCoverageBadGatewayFailure, AxxaLookupCoverageBody, AxxaLookupCoverageConflictError, AxxaLookupCoverageConflictFailure, AxxaLookupCoverageForbiddenError, AxxaLookupCoverageForbiddenFailure, AxxaLookupCoverageResult, AxxaLookupCoverageResultResponse, AxxaLookupCoverageServiceUnavailableError, AxxaLookupCoverageServiceUnavailableFailure, AxxaLookupCoverageTooManyRequestsError, AxxaLookupCoverageTooManyRequestsFailure, } from "./models.js";
@@ -0,0 +1,4 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export { ApiError } from "../../_/index.js";
4
+ export { createClient } from "./client.js";
@@ -0,0 +1,139 @@
1
+ import type { ForbiddenFailure, OutcomeUnknownFailure, RateLimitedFailure, ResponseMetadata, UpstreamUnavailableFailure } from "../../models.js";
2
+ import type { AxxaAccountMismatchFailure, AxxaCaptchaPausedFailure, AxxaCaptchaUnavailableFailure, AxxaLoginCooldownFailure, AxxaLoginRejectedFailure, AxxaNotConfiguredFailure, AxxaPortalChangedFailure, AxxaPortalUnavailableFailure, AxxaSessionBusyFailure, AxxaSessionRequiredFailure } from "../models.js";
3
+ /**
4
+ * A failed answer.
5
+ */
6
+ export interface AxxaLookupCoverageBadGatewayError {
7
+ data: null;
8
+ error: AxxaLookupCoverageBadGatewayFailure;
9
+ /**
10
+ * What every answer carries besides its data or error.
11
+ */
12
+ metadata: ResponseMetadata;
13
+ success: false;
14
+ }
15
+ export type AxxaLookupCoverageBadGatewayFailure = OutcomeUnknownFailure | AxxaPortalChangedFailure;
16
+ export interface AxxaLookupCoverageBody {
17
+ connectionId?: string;
18
+ /**
19
+ * The plan to read, from an eligibility lookup. Required only when the person
20
+ * has several.
21
+ */
22
+ contractNumber?: string;
23
+ /**
24
+ * The exact service code. Only this code is answered, never one that merely
25
+ * starts with it.
26
+ */
27
+ cupsCode: string;
28
+ documentNumber: string;
29
+ documentType: "CC" | "CE" | "TI" | "RC" | "PA";
30
+ serviceType: "outpatient" | "emergency" | "laboratory" | "therapy" | "radiology" | "other";
31
+ }
32
+ /**
33
+ * A failed answer.
34
+ */
35
+ export interface AxxaLookupCoverageConflictError {
36
+ data: null;
37
+ error: AxxaLookupCoverageConflictFailure;
38
+ /**
39
+ * What every answer carries besides its data or error.
40
+ */
41
+ metadata: ResponseMetadata;
42
+ success: false;
43
+ }
44
+ export type AxxaLookupCoverageConflictFailure = AxxaNotConfiguredFailure | AxxaSessionRequiredFailure | AxxaSessionBusyFailure;
45
+ /**
46
+ * A failed answer.
47
+ */
48
+ export interface AxxaLookupCoverageForbiddenError {
49
+ data: null;
50
+ error: AxxaLookupCoverageForbiddenFailure;
51
+ /**
52
+ * What every answer carries besides its data or error.
53
+ */
54
+ metadata: ResponseMetadata;
55
+ success: false;
56
+ }
57
+ export type AxxaLookupCoverageForbiddenFailure = ForbiddenFailure | AxxaLoginRejectedFailure | AxxaAccountMismatchFailure;
58
+ /**
59
+ * AXA's answer for one exact service, in one service category. Affiliation,
60
+ * coverage, authorization and the voucher are separate facts, and none confirms
61
+ * an appointment.
62
+ */
63
+ export interface AxxaLookupCoverageResult {
64
+ plans: {
65
+ contractNumber: string;
66
+ name: string;
67
+ notice: string | null;
68
+ }[];
69
+ selectedPlan: {
70
+ contractNumber: string;
71
+ name: string;
72
+ notice: string | null;
73
+ } | null;
74
+ service: {
75
+ affiliateCovered: boolean;
76
+ authorizationRequired: boolean | null;
77
+ cupsCode: string;
78
+ description: string;
79
+ providerCovered: boolean;
80
+ } | null;
81
+ /**
82
+ * found: the service exists in this category. service_not_found: this
83
+ * category does not list that code; another category may. plan_required: name
84
+ * one of the plans. plan_restricted: AXA offers no service search on this
85
+ * plan, see its notice. validation_required: see the messages.
86
+ */
87
+ status: "found" | "service_not_found" | "plan_required" | "plan_restricted" | "validation_required";
88
+ validationMessages: string[];
89
+ /**
90
+ * Read only when both coverages hold.
91
+ */
92
+ voucher: {
93
+ amount: number | null;
94
+ status: "quoted" | "not_enabled" | "unavailable";
95
+ } | null;
96
+ }
97
+ /**
98
+ * A successful answer.
99
+ */
100
+ export interface AxxaLookupCoverageResultResponse {
101
+ /**
102
+ * AXA's answer for one exact service, in one service category. Affiliation,
103
+ * coverage, authorization and the voucher are separate facts, and none
104
+ * confirms an appointment.
105
+ */
106
+ data: AxxaLookupCoverageResult;
107
+ error: null;
108
+ /**
109
+ * What every answer carries besides its data or error.
110
+ */
111
+ metadata: ResponseMetadata;
112
+ success: true;
113
+ }
114
+ /**
115
+ * A failed answer.
116
+ */
117
+ export interface AxxaLookupCoverageServiceUnavailableError {
118
+ data: null;
119
+ error: AxxaLookupCoverageServiceUnavailableFailure;
120
+ /**
121
+ * What every answer carries besides its data or error.
122
+ */
123
+ metadata: ResponseMetadata;
124
+ success: false;
125
+ }
126
+ export type AxxaLookupCoverageServiceUnavailableFailure = UpstreamUnavailableFailure | AxxaCaptchaUnavailableFailure | AxxaCaptchaPausedFailure | AxxaPortalUnavailableFailure;
127
+ /**
128
+ * A failed answer.
129
+ */
130
+ export interface AxxaLookupCoverageTooManyRequestsError {
131
+ data: null;
132
+ error: AxxaLookupCoverageTooManyRequestsFailure;
133
+ /**
134
+ * What every answer carries besides its data or error.
135
+ */
136
+ metadata: ResponseMetadata;
137
+ success: false;
138
+ }
139
+ export type AxxaLookupCoverageTooManyRequestsFailure = RateLimitedFailure | AxxaLoginCooldownFailure;
@@ -0,0 +1,3 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export {};
@@ -58,8 +58,8 @@ export interface Client {
58
58
  *
59
59
  * Change an Agent: instructions, first message, name, language, time zone,
60
60
  * settings, integration tools, Knowledge, procedures, connection procedures
61
- * or status. Omitted fields stay and `null` clears one; `settings`,
62
- * `integrationTools`, `integrationProcedures`, `procedures` and
61
+ * or status. Omitted fields stay and `null` clears one, also inside
62
+ * `settings`; `integrationTools`, `integrationProcedures`, `procedures` and
63
63
  * `knowledgeDocumentIds` replace the whole value when given (keep each
64
64
  * existing procedure's `id`), so read the Agent with `get_agent` first and
65
65
  * send its `version` as `expectedVersion` (VERSION_CONFLICT: read it again).
@@ -109,9 +109,11 @@ export interface CreateRequest {
109
109
  */
110
110
  procedures?: RaizAgentProcedureInput[];
111
111
  /**
112
- * How the Agent behaves. In an update, the complete new settings: keys left
113
- * out return to their default. Text and voice settings apply only to Agents
114
- * of that modality.
112
+ * How the Agent behaves. In an update, only the keys you send change: a key
113
+ * left out stays and `null` returns it to its default. A key's own value,
114
+ * such as `policy` or `voice`, is replaced whole. An update that changes
115
+ * `modality` starts from the defaults. Text and voice settings apply only to
116
+ * Agents of that modality.
115
117
  */
116
118
  settings?: RaizAgentSettingsInput;
117
119
  /**
@@ -223,9 +225,11 @@ export interface UpdateRequest {
223
225
  */
224
226
  procedures?: RaizAgentProcedureInput[];
225
227
  /**
226
- * How the Agent behaves. In an update, the complete new settings: keys left
227
- * out return to their default. Text and voice settings apply only to Agents
228
- * of that modality.
228
+ * How the Agent behaves. In an update, only the keys you send change: a key
229
+ * left out stays and `null` returns it to its default. A key's own value,
230
+ * such as `policy` or `voice`, is replaced whole. An update that changes
231
+ * `modality` starts from the defaults. Text and voice settings apply only to
232
+ * Agents of that modality.
229
233
  */
230
234
  settings?: RaizAgentSettingsInput;
231
235
  /**
@@ -320,6 +320,7 @@ export interface RaizAgentSettings {
320
320
  automaticKnowledge: boolean | null;
321
321
  budgetExhaustedMessage: string | null;
322
322
  closingMessage: string | null;
323
+ deferLongOperations: boolean | null;
323
324
  evalGate: boolean | null;
324
325
  followUpAfterMinutes: number | null;
325
326
  followUpMessage: string | null;
@@ -362,6 +363,7 @@ export interface RaizAgentSettingsInput {
362
363
  budgetExhaustedMessage?: string | null;
363
364
  businessHours?: RaizBusinessHours | null;
364
365
  closingMessage?: string | null;
366
+ deferLongOperations?: boolean | null;
365
367
  evalGate?: boolean | null;
366
368
  followUpAfterMinutes?: number | null;
367
369
  followUpMessage?: string | null;
@@ -1,6 +1,6 @@
1
1
  import { type BaseClientOptions, type RequestOptions, Transport } from "../../_/index.js";
2
2
  import type { RaizContactHoursWindow, RaizResponseMetadata } from "../models.js";
3
- import { type RaizCampaign, type RaizCampaignPage, type RaizCampaignRecipientInput } from "./models.js";
3
+ import { type RaizCampaign, type RaizCampaignPage, type RaizCampaignRecipientInput, type RaizCampaignTemplateInput } from "./models.js";
4
4
  export interface ClientOptions extends BaseClientOptions {
5
5
  /**
6
6
  * The URL the paths of the API are relative to.
@@ -9,17 +9,22 @@ export interface ClientOptions extends BaseClientOptions {
9
9
  }
10
10
  export interface Client {
11
11
  /**
12
- * Create a call campaign
12
+ * Create a campaign
13
13
  *
14
- * Prepare an outbound call campaign for a voice Agent with up to 10000
15
- * recipients, each a phone `address` with an optional `contactId`,
16
- * `variables`, `firstMessage` and `instructions`. Nobody is called until it
17
- * is started. Each recipient's contact is the one it names, or the owner of
18
- * its number (created when none exists). Calls happen only inside
19
- * `contactHours` (in `timeZone`, the organization's by default) and between
20
- * `scheduledStartAt` and `scheduledEndAt`; each recipient gets up to
21
- * `maxAttempts` calls, retried `retryAfterMinutes` later after the results in
22
- * `retryOn` (`no_answer`, `failure`). Starting it (REST `POST
14
+ * Prepare a campaign with up to 10000 recipients, each a phone `address` with
15
+ * an optional `contactId` and `variables`. A call campaign (the default) has
16
+ * a voice Agent call each one. With `channelType: whatsapp` and an approved
17
+ * `template`, each one is sent the template, its `parameters` filled from
18
+ * their `variables` (`{{name}}`), and its text Agent answers whoever replies.
19
+ * Nobody is reached until it is started. A list adds nobody to the
20
+ * organization's contacts: a recipient becomes the contact it names, or the
21
+ * owner of its number (created when none exists), when the campaign first
22
+ * reaches them. A longer list continues with `updateCampaign` and
23
+ * `addRecipients`. Nothing happens outside `contactHours` (in `timeZone`, the
24
+ * organization's by default) or outside `scheduledStartAt` and
25
+ * `scheduledEndAt`; each recipient gets up to `maxAttempts` attempts,
26
+ * `retryAfterMinutes` apart, after the results in `retryOn`. Read it with
27
+ * `expand=readiness` to see whether it can start. Starting it (REST `POST
23
28
  * /v1/campaigns/{campaignId}/start`) is not an AI tool. Read the
24
29
  * `run-a-campaign` skill.
25
30
  */
@@ -27,19 +32,22 @@ export interface Client {
27
32
  /**
28
33
  * Get a campaign
29
34
  *
30
- * Read one campaign: Agent, schedule, contact hours, retries and progress.
31
- * `expand=recipients` adds its recipients in the order they were added, each
32
- * with attempts, next attempt, error and latest call; continue with
33
- * `recipientsCursor` (`recipientsDirection` reads the other way). Read it
34
- * before `update_campaign` and send `expectedVersion`.
35
+ * Read one campaign: Agent, schedule, contact hours, retries, progress and,
36
+ * in `errorCode`, why it cannot reach anyone now. `expand=recipients` adds
37
+ * its recipients in the order they were added, each with attempts, next
38
+ * attempt, error and latest call or message; continue with `recipientsCursor`
39
+ * (`recipientsDirection` reads the other way). `expand=readiness` says
40
+ * whether it can start and lists what has to be fixed first, without reaching
41
+ * anyone. Read it before `update_campaign` and send `expectedVersion`.
35
42
  */
36
43
  get(request: GetRequest, options?: RequestOptions): Promise<GetResponse>;
37
44
  /**
38
45
  * List campaigns
39
46
  *
40
- * List the organization's call campaigns, newest first, each with its
41
- * progress (recipients pending, in progress, completed, failed and
42
- * succeeded). Filter by `status` or `agentId`. A campaign's calls:
47
+ * List the organization's campaigns, newest first, each with its progress
48
+ * (recipients pending, in progress, completed, failed and succeeded; on
49
+ * WhatsApp also delivered, read and replied). Filter by `channelType`,
50
+ * `status` or `agentId`. A campaign's calls and messages:
43
51
  * `list_conversations` with `campaignId`; its numbers by day: `get_report`
44
52
  * with `name: campaign_progress`.
45
53
  */
@@ -48,61 +56,57 @@ export interface Client {
48
56
  * Update a campaign
49
57
  *
50
58
  * Change a campaign. Omitted fields stay. `paused: true` pauses a started
51
- * campaign (no new call starts; calls in progress finish) and `paused: false`
52
- * resumes it, with the same checks as starting. Before the start,
53
- * `recipients` is the complete set (matched by `address`); once started it
54
- * only adds, so send a long list in batches. The Agent changes only before
55
- * the start, and a completed campaign accepts only its name and metadata.
59
+ * campaign (no new call or message starts; those in progress finish) and
60
+ * `paused: false` resumes it, with the same checks as starting. Before the
61
+ * start, `recipients` is the complete set, replacing whoever was there; once
62
+ * started it only adds. `addRecipients` adds at any moment, which is how a
63
+ * list longer than one request arrives: a number the campaign already has is
64
+ * skipped, so repeating a part reaches nobody twice. The Agent changes only
65
+ * before the start, and a completed campaign accepts only its name and
66
+ * metadata. A change lifts the wait of a campaign held by `errorCode`: fixing
67
+ * a template and sending it here tries again at once.
56
68
  */
57
69
  update(request: UpdateRequest, options?: RequestOptions): Promise<UpdateResponse>;
58
70
  }
59
71
  export declare function createClient(options: ClientOptions): Client;
60
72
  export declare function bind(transport: Transport): Client;
61
- export interface CreateRequest {
62
- /**
63
- * Agent id.
64
- */
73
+ export type CreateRequest = {
65
74
  agentId: string;
66
75
  channelId?: string | null;
67
- /**
68
- * When calls may start, in the campaign's time zone. Empty: any time.
69
- */
76
+ channelType?: "voice";
70
77
  contactHours?: RaizContactHoursWindow[];
71
78
  firstMessage?: string | null;
72
79
  instructions?: string | null;
73
- /**
74
- * Calls per recipient at most, retries included. Default 1.
75
- */
76
80
  maxAttempts?: number;
77
- /**
78
- * Your own keys and labels for this resource (up to 50 keys of 40 characters;
79
- * values up to 500 characters). Raíz never interprets them.
80
- */
81
81
  metadata?: {
82
82
  [key: string]: unknown;
83
83
  };
84
84
  name: string;
85
- /**
86
- * Who to call, unique by `address`. A recipient's contact is `contactId`, or
87
- * else the contact that owns its number (created when the organization has
88
- * none).
89
- */
90
85
  recipients?: RaizCampaignRecipientInput[];
91
- /**
92
- * Wait before a retry. Default 60.
93
- */
94
86
  retryAfterMinutes?: number;
95
- /**
96
- * Which results earn a retry. Default `["no_answer"]`.
97
- */
98
87
  retryOn?: ("no_answer" | "failure")[];
99
88
  scheduledEndAt?: Temporal.Instant | null;
100
89
  scheduledStartAt?: Temporal.Instant | null;
101
- /**
102
- * IANA time zone name.
103
- */
104
90
  timeZone?: string;
105
- }
91
+ } | {
92
+ agentId: string;
93
+ channelId?: string | null;
94
+ channelType: "whatsapp";
95
+ contactHours?: RaizContactHoursWindow[];
96
+ instructions?: string | null;
97
+ maxAttempts?: number;
98
+ metadata?: {
99
+ [key: string]: unknown;
100
+ };
101
+ name: string;
102
+ recipients?: RaizCampaignRecipientInput[];
103
+ retryAfterMinutes?: number;
104
+ retryOn?: ("no_answer" | "not_delivered")[];
105
+ scheduledEndAt?: Temporal.Instant | null;
106
+ scheduledStartAt?: Temporal.Instant | null;
107
+ template: RaizCampaignTemplateInput;
108
+ timeZone?: string;
109
+ };
106
110
  export interface CreateResponse {
107
111
  data: RaizCampaign;
108
112
  error: null;
@@ -115,7 +119,7 @@ export interface GetRequest {
115
119
  */
116
120
  campaignId: string;
117
121
  /**
118
- * Related data to include, comma-separated: `recipients`.
122
+ * Related data to include, comma-separated: `recipients`, `readiness`.
119
123
  */
120
124
  expand?: string;
121
125
  /**
@@ -131,6 +135,18 @@ export interface GetRequest {
131
135
  * Maximum `recipients` items in one page. Defaults to 100.
132
136
  */
133
137
  recipientsLimit?: number;
138
+ /**
139
+ * With `expand=recipients`: only those whose number contains these digits or
140
+ * whose name contains this text.
141
+ */
142
+ recipientsQ?: string;
143
+ /**
144
+ * `pending`: waiting for its (next) call or message. `in_progress`: being
145
+ * called, or on WhatsApp waiting for a reply until a reminder is due.
146
+ * `completed`: an attempt succeeded; on WhatsApp, the message arrived.
147
+ * `failed`: its attempts ran out, or it cannot be reached.
148
+ */
149
+ recipientsStatus?: "pending" | "in_progress" | "completed" | "failed" | "cancelled";
134
150
  }
135
151
  export interface GetResponse {
136
152
  data: RaizCampaign;
@@ -157,9 +173,13 @@ export interface ListRequest {
157
173
  */
158
174
  agentId?: string;
159
175
  /**
160
- * `queued`: not started yet (or its start is scheduled). `running`: calling
161
- * due recipients. `paused`: started, then paused; calls in progress finish.
162
- * `completed`: no recipient is left to call.
176
+ * How the campaign reaches people: by call or by WhatsApp.
177
+ */
178
+ channelType?: "voice" | "whatsapp";
179
+ /**
180
+ * `queued`: not started yet (or its start is scheduled). `running`: reaching
181
+ * due recipients. `paused`: started, then paused; what is in progress
182
+ * finishes. `completed`: no recipient is left to reach.
163
183
  */
164
184
  status?: "queued" | "running" | "paused" | "completed" | "cancelled" | "failed";
165
185
  }
@@ -174,13 +194,21 @@ export interface UpdateRequest {
174
194
  * Campaign id.
175
195
  */
176
196
  campaignId: string;
197
+ /**
198
+ * Adds these recipients, before or after the start, skipping numbers the
199
+ * campaign already has. A list longer than one request arrives in parts this
200
+ * way, and repeating a part reaches nobody twice.
201
+ */
202
+ addRecipients?: RaizCampaignRecipientInput[];
177
203
  /**
178
204
  * Changes only before the campaign starts.
179
205
  */
180
206
  agentId?: string;
181
207
  channelId?: string | null;
182
208
  /**
183
- * When calls may start, in the campaign's time zone. Empty: any time.
209
+ * When calls may start and messages may leave, in the campaign's time zone.
210
+ * Empty: any time. Public holidays count like any other day: whether to reach
211
+ * people on one is the organization's decision.
184
212
  */
185
213
  contactHours?: RaizContactHoursWindow[];
186
214
  /**
@@ -191,7 +219,7 @@ export interface UpdateRequest {
191
219
  firstMessage?: string | null;
192
220
  instructions?: string | null;
193
221
  /**
194
- * Calls per recipient at most, retries included. Default 1.
222
+ * Calls or messages per recipient at most, retries included.
195
223
  */
196
224
  maxAttempts?: number;
197
225
  /**
@@ -208,22 +236,26 @@ export interface UpdateRequest {
208
236
  */
209
237
  paused?: boolean;
210
238
  /**
211
- * Before the campaign starts: the complete set, matched by `address` (listed
212
- * recipients get these values, new ones are added, missing ones are removed).
213
- * Once it started: only additions, so a long list can be sent in batches;
214
- * addresses already in the campaign are left as they are, listed or not.
239
+ * Before the campaign starts: the complete set, replacing whoever was there.
240
+ * Once it started: only adds, skipping numbers it already has.
215
241
  */
216
242
  recipients?: RaizCampaignRecipientInput[];
217
243
  /**
218
- * Wait before a retry. Default 60.
244
+ * Wait before a retry or reminder, up to a week.
219
245
  */
220
246
  retryAfterMinutes?: number;
221
247
  /**
222
- * Which results earn a retry. Default `["no_answer"]`.
248
+ * What earns another attempt: `no_answer` and `failure` on a call,
249
+ * `no_answer` and `not_delivered` on WhatsApp.
223
250
  */
224
- retryOn?: ("no_answer" | "failure")[];
251
+ retryOn?: ("no_answer" | "failure" | "not_delivered")[];
225
252
  scheduledEndAt?: Temporal.Instant | null;
226
253
  scheduledStartAt?: Temporal.Instant | null;
254
+ /**
255
+ * WhatsApp only. On a started campaign it applies to the messages still to
256
+ * go.
257
+ */
258
+ template?: RaizCampaignTemplateInput;
227
259
  /**
228
260
  * IANA time zone name.
229
261
  */
@@ -1,6 +1,6 @@
1
1
  // Code generated by forge. DO NOT EDIT.
2
2
  /* eslint-disable */
3
- import { Transport, instant, object, } from "../../_/index.js";
3
+ import { Transport, instant, object, union, } from "../../_/index.js";
4
4
  import { RaizCampaignCodec, RaizCampaignPageCodec, } from "./models.js";
5
5
  export function createClient(options) {
6
6
  return bind(new Transport(options));
@@ -17,21 +17,21 @@ const CreateOperation = {
17
17
  method: "POST",
18
18
  route: "/v1/raiz/campaigns",
19
19
  body: "flat",
20
- request: object([["scheduledEndAt", null, instant], ["scheduledStartAt", null, instant]]),
20
+ request: union([object([["scheduledEndAt", null, instant], ["scheduledStartAt", null, instant]]), object([["scheduledEndAt", null, instant], ["scheduledStartAt", null, instant]])]),
21
21
  response: object([["data", null, () => RaizCampaignCodec]]),
22
22
  errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "409": true, "413": true, "415": true, "422": true, "429": true, "500": true, "502": true, "503": true, "504": true },
23
23
  };
24
24
  const GetOperation = {
25
25
  method: "GET",
26
26
  route: "/v1/raiz/campaigns/{campaignId}",
27
- query: { expand: "expand", recipientsCursor: "recipientsCursor", recipientsDirection: "recipientsDirection", recipientsLimit: "recipientsLimit" },
27
+ query: { expand: "expand", recipientsCursor: "recipientsCursor", recipientsDirection: "recipientsDirection", recipientsLimit: "recipientsLimit", recipientsQ: "recipientsQ", recipientsStatus: "recipientsStatus" },
28
28
  response: object([["data", null, () => RaizCampaignCodec]]),
29
29
  errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
30
30
  };
31
31
  const ListOperation = {
32
32
  method: "GET",
33
33
  route: "/v1/raiz/campaigns",
34
- query: { cursor: "cursor", direction: "direction", limit: "limit", agentId: "agentId", status: "status" },
34
+ query: { cursor: "cursor", direction: "direction", limit: "limit", agentId: "agentId", channelType: "channelType", status: "status" },
35
35
  response: object([["data", null, () => RaizCampaignPageCodec]]),
36
36
  errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
37
37
  };
@@ -2,4 +2,4 @@ export { ApiError } from "../../_/index.js";
2
2
  export type { RequestOptions } from "../../_/index.js";
3
3
  export { createClient } from "./client.js";
4
4
  export type { Client, ClientOptions, CreateRequest, CreateResponse, GetRequest, GetResponse, ListRequest, ListResponse, UpdateRequest, UpdateResponse, } from "./client.js";
5
- export type { RaizCampaign, RaizCampaignPage, RaizCampaignProgress, RaizCampaignRecipientInput, RaizCampaignRecipientPage, } from "./models.js";
5
+ export type { RaizCampaign, RaizCampaignBlocker, RaizCampaignPage, RaizCampaignProgress, RaizCampaignReadiness, RaizCampaignRecipientInput, RaizCampaignRecipientPage, RaizCampaignTemplate, RaizCampaignTemplateInput, } from "./models.js";
@@ -7,7 +7,13 @@ export interface RaizCampaign {
7
7
  agentId: string;
8
8
  channelId: string | null;
9
9
  /**
10
- * When calls may start, in the campaign's time zone. Empty: any time.
10
+ * How the campaign reaches people: by call or by WhatsApp.
11
+ */
12
+ channelType: "voice" | "whatsapp";
13
+ /**
14
+ * When calls may start and messages may leave, in the campaign's time zone.
15
+ * Empty: any time. Public holidays count like any other day: whether to reach
16
+ * people on one is the organization's decision.
11
17
  */
12
18
  contactHours: RaizContactHoursWindow[];
13
19
  /**
@@ -15,6 +21,8 @@ export interface RaizCampaign {
15
21
  */
16
22
  createdAt: Temporal.Instant;
17
23
  endedAt: Temporal.Instant | null;
24
+ errorAt: Temporal.Instant | null;
25
+ errorCode: string | null;
18
26
  firstMessage: string | null;
19
27
  /**
20
28
  * Campaign id.
@@ -34,28 +42,51 @@ export interface RaizCampaign {
34
42
  * How many recipients are in each state.
35
43
  */
36
44
  progress: RaizCampaignProgress;
45
+ /**
46
+ * Whether the campaign can start, checked against its Agent, line, template
47
+ * and recipients without reaching anyone. Present only when expanded.
48
+ */
49
+ readiness?: RaizCampaignReadiness;
37
50
  /**
38
51
  * The campaign's recipients in the order they were added, each with its
39
52
  * latest attempt. Present only when expanded.
40
53
  */
41
54
  recipients?: RaizCampaignRecipientPage;
42
55
  retryAfterMinutes: number;
43
- retryOn: ("no_answer" | "failure")[];
56
+ retryOn: ("no_answer" | "failure" | "not_delivered")[];
44
57
  scheduledEndAt: Temporal.Instant | null;
45
58
  scheduledStartAt: Temporal.Instant | null;
46
59
  startedAt: Temporal.Instant | null;
47
60
  /**
48
- * `queued`: not started yet (or its start is scheduled). `running`: calling
49
- * due recipients. `paused`: started, then paused; calls in progress finish.
50
- * `completed`: no recipient is left to call.
61
+ * `queued`: not started yet (or its start is scheduled). `running`: reaching
62
+ * due recipients. `paused`: started, then paused; what is in progress
63
+ * finishes. `completed`: no recipient is left to reach.
51
64
  */
52
65
  status: "queued" | "running" | "paused" | "completed" | "cancelled" | "failed";
66
+ template: RaizCampaignTemplate | null;
53
67
  timeZone: string;
54
68
  /**
55
69
  * An instant in RFC 3339 format, in UTC.
56
70
  */
57
71
  updatedAt: Temporal.Instant;
58
72
  version: number;
73
+ waitingUntilAt: Temporal.Instant | null;
74
+ }
75
+ export interface RaizCampaignBlocker {
76
+ /**
77
+ * The recipient it is about, when it is one.
78
+ */
79
+ address?: string;
80
+ /**
81
+ * The error `startCampaign` would refuse with: `CAMPAIGN_AGENT_NOT_READY`,
82
+ * `CAMPAIGN_NO_RECIPIENTS`, `CAMPAIGN_VARIABLE_MISSING`, `CHANNEL_NOT_READY`,
83
+ * a `TEMPLATE_*` code, `UPSTREAM_UNAVAILABLE` or `VOICE_AGENT_NOT_READY`.
84
+ */
85
+ code: string;
86
+ /**
87
+ * The variable it lacks, when it is one.
88
+ */
89
+ variable?: string;
59
90
  }
60
91
  export interface RaizCampaignPage {
61
92
  /**
@@ -72,34 +103,71 @@ export interface RaizCampaignPage {
72
103
  pageInfo: PageInfo;
73
104
  }
74
105
  export interface RaizCampaignProgress {
106
+ /**
107
+ * Calls: recipients whose latest call someone answered and its analysis
108
+ * judged.
109
+ */
110
+ answered: number;
75
111
  completed: number;
112
+ /**
113
+ * WhatsApp: recipients who received a message.
114
+ */
115
+ delivered: number;
76
116
  failed: number;
77
117
  inProgress: number;
118
+ /**
119
+ * Calls: recipients who failed because their calls ran out without anyone
120
+ * answering. A voicemail counts here.
121
+ */
122
+ noAnswer: number;
78
123
  pending: number;
124
+ /**
125
+ * WhatsApp: recipients who read a message.
126
+ */
127
+ read: number;
79
128
  recipients: number;
80
129
  /**
81
- * Recipients whose latest call's analysis judged it successful.
130
+ * WhatsApp: recipients who replied.
131
+ */
132
+ replied: number;
133
+ /**
134
+ * Recipients whose latest conversation's analysis judged it successful.
82
135
  */
83
136
  succeeded: number;
84
137
  }
138
+ export interface RaizCampaignReadiness {
139
+ /**
140
+ * What has to be fixed first. Empty when it can start.
141
+ */
142
+ blockers: RaizCampaignBlocker[];
143
+ preview: string | null;
144
+ /**
145
+ * Whether `startCampaign` would accept it now.
146
+ */
147
+ ready: boolean;
148
+ }
85
149
  export interface RaizCampaignRecipientInput {
86
150
  /**
87
151
  * Phone number in E.164 format.
88
152
  */
89
153
  address: RaizPhoneNumber;
90
154
  /**
91
- * The contact the call is about. Omitted: the contact that owns `address`,
92
- * created when the organization has none.
155
+ * The contact this recipient is. Omitted: the contact that owns `address`
156
+ * when the campaign first reaches them, created when the organization has
157
+ * none.
93
158
  */
94
159
  contactId?: string;
160
+ familyName?: string | null;
95
161
  firstMessage?: string | null;
162
+ givenName?: string | null;
96
163
  instructions?: string | null;
97
164
  /**
98
- * Values for the `{{name}}` variables the Agent's instructions, first message
99
- * or this campaign's texts reference. Raíz always provides `contact_name`,
100
- * `contact_given_name`, `contact_id`, `contact_phone`, `conversation_id` and
101
- * `bulletins` (the business bulletins in force), which a recipient's values
102
- * never replace.
165
+ * Values for the `{{name}}` variables a WhatsApp template's parameters, or
166
+ * the Agent's instructions, first message or this campaign's texts on a call,
167
+ * reference. Raíz always provides `contact_name`, `contact_given_name` and
168
+ * `contact_phone`, and on a call also `contact_id`, `conversation_id` and
169
+ * `bulletins` (the business bulletins in force); a recipient's values never
170
+ * replace them.
103
171
  */
104
172
  variables?: {
105
173
  [key: string]: unknown;
@@ -114,8 +182,11 @@ export interface RaizCampaignRecipientPage {
114
182
  attemptCount: number;
115
183
  contactId: string | null;
116
184
  createdAt: Temporal.Instant;
185
+ deliveredAt: Temporal.Instant | null;
117
186
  errorCode: string | null;
187
+ familyName: string | null;
118
188
  firstMessage: string | null;
189
+ givenName: string | null;
119
190
  id: string;
120
191
  instructions: string | null;
121
192
  lastAttempt: {
@@ -125,6 +196,8 @@ export interface RaizCampaignRecipientPage {
125
196
  status: "open" | "closed";
126
197
  } | null;
127
198
  nextAttemptAt: Temporal.Instant | null;
199
+ readAt: Temporal.Instant | null;
200
+ repliedAt: Temporal.Instant | null;
128
201
  status: "pending" | "in_progress" | "completed" | "failed" | "cancelled";
129
202
  updatedAt: Temporal.Instant;
130
203
  variables: {
@@ -140,6 +213,44 @@ export interface RaizCampaignRecipientPage {
140
213
  */
141
214
  pageInfo: PageInfo;
142
215
  }
216
+ export interface RaizCampaignTemplate {
217
+ /**
218
+ * The template's language: WhatsApp's code (`es`, `es_MX`) or a BCP 47 tag
219
+ * (`es-MX`).
220
+ */
221
+ language: string;
222
+ /**
223
+ * An approved template of the line's WhatsApp Business Account. Its body may
224
+ * have variables; a file in its header and button parameters cannot be used
225
+ * in a campaign.
226
+ */
227
+ name: string;
228
+ /**
229
+ * The template's body parameters, in order. Each is a text that may reference
230
+ * each recipient's `variables` as `{{name}}`, for example `{{patient_name}}`
231
+ * or `Dr. {{doctor}}`.
232
+ */
233
+ parameters: string[];
234
+ }
235
+ export interface RaizCampaignTemplateInput {
236
+ /**
237
+ * The template's language: WhatsApp's code (`es`, `es_MX`) or a BCP 47 tag
238
+ * (`es-MX`).
239
+ */
240
+ language: string;
241
+ /**
242
+ * An approved template of the line's WhatsApp Business Account. Its body may
243
+ * have variables; a file in its header and button parameters cannot be used
244
+ * in a campaign.
245
+ */
246
+ name: string;
247
+ /**
248
+ * The template's body parameters, in order. Each is a text that may reference
249
+ * each recipient's `variables` as `{{name}}`, for example `{{patient_name}}`
250
+ * or `Dr. {{doctor}}`.
251
+ */
252
+ parameters?: string[];
253
+ }
143
254
  export declare const RaizCampaignCodec: import("../../_/codec.js").Codec;
144
255
  export declare const RaizCampaignPageCodec: import("../../_/codec.js").Codec;
145
256
  export declare const RaizCampaignRecipientPageCodec: import("../../_/codec.js").Codec;
@@ -4,15 +4,17 @@ import { array, instant, object } from "../../_/index.js";
4
4
  export const RaizCampaignCodec = object([
5
5
  ["createdAt", null, instant],
6
6
  ["endedAt", null, instant],
7
+ ["errorAt", null, instant],
7
8
  ["recipients", null, () => RaizCampaignRecipientPageCodec],
8
9
  ["scheduledEndAt", null, instant],
9
10
  ["scheduledStartAt", null, instant],
10
11
  ["startedAt", null, instant],
11
12
  ["updatedAt", null, instant],
13
+ ["waitingUntilAt", null, instant],
12
14
  ]);
13
15
  export const RaizCampaignPageCodec = object([
14
16
  ["data", null, array(() => RaizCampaignCodec)],
15
17
  ]);
16
18
  export const RaizCampaignRecipientPageCodec = object([
17
- ["data", null, array(object([["createdAt", null, instant], ["lastAttempt", null, object([["startedAt", null, instant]])], ["nextAttemptAt", null, instant], ["updatedAt", null, instant]]))],
19
+ ["data", null, array(object([["createdAt", null, instant], ["deliveredAt", null, instant], ["lastAttempt", null, object([["startedAt", null, instant]])], ["nextAttemptAt", null, instant], ["readAt", null, instant], ["repliedAt", null, instant], ["updatedAt", null, instant]]))],
18
20
  ]);
@@ -71,19 +71,20 @@ export interface Client {
71
71
  * the AI), `worker` (`ai` or `team`: who answers it now), the Agent's tools
72
72
  * (`toolName`, `toolStatus`: which tool it called and how the call ended), a
73
73
  * captured fact (`factDefinition`, `factValue`), `assessment` (`failed` or
74
- * `passed`), `toReview` (what needs a person's look: not resolved, or handed
75
- * to the team), length (`messagesMin`, `messagesMax`, `durationMin`,
76
- * `durationMax`), `campaignId`, `profileId`, `requestedBy` and start time
77
- * (`startedAfter`, `startedBefore`); `q` searches participant identities
78
- * (names, profile names, usernames, phones, emails and documents), visible
79
- * messages, titles, summaries and exact conversation references;
80
- * `count_conversations` counts every match. Each item already carries its
81
- * title, summary, outcome, sentiment, workers and tool calls (how many, how
82
- * many failed, the latest failure), often enough to answer. `sort`: `started`
83
- * (newest first), `last_message` (latest activity first) or `changed`, the
84
- * feed of status, outcome and analysis changes, oldest first, that systems
85
- * poll from a saved `pageInfo.nextCursor` (a deleted conversation appears
86
- * once with `deletedAt`). Next: `get_conversation` for a transcript.
74
+ * `passed`), `toReview` (evaluated failures or unresolved handoffs;
75
+ * explicitly resolved successes leave this queue), length (`messagesMin`,
76
+ * `messagesMax`, `durationMin`, `durationMax`), `campaignId`, `profileId`,
77
+ * `requestedBy` and start time (`startedAfter`, `startedBefore`); `q`
78
+ * searches participant identities (names, profile names, usernames, phones,
79
+ * emails and documents), visible messages, titles, summaries and exact
80
+ * conversation references; `count_conversations` counts every match. Each
81
+ * item already carries its title, summary, outcome, sentiment, workers and
82
+ * tool calls (how many, how many failed, the latest failure), often enough to
83
+ * answer. `sort`: `started` (newest first), `last_message` (latest activity
84
+ * first) or `changed`, the feed of status, outcome and analysis changes,
85
+ * oldest first, that systems poll from a saved `pageInfo.nextCursor` (a
86
+ * deleted conversation appears once with `deletedAt`). Next:
87
+ * `get_conversation` for a transcript.
87
88
  */
88
89
  list(request?: ListRequest, options?: RequestOptions): Promise<ListResponse>;
89
90
  /**
@@ -265,8 +266,9 @@ export interface CountRequest {
265
266
  assessment?: "failed" | "passed";
266
267
  /**
267
268
  * `true`: conversations to review, as `get_report` counts them in
268
- * `toReviewCount`: the analysis says the request was not resolved, or the AI
269
- * handed the conversation to the team. `false`: the others.
269
+ * `toReviewCount`: evaluated failures or unresolved escalations. A success
270
+ * explicitly resolved by the team leaves this queue without erasing its
271
+ * escalation history. `false`: the others.
270
272
  */
271
273
  toReview?: boolean;
272
274
  /**
@@ -487,8 +489,9 @@ export interface ListRequest {
487
489
  assessment?: "failed" | "passed";
488
490
  /**
489
491
  * `true`: conversations to review, as `get_report` counts them in
490
- * `toReviewCount`: the analysis says the request was not resolved, or the AI
491
- * handed the conversation to the team. `false`: the others.
492
+ * `toReviewCount`: evaluated failures or unresolved escalations. A success
493
+ * explicitly resolved by the team leaves this queue without erasing its
494
+ * escalation history. `false`: the others.
492
495
  */
493
496
  toReview?: boolean;
494
497
  /**
@@ -85,6 +85,14 @@ export interface RaizConversation {
85
85
  */
86
86
  origin: "inbound" | "manual" | "api" | "campaign" | "import" | "test";
87
87
  outcome: "success" | "failure" | "unknown" | null;
88
+ outcomeReview?: {
89
+ confirmationMessageId: string | null;
90
+ evidence: string;
91
+ outcome: "success" | "failure" | "unknown";
92
+ reason: string;
93
+ reviewedAt: Temporal.Instant;
94
+ reviewedBy: string;
95
+ } | null;
88
96
  profileId: string | null;
89
97
  recording?: SignedUrl | null;
90
98
  recordingAvailable: boolean;
@@ -11,6 +11,7 @@ export const RaizConversationCodec = object([
11
11
  ["facts", null, array(() => RaizFactCodec)],
12
12
  ["lastMessageAt", null, instant],
13
13
  ["messages", null, () => RaizMessagePageCodec],
14
+ ["outcomeReview", null, object([["reviewedAt", null, instant]])],
14
15
  ["recording", null, () => SignedUrlCodec],
15
16
  ["startedAt", null, instant],
16
17
  ["updatedAt", null, instant],
@@ -373,7 +373,7 @@ export interface RaizFailureResponse {
373
373
  data: {
374
374
  [key: string]: unknown;
375
375
  };
376
- message: "Only a text Agent can hold a web conversation.";
376
+ message: "Only a text Agent can hold a web conversation; a voice Agent only with `origin: test`, to try it by text.";
377
377
  retryable: false;
378
378
  } | {
379
379
  code: "CALL_IN_PROGRESS";
@@ -571,6 +571,28 @@ export interface RaizFailureResponse {
571
571
  };
572
572
  message: "The time zone is not in the IANA time zone database.";
573
573
  retryable: false;
574
+ } | {
575
+ code: "CAMPAIGN_AGENT_NOT_READY";
576
+ data: {
577
+ [key: string]: unknown;
578
+ };
579
+ message: "The campaign's Agent must be an active text Agent: it answers whoever replies to the message.";
580
+ retryable: false;
581
+ } | {
582
+ code: "CAMPAIGN_NO_RECIPIENTS";
583
+ data: {
584
+ [key: string]: unknown;
585
+ };
586
+ message: "The campaign has nobody left to reach. Add recipients first.";
587
+ retryable: false;
588
+ } | {
589
+ code: "CAMPAIGN_VARIABLE_MISSING";
590
+ data: {
591
+ address: string;
592
+ variable: string;
593
+ };
594
+ message: "A recipient has no value for a variable the template's parameters use. An empty value cannot be sent on WhatsApp.";
595
+ retryable: false;
574
596
  } | {
575
597
  code: "CHANNEL_AGENT_MISMATCH";
576
598
  data: {
@@ -676,6 +698,13 @@ export interface RaizFailureResponse {
676
698
  };
677
699
  message: "The template needs header text variables, a location header or button parameters, which cannot be sent yet.";
678
700
  retryable: false;
701
+ } | {
702
+ code: "WHATSAPP_ACCOUNT_RESTRICTED";
703
+ data: {
704
+ [key: string]: unknown;
705
+ };
706
+ message: "WhatsApp has restricted this number or its business account. Review the account's status before sending again.";
707
+ retryable: false;
679
708
  } | {
680
709
  code: "WHATSAPP_AI_PAUSED";
681
710
  data: {
@@ -711,6 +740,13 @@ export interface RaizFailureResponse {
711
740
  };
712
741
  message: "WhatsApp never confirmed whether the message was sent. It was not sent again.";
713
742
  retryable: false;
743
+ } | {
744
+ code: "WHATSAPP_ENGAGEMENT_LIMITED";
745
+ data: {
746
+ [key: string]: unknown;
747
+ };
748
+ message: "WhatsApp limited how many marketing messages this person receives. Wait at least a day before sending again.";
749
+ retryable: true;
714
750
  } | {
715
751
  code: "WHATSAPP_MARKETING_STOPPED";
716
752
  data: {
@@ -37,9 +37,10 @@ export interface SuraLookupEligibilityBody {
37
37
  */
38
38
  documentNumber: string;
39
39
  /**
40
- * Document type. Defaults to CC.
40
+ * Document type. Defaults to CC. CE, RC and TI are read through the same
41
+ * form.
41
42
  */
42
- documentType?: "CC" | null;
43
+ documentType?: "CC" | "CE" | "RC" | "TI" | null;
43
44
  }
44
45
  /**
45
46
  * A failed answer.
@@ -10,11 +10,12 @@ export interface Client {
10
10
  /**
11
11
  * Look up an authorization
12
12
  *
13
- * Read an existing SaludWeb authorization for the exact CC patient, issuer
14
- * and authorization number. Reports delivered status, dates, explicit charge
15
- * type, fixed fee or copay percentage and provider-reported payments. Unknown
16
- * balance and copay cap remain null. Does not issue, attend, modify or pay an
17
- * authorization.
13
+ * Read an existing SaludWeb authorization for the exact patient, issuer and
14
+ * authorization number. Reports its status, dates, the authorized procedures,
15
+ * the provider it is directed to, explicit charge type, fixed fee or copay
16
+ * percentage and provider-reported payments. Procedures that could not be
17
+ * read, unknown balance and copay cap remain null. Does not issue, attend,
18
+ * modify or pay an authorization.
18
19
  */
19
20
  lookup(request: LookupRequest, options?: RequestOptions): Promise<LookupResponse>;
20
21
  }
@@ -41,9 +41,10 @@ export interface SuraLookupAuthorizationBody {
41
41
  */
42
42
  documentNumber: string;
43
43
  /**
44
- * Document type. Defaults to CC.
44
+ * Document type. Defaults to CC. CE, RC and TI are read through the same
45
+ * form.
45
46
  */
46
- documentType?: "CC" | null;
47
+ documentType?: "CC" | "CE" | "RC" | "TI" | null;
47
48
  /**
48
49
  * Issuer code before the hyphen in the authorization identifier.
49
50
  */
@@ -7,7 +7,7 @@ export interface SuraAffiliation {
7
7
  */
8
8
  aiHint: string;
9
9
  documentNumber: string;
10
- documentType: "CC";
10
+ documentType: "CC" | "CE" | "RC" | "TI";
11
11
  incomeGroup: string;
12
12
  ok: true;
13
13
  outcome: "eligible";
@@ -76,7 +76,7 @@ export interface SuraAuthorization {
76
76
  aiHint: string;
77
77
  authorizationNumber: string;
78
78
  documentNumber: string;
79
- documentType: "CC";
79
+ documentType: "CC" | "CE" | "RC" | "TI";
80
80
  /**
81
81
  * YYYY/MM/DD, as SURA writes it.
82
82
  */
@@ -100,8 +100,27 @@ export interface SuraAuthorization {
100
100
  issuerCode: string;
101
101
  ok: true;
102
102
  outcome: "found";
103
+ /**
104
+ * What it covers. Null means the portal did not establish it, never that it
105
+ * covers nothing.
106
+ */
107
+ procedures: {
108
+ code: string;
109
+ description: string;
110
+ quantity: number;
111
+ }[] | null;
103
112
  providerCode: string;
113
+ /**
114
+ * ENTREGADA, POR CONVENIO or ANULADA. An ANULADA authorization no longer
115
+ * serves.
116
+ */
104
117
  providerStatus: string;
118
+ receivingProvider: {
119
+ branchCode: string;
120
+ branchName: string;
121
+ documentNumber: string;
122
+ name: string;
123
+ } | null;
105
124
  }
106
125
  export interface SuraAvailability {
107
126
  /**
@@ -273,7 +292,7 @@ export interface SuraNoContract {
273
292
  */
274
293
  aiHint: string;
275
294
  documentNumber: string;
276
- documentType: "CC";
295
+ documentType: "CC" | "CE" | "RC" | "TI";
277
296
  ok: true;
278
297
  outcome: "noContract";
279
298
  providerCode: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbol-ai/sdk",
3
- "version": "5.38.1",
3
+ "version": "5.40.0",
4
4
  "description": "The Arbol API for TypeScript and JavaScript, generated by Cloudflare Forge from the platform's public OpenAPI.",
5
5
  "keywords": [
6
6
  "arbol",
@@ -58,8 +58,8 @@
58
58
  "packageManager": "bun@1.4.3",
59
59
  "arbol": {
60
60
  "openapi": {
61
- "release": "1.20261105.144113",
62
- "sha256": "8fff8c00b1e6e30ca52365be13d4db5b16960cae920280e7cf872bece943a285"
61
+ "release": "1.20261105.212004",
62
+ "sha256": "a32ec00dfc0c9e3b9ba937ca70389051bec347a58cb58f41741d7f9677b31421"
63
63
  }
64
64
  }
65
65
  }