@vitrina/api 14.9.0 → 14.11.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.
package/dist/index.d.cts CHANGED
@@ -86866,7 +86866,7 @@ interface paths {
86866
86866
  *
86867
86867
  * Which fields apply depends on `channel`: `email` uses `content` (subject, html, from_local, and an opaque `design` blob the builder reloads its canvas from); `whatsapp` uses `template_id` plus `template_params`, which maps each template variable to a contact field or a static value with an optional fallback; `voice` uses neither. Passing `scheduled_at` here records the intent but does NOT schedule the campaign — call `/schedule` for that. Answers 201.
86868
86868
  *
86869
- * `send_mode` (WhatsApp, ADR 0129): `paced` (default) continues across the rolling 24 h windows of the number’s messaging limit by itself; `asap` sends what fits now and pauses (`budget_exhausted`). `pilot_size` (1–1000) sends that many random recipients first and pauses (`pilot`) until resumed.
86869
+ * `send_mode` (WhatsApp, ADR 0129): `paced` (default) continues across the rolling 24 h windows of the number’s messaging limit by itself; `asap` sends what fits now and pauses (`budget_exhausted`). `pilot_size` (1–1000) sends that many random recipients first and pauses (`pilot`) until resumed. `send_window` (WhatsApp): when paced batches may leave — `{ timezone (IANA), days [1–7], start "HH:MM", end "HH:MM" }`, start < end, same day; null = the workspace default. An invalid one is a 400 with `field_errors`.
86870
86870
  */
86871
86871
  post: {
86872
86872
  parameters: {
@@ -86941,6 +86941,7 @@ interface paths {
86941
86941
  send_mode?: "paced" | "asap";
86942
86942
  /** @description Pilot: send this many random recipients first, then pause (paused_reason "pilot") until resumed. Null = no pilot. */
86943
86943
  pilot_size?: number | null;
86944
+ send_window?: components["schemas"]["CampaignSendWindow"] & unknown;
86944
86945
  };
86945
86946
  };
86946
86947
  };
@@ -87075,6 +87076,8 @@ interface paths {
87075
87076
  * @description Meta caps how many unique people a WhatsApp business may START a conversation with (a template outside the customer’s 24 h window) in a rolling 24 h — the messaging-limit tier (TIER_250, TIER_2K, …), shared by the numbers of one portfolio. `budget` is where the number stands: `limit_per_24h` (null = no cap: unlimited, or `tier_unknown`), the unique people messaged in the last 24 h by every template sender (`used_last_24h`, split campaigns / others), the `reserve` campaigns leave for everyone else — max(20 % of the limit, the p95 of the number’s own daily non-campaign usage over 7 days), capped at 80 % — and the `campaign_headroom` left right now.
87076
87077
  *
87077
87078
  * With `recipients`, `plan` says how a campaign to that many people would go: `sendable_now` (its fair share of the headroom, shared with the other campaigns sending on the number), `windows` (sending days), `estimated_completion_at` (continuations move into the workspace’s marketing hours) and the `recommended_send_mode`. `campaign_id` makes a saved campaign’s own recent sends count as its. 404 for a number that is not this workspace’s, 400 for one that is not WhatsApp.
87079
+ *
87080
+ * `send_window` (JSON-encoded, optional) plans against that window — `null` = the workspace default; absent = the saved campaign’s effective window (with `campaign_id`), else the workspace default. The plan then answers `send_window` (resolved), `window_label` («lun–vie 10:00–18:00 (America/Santiago)») and, when it is outside the window now, `next_window_opens_at` — the first batch, `next_batch_at` and `estimated_completion_at` start there, and every continuation lands inside the window. An invalid window is a 400 with `field_errors` (`send_window.start`, …).
87078
87081
  */
87079
87082
  get: {
87080
87083
  parameters: {
@@ -87082,6 +87085,8 @@ interface paths {
87082
87085
  messaging_account_id: string;
87083
87086
  recipients?: number | null;
87084
87087
  campaign_id?: string;
87088
+ /** @description JSON-encoded CampaignSendWindow to plan with (e.g. {"timezone":"America/Santiago","days":[1,2,3,4,5],"start":"10:00","end":"18:00"}), or `null` for the workspace default. Absent = the campaign's effective window (with campaign_id), else the workspace default. */
87089
+ send_window?: string;
87085
87090
  };
87086
87091
  header?: never;
87087
87092
  path?: never;
@@ -87216,7 +87221,7 @@ interface paths {
87216
87221
  };
87217
87222
  /**
87218
87223
  * Fetch one campaign with its stats
87219
- * @description The campaign plus its delivery counters — this is the read to poll while a send is in progress. A WhatsApp campaign that is not finished also carries `pacing` (ADR 0129): its number’s tier and `limit_per_24h`, `sent_last_24h`, `pending`, `waiting` (a paced campaign waiting for the window) with `next_batch_at`, `estimated_completion_at` and `windows_remaining`; null when the budget cannot be read.
87224
+ * @description The campaign plus its delivery counters — this is the read to poll while a send is in progress. A WhatsApp campaign that is not finished also carries `pacing` (ADR 0129): its number’s tier and `limit_per_24h`, `sent_last_24h`, `pending`, `waiting` (a paced campaign waiting for the window) with `next_batch_at`, `estimated_completion_at` and `windows_remaining`, plus the effective `send_window` (`send_window_source`: campaign | workspace), its `window_label` and `next_window_opens_at` (outside the window now); null when the budget cannot be read.
87220
87225
  */
87221
87226
  get: {
87222
87227
  parameters: {
@@ -87450,7 +87455,7 @@ interface paths {
87450
87455
  head?: never;
87451
87456
  /**
87452
87457
  * Edit a campaign
87453
- * @description Legal only while the campaign is `draft` or `scheduled`; from any other status this is a **409**. At least one field is required. `channel` is absent from the body on purpose — a campaign’s channel is fixed at creation, since the content shape depends on it.
87458
+ * @description Legal only while the campaign is `draft` or `scheduled`; from any other status this is a **409** — except a body carrying ONLY `send_window`, which is also legal while `paused` or `sending` and takes effect at the next batch (a campaign waiting for the old window re-plans at once). At least one field is required. `channel` is absent from the body on purpose — a campaign’s channel is fixed at creation, since the content shape depends on it.
87454
87459
  */
87455
87460
  patch: {
87456
87461
  parameters: {
@@ -87506,6 +87511,7 @@ interface paths {
87506
87511
  send_mode?: "paced" | "asap";
87507
87512
  /** @description Pilot: send this many random recipients first, then pause (paused_reason "pilot") until resumed. Null = no pilot. */
87508
87513
  pilot_size?: number | null;
87514
+ send_window?: components["schemas"]["CampaignSendWindow"] & unknown;
87509
87515
  };
87510
87516
  };
87511
87517
  };
@@ -87818,6 +87824,8 @@ interface paths {
87818
87824
  * An EMAIL campaign never leaves from a person's connected mailbox (ADR 0108 §Decision 10, ADR 0032): it goes out through the campaign sending provider under the verified sending domain, and the connected mailbox may only be its Reply-To. A campaign that would resolve to a connected mailbox — the workspace has no verified sending domain but has a connected mailbox, or the From address IS a connected mailbox's address — is refused whole with a **422 `CAMPAIGN_FROM_CONNECTED_MAILBOX`** (`error.details`: `reason` `no_campaign_domain` | `from_is_mailbox`, `address`, `messaging_account_id`), before any recipient is written or queued. This check runs FIRST, before the first-campaign platform approval gate: where mail leaves from is decided before whether the workspace may campaign.
87819
87825
  *
87820
87826
  * Legal from `draft` and `scheduled`; a 409 from anywhere else. Sending is not undoable once recipients start receiving — `/pause` stops the remainder, it does not recall what went out.
87827
+ *
87828
+ * The response is the campaign plus `started: true` and `waiting_for_window_until`: a paced campaign (or a pilot) sent outside its send window sends nothing yet and waits for the window — this is when it opens; null = the first batch leaves now.
87821
87829
  */
87822
87830
  post: {
87823
87831
  parameters: {
@@ -87833,7 +87841,7 @@ interface paths {
87833
87841
  };
87834
87842
  requestBody?: never;
87835
87843
  responses: {
87836
- /** @description The campaign, now scheduled */
87844
+ /** @description The campaign, now scheduled, and whether it waits for its window */
87837
87845
  200: {
87838
87846
  headers: {
87839
87847
  [name: string]: unknown;
@@ -87885,10 +87893,7 @@ interface paths {
87885
87893
  * }
87886
87894
  */
87887
87895
  "application/json": {
87888
- data?: unknown;
87889
- meta?: {
87890
- [key: string]: unknown;
87891
- };
87896
+ data: components["schemas"]["CampaignSendNowResult"];
87892
87897
  };
87893
87898
  };
87894
87899
  };
@@ -88440,12 +88445,18 @@ interface paths {
88440
88445
  * List the campaign’s recipients
88441
88446
  * @description One row per recipient with its delivery state — `pending`, `sent`, `delivered`, `read`, `failed` or `suppressed`. `suppressed` means the contact was in the audience but the suppression list stopped the send, which is a successful outcome rather than a failure.
88442
88447
  *
88443
- * The list only exists once the run materialises it, so a draft or not-yet-started campaign answers empty rather than previewing who WOULD receive it. `limit` defaults to 50 and caps at 200; the count is `meta.pagination.total`.
88448
+ * The list only exists once the run materialises it, so a draft or not-yet-started campaign answers empty rather than previewing who WOULD receive it. `limit` defaults to 50 and caps at 500; the count is `meta.pagination.total`.
88449
+ *
88450
+ * Filters: `state`, `error_code` (Meta's code, failed rows of one reason) and `replied`. Each row carries Meta's raw `error`, the same failure in plain language with a suggested action (`error_reason`), and `replied_button` — the template quick-reply button the person's first reply tapped (null for free text or no reply).
88444
88451
  */
88445
88452
  get: {
88446
88453
  parameters: {
88447
88454
  query?: {
88448
88455
  state?: "pending" | "sent" | "delivered" | "read" | "failed" | "suppressed";
88456
+ /** @description Meta's error code (e.g. `131026`) — failed rows of one reason. */
88457
+ error_code?: string;
88458
+ /** @description `true`: only recipients who replied; `false`: only those who did not. */
88459
+ replied?: "true" | "false";
88449
88460
  limit?: number;
88450
88461
  offset?: number | null;
88451
88462
  };
@@ -88501,6 +88512,13 @@ interface paths {
88501
88512
  * "title": "Message undeliverable",
88502
88513
  * "detail": null
88503
88514
  * },
88515
+ * "error_reason": {
88516
+ * "code": "131026",
88517
+ * "human_es": "El número no tiene WhatsApp o no puede recibir este mensaje (app desactualizada, no aceptó los términos o bloqueó a la empresa).",
88518
+ * "human_en": "The number is not on WhatsApp or cannot receive this message (outdated app, terms not accepted, or it blocked the business).",
88519
+ * "action": "remove_number"
88520
+ * },
88521
+ * "replied_button": null,
88504
88522
  * "sent_at": null,
88505
88523
  * "replied_at": null,
88506
88524
  * "replied_conversation_id": null,
@@ -88530,6 +88548,437 @@ interface paths {
88530
88548
  * }
88531
88549
  * }
88532
88550
  */
88551
+ "application/json": {
88552
+ data: components["schemas"]["CampaignRecipient"][];
88553
+ meta: {
88554
+ pagination: {
88555
+ total: number;
88556
+ limit: number;
88557
+ offset: number;
88558
+ };
88559
+ };
88560
+ };
88561
+ };
88562
+ };
88563
+ /** @description Validation error */
88564
+ 400: {
88565
+ headers: {
88566
+ [name: string]: unknown;
88567
+ };
88568
+ content: {
88569
+ "application/json": components["schemas"]["Error"];
88570
+ };
88571
+ };
88572
+ /** @description Unauthorized */
88573
+ 401: {
88574
+ headers: {
88575
+ [name: string]: unknown;
88576
+ };
88577
+ content: {
88578
+ "application/json": components["schemas"]["Error"];
88579
+ };
88580
+ };
88581
+ /** @description Forbidden */
88582
+ 403: {
88583
+ headers: {
88584
+ [name: string]: unknown;
88585
+ };
88586
+ content: {
88587
+ "application/json": components["schemas"]["Error"];
88588
+ };
88589
+ };
88590
+ /** @description Not found */
88591
+ 404: {
88592
+ headers: {
88593
+ [name: string]: unknown;
88594
+ };
88595
+ content: {
88596
+ "application/json": components["schemas"]["Error"];
88597
+ };
88598
+ };
88599
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
88600
+ 409: {
88601
+ headers: {
88602
+ [name: string]: unknown;
88603
+ };
88604
+ content: {
88605
+ "application/json": components["schemas"]["Error"];
88606
+ };
88607
+ };
88608
+ /** @description Rate limited */
88609
+ 429: {
88610
+ headers: {
88611
+ [name: string]: unknown;
88612
+ };
88613
+ content: {
88614
+ "application/json": components["schemas"]["Error"];
88615
+ };
88616
+ };
88617
+ };
88618
+ };
88619
+ put?: never;
88620
+ post?: never;
88621
+ delete?: never;
88622
+ options?: never;
88623
+ head?: never;
88624
+ patch?: never;
88625
+ trace?: never;
88626
+ };
88627
+ "/campaigns/{id}/recipients/export.csv": {
88628
+ parameters: {
88629
+ query?: never;
88630
+ header?: never;
88631
+ path?: never;
88632
+ cookie?: never;
88633
+ };
88634
+ /**
88635
+ * Export the campaign’s recipients as CSV
88636
+ * @description The whole recipients list (same filters as the list: `state`, `error_code`, `replied`) as a UTF-8 CSV with a BOM and Spanish headers: `Nombre, Identificador, Estado, Enviado, Entregado, Leído, Respondió, Botón, Código de error, Motivo, Acción sugerida`. Times are in the workspace time zone. Requires `campaigns:read` AND `contacts:read` (it carries names and phone numbers).
88637
+ */
88638
+ get: {
88639
+ parameters: {
88640
+ query?: {
88641
+ state?: "pending" | "sent" | "delivered" | "read" | "failed" | "suppressed";
88642
+ /** @description Meta's error code (e.g. `131026`) — failed rows of one reason. */
88643
+ error_code?: string;
88644
+ /** @description `true`: only recipients who replied; `false`: only those who did not. */
88645
+ replied?: "true" | "false";
88646
+ };
88647
+ header?: never;
88648
+ path: {
88649
+ id: string;
88650
+ };
88651
+ cookie?: never;
88652
+ };
88653
+ requestBody?: never;
88654
+ responses: {
88655
+ /** @description The CSV file */
88656
+ 200: {
88657
+ headers: {
88658
+ [name: string]: unknown;
88659
+ };
88660
+ content: {
88661
+ "text/csv": string;
88662
+ };
88663
+ };
88664
+ /** @description Validation error */
88665
+ 400: {
88666
+ headers: {
88667
+ [name: string]: unknown;
88668
+ };
88669
+ content: {
88670
+ "application/json": components["schemas"]["Error"];
88671
+ };
88672
+ };
88673
+ /** @description Unauthorized */
88674
+ 401: {
88675
+ headers: {
88676
+ [name: string]: unknown;
88677
+ };
88678
+ content: {
88679
+ "application/json": components["schemas"]["Error"];
88680
+ };
88681
+ };
88682
+ /** @description Forbidden */
88683
+ 403: {
88684
+ headers: {
88685
+ [name: string]: unknown;
88686
+ };
88687
+ content: {
88688
+ "application/json": components["schemas"]["Error"];
88689
+ };
88690
+ };
88691
+ /** @description Not found */
88692
+ 404: {
88693
+ headers: {
88694
+ [name: string]: unknown;
88695
+ };
88696
+ content: {
88697
+ "application/json": components["schemas"]["Error"];
88698
+ };
88699
+ };
88700
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
88701
+ 409: {
88702
+ headers: {
88703
+ [name: string]: unknown;
88704
+ };
88705
+ content: {
88706
+ "application/json": components["schemas"]["Error"];
88707
+ };
88708
+ };
88709
+ /** @description Rate limited */
88710
+ 429: {
88711
+ headers: {
88712
+ [name: string]: unknown;
88713
+ };
88714
+ content: {
88715
+ "application/json": components["schemas"]["Error"];
88716
+ };
88717
+ };
88718
+ };
88719
+ };
88720
+ put?: never;
88721
+ post?: never;
88722
+ delete?: never;
88723
+ options?: never;
88724
+ head?: never;
88725
+ patch?: never;
88726
+ trace?: never;
88727
+ };
88728
+ "/campaigns/{id}/results": {
88729
+ parameters: {
88730
+ query?: never;
88731
+ header?: never;
88732
+ path?: never;
88733
+ cookie?: never;
88734
+ };
88735
+ /**
88736
+ * The campaign’s results
88737
+ * @description What happened to the campaign, from its own recipients: the funnel (`recipients → sent → delivered → read → replied`, plus `failed`, `opted_out`, `suppressed`, `pending`) and its rates (delivered/sent, read/delivered, replied/delivered); replies per template quick-reply button (a reply whose first message is a button label) and the `free_text` rest; failures grouped by Meta error code, each with a plain-language reason (es/en) and a suggested `action`; opt-outs attributable to the campaign (recorded by it, or on a recipient’s number within the reply-attribution window after the send) by reason; and a timeline of sends, deliveries, reads and replies per hour (per day past a week), bucketed in the workspace time zone. Delivery/read times are recorded from 2026-10-14 on; older sends show in the funnel but not in the timeline.
88738
+ */
88739
+ get: {
88740
+ parameters: {
88741
+ query?: never;
88742
+ header?: never;
88743
+ path: {
88744
+ id: string;
88745
+ };
88746
+ cookie?: never;
88747
+ };
88748
+ requestBody?: never;
88749
+ responses: {
88750
+ /** @description The results */
88751
+ 200: {
88752
+ headers: {
88753
+ [name: string]: unknown;
88754
+ };
88755
+ content: {
88756
+ /**
88757
+ * @example {
88758
+ * "data": {
88759
+ * "campaign_id": "7a7a7a7a-0000-4000-8000-0000000000c1",
88760
+ * "channel": "whatsapp",
88761
+ * "funnel": {
88762
+ * "recipients": 64,
88763
+ * "sent": 64,
88764
+ * "delivered": 52,
88765
+ * "read": 40,
88766
+ * "replied": 17,
88767
+ * "opted_out": 2,
88768
+ * "failed": 9,
88769
+ * "suppressed": 0,
88770
+ * "pending": 0
88771
+ * },
88772
+ * "rates": {
88773
+ * "delivered": 0.8125,
88774
+ * "read": 0.7692,
88775
+ * "replied": 0.3269
88776
+ * },
88777
+ * "buttons": [
88778
+ * {
88779
+ * "text": "Quiero más información",
88780
+ * "count": 10
88781
+ * },
88782
+ * {
88783
+ * "text": "No me interesa",
88784
+ * "count": 2
88785
+ * }
88786
+ * ],
88787
+ * "free_text": 5,
88788
+ * "failures": [
88789
+ * {
88790
+ * "code": "131026",
88791
+ * "title": "Message undeliverable",
88792
+ * "human_es": "El número no tiene WhatsApp o no puede recibir este mensaje (app desactualizada, no aceptó los términos o bloqueó a la empresa).",
88793
+ * "human_en": "The number is not on WhatsApp or cannot receive this message (outdated app, terms not accepted, or it blocked the business).",
88794
+ * "action": "remove_number",
88795
+ * "count": 4
88796
+ * },
88797
+ * {
88798
+ * "code": "130472",
88799
+ * "title": "User's number is part of an experiment",
88800
+ * "human_es": "Meta retiene mensajes de marketing a una muestra de usuarios para un experimento. No depende de ti.",
88801
+ * "human_en": "Meta holds back marketing messages from a sample of users for an experiment. Nothing on your side.",
88802
+ * "action": "none",
88803
+ * "count": 2
88804
+ * }
88805
+ * ],
88806
+ * "opt_outs": {
88807
+ * "count": 2,
88808
+ * "by_reason": {
88809
+ * "stop_keyword": 1,
88810
+ * "classified_marketing": 1
88811
+ * }
88812
+ * },
88813
+ * "timeline": {
88814
+ * "unit": "hour",
88815
+ * "timezone": "America/Santiago",
88816
+ * "points": [
88817
+ * {
88818
+ * "at": "2026-09-15T17:00:00.000Z",
88819
+ * "sent": 64,
88820
+ * "delivered": 52,
88821
+ * "read": 10,
88822
+ * "replied": 4
88823
+ * },
88824
+ * {
88825
+ * "at": "2026-09-15T18:00:00.000Z",
88826
+ * "sent": 0,
88827
+ * "delivered": 0,
88828
+ * "read": 4,
88829
+ * "replied": 2
88830
+ * }
88831
+ * ]
88832
+ * }
88833
+ * }
88834
+ * }
88835
+ */
88836
+ "application/json": {
88837
+ data: components["schemas"]["CampaignResults"];
88838
+ meta?: {
88839
+ [key: string]: unknown;
88840
+ };
88841
+ };
88842
+ };
88843
+ };
88844
+ /** @description Validation error */
88845
+ 400: {
88846
+ headers: {
88847
+ [name: string]: unknown;
88848
+ };
88849
+ content: {
88850
+ "application/json": components["schemas"]["Error"];
88851
+ };
88852
+ };
88853
+ /** @description Unauthorized */
88854
+ 401: {
88855
+ headers: {
88856
+ [name: string]: unknown;
88857
+ };
88858
+ content: {
88859
+ "application/json": components["schemas"]["Error"];
88860
+ };
88861
+ };
88862
+ /** @description Forbidden */
88863
+ 403: {
88864
+ headers: {
88865
+ [name: string]: unknown;
88866
+ };
88867
+ content: {
88868
+ "application/json": components["schemas"]["Error"];
88869
+ };
88870
+ };
88871
+ /** @description Not found */
88872
+ 404: {
88873
+ headers: {
88874
+ [name: string]: unknown;
88875
+ };
88876
+ content: {
88877
+ "application/json": components["schemas"]["Error"];
88878
+ };
88879
+ };
88880
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
88881
+ 409: {
88882
+ headers: {
88883
+ [name: string]: unknown;
88884
+ };
88885
+ content: {
88886
+ "application/json": components["schemas"]["Error"];
88887
+ };
88888
+ };
88889
+ /** @description Rate limited */
88890
+ 429: {
88891
+ headers: {
88892
+ [name: string]: unknown;
88893
+ };
88894
+ content: {
88895
+ "application/json": components["schemas"]["Error"];
88896
+ };
88897
+ };
88898
+ };
88899
+ };
88900
+ put?: never;
88901
+ post?: never;
88902
+ delete?: never;
88903
+ options?: never;
88904
+ head?: never;
88905
+ patch?: never;
88906
+ trace?: never;
88907
+ };
88908
+ "/campaigns/{id}/meta-insights": {
88909
+ parameters: {
88910
+ query?: never;
88911
+ header?: never;
88912
+ path?: never;
88913
+ cookie?: never;
88914
+ };
88915
+ /**
88916
+ * Meta’s own analytics for the campaign’s template
88917
+ * @description Meta’s per-template analytics (sent, delivered, read, button clicks) over the campaign’s dates (the 200 shape below is the planned one). **Not available yet**: the messaging bridge Vitrina reaches Meta through does not expose WhatsApp template analytics yet (ADR 0137). Answers **501 `meta_insights_unavailable`** until it does; 404 for an unknown campaign.
88918
+ */
88919
+ get: {
88920
+ parameters: {
88921
+ query?: never;
88922
+ header?: never;
88923
+ path: {
88924
+ id: string;
88925
+ };
88926
+ cookie?: never;
88927
+ };
88928
+ requestBody?: never;
88929
+ responses: {
88930
+ /** @description Meta’s template analytics */
88931
+ 200: {
88932
+ headers: {
88933
+ [name: string]: unknown;
88934
+ };
88935
+ content: {
88936
+ /**
88937
+ * @example {
88938
+ * "data": {
88939
+ * "template": {
88940
+ * "name": "promo_octubre",
88941
+ * "language": "es",
88942
+ * "external_id": "1234567890"
88943
+ * },
88944
+ * "range": {
88945
+ * "start": "2026-10-01",
88946
+ * "end": "2026-10-14"
88947
+ * },
88948
+ * "totals": {
88949
+ * "sent": 820,
88950
+ * "delivered": 790,
88951
+ * "read": 512,
88952
+ * "cost": {
88953
+ * "amount": 41.2,
88954
+ * "currency": "USD"
88955
+ * }
88956
+ * },
88957
+ * "clicks": [
88958
+ * {
88959
+ * "type": "quick_reply_button",
88960
+ * "button": "Quiero más información",
88961
+ * "count": 61
88962
+ * },
88963
+ * {
88964
+ * "type": "url_button",
88965
+ * "button": "Ver promoción",
88966
+ * "count": 37
88967
+ * }
88968
+ * ],
88969
+ * "daily": [
88970
+ * {
88971
+ * "date": "2026-10-13",
88972
+ * "sent": 400,
88973
+ * "delivered": 388,
88974
+ * "read": 250,
88975
+ * "clicks": 52
88976
+ * }
88977
+ * ],
88978
+ * "fetched_at": "2026-10-14T13:05:00.000Z"
88979
+ * }
88980
+ * }
88981
+ */
88533
88982
  "application/json": {
88534
88983
  data?: unknown;
88535
88984
  meta?: {
@@ -88592,6 +89041,15 @@ interface paths {
88592
89041
  "application/json": components["schemas"]["Error"];
88593
89042
  };
88594
89043
  };
89044
+ /** @description `meta_insights_unavailable` — not available yet. */
89045
+ 501: {
89046
+ headers: {
89047
+ [name: string]: unknown;
89048
+ };
89049
+ content: {
89050
+ "application/json": components["schemas"]["Error"];
89051
+ };
89052
+ };
88595
89053
  };
88596
89054
  };
88597
89055
  put?: never;
@@ -179642,6 +180100,17 @@ interface components {
179642
180100
  next_batch_at: string | null;
179643
180101
  computed_at: string;
179644
180102
  };
180103
+ /** @description The window this plan used (resolved); null = contact hours only. */
180104
+ CampaignSendWindow: {
180105
+ /** @description IANA zone the window is read on, e.g. America/Santiago. */
180106
+ timezone: string;
180107
+ /** @description ISO weekdays the window opens on: 1 = Monday … 7 = Sunday. */
180108
+ days: number[];
180109
+ /** @description Local opening time, HH:MM (inclusive). */
180110
+ start: string;
180111
+ /** @description Local closing time, HH:MM (exclusive); later than start. */
180112
+ end: string;
180113
+ } | null;
179645
180114
  CampaignSendPlan: {
179646
180115
  recipients: number;
179647
180116
  sendable_now: number | null;
@@ -179656,11 +180125,22 @@ interface components {
179656
180125
  */
179657
180126
  recommended_send_mode: "paced" | "asap";
179658
180127
  next_batch_at: string | null;
180128
+ send_window: components["schemas"]["CampaignSendWindow"];
180129
+ /** @description e.g. «lun–vie 10:00–18:00 (America/Santiago)»; null = none. */
180130
+ window_label: string | null;
180131
+ /** @description Set when it is outside the window now: the first batch waits until then. */
180132
+ next_window_opens_at: string | null;
179659
180133
  } | null;
179660
180134
  CampaignMessagingBudget: {
179661
180135
  budget: components["schemas"]["MessagingBudget"];
179662
180136
  plan: components["schemas"]["CampaignSendPlan"];
179663
180137
  };
180138
+ CampaignSendNowResult: {
180139
+ /** @enum {boolean} */
180140
+ started: true;
180141
+ /** @description Outside the send window: nothing leaves until this instant (the window opening). Null = sends now. */
180142
+ waiting_for_window_until: string | null;
180143
+ };
179664
180144
  CampaignResumeBody: {
179665
180145
  /**
179666
180146
  * @description paced: continue automatically across the rolling 24 h windows; asap: send what fits now and pause (ADR 0129).
@@ -179668,6 +180148,114 @@ interface components {
179668
180148
  */
179669
180149
  send_mode?: "paced" | "asap";
179670
180150
  };
180151
+ CampaignRecipient: {
180152
+ /** Format: uuid */
180153
+ id: string;
180154
+ /** Format: uuid */
180155
+ campaign_id: string;
180156
+ /** Format: uuid */
180157
+ contact_id: string | null;
180158
+ contact_name: string | null;
180159
+ identifier: string;
180160
+ params: {
180161
+ [key: string]: string;
180162
+ };
180163
+ rendered_text: string | null;
180164
+ /** @enum {string} */
180165
+ state: "pending" | "sent" | "delivered" | "read" | "failed" | "suppressed";
180166
+ external_message_id: string | null;
180167
+ /** @description Meta's raw error, as it answered. */
180168
+ error: {
180169
+ code: string;
180170
+ title: string;
180171
+ detail: string | null;
180172
+ } | null;
180173
+ /** @description The failure in plain language, with a suggested action. */
180174
+ error_reason: {
180175
+ code: string;
180176
+ human_es: string;
180177
+ human_en: string;
180178
+ /**
180179
+ * @description none: Meta decided, nothing to do; remove_number: the number cannot receive WhatsApp — take it out of the audience; retry_later: a limit or transient error; check_template: the template/variables/media must be fixed.
180180
+ * @enum {string}
180181
+ */
180182
+ action: "none" | "remove_number" | "retry_later" | "check_template";
180183
+ } | null;
180184
+ /** @description The template quick-reply button the person's first reply tapped; null when they wrote free text or did not reply. */
180185
+ replied_button: string | null;
180186
+ sent_at: string | null;
180187
+ delivered_at: string | null;
180188
+ read_at: string | null;
180189
+ failed_at: string | null;
180190
+ replied_at: string | null;
180191
+ /** Format: uuid */
180192
+ replied_conversation_id: string | null;
180193
+ created_at: string;
180194
+ };
180195
+ CampaignResults: {
180196
+ /** Format: uuid */
180197
+ campaign_id: string;
180198
+ /** @enum {string} */
180199
+ channel: "whatsapp" | "email" | "voice";
180200
+ funnel: {
180201
+ recipients: number;
180202
+ sent: number;
180203
+ delivered: number;
180204
+ read: number;
180205
+ replied: number;
180206
+ opted_out: number;
180207
+ failed: number;
180208
+ suppressed: number;
180209
+ pending: number;
180210
+ };
180211
+ /** @description 0–1 fractions; null when the denominator is 0. */
180212
+ rates: {
180213
+ /** @description delivered / sent */
180214
+ delivered: number | null;
180215
+ /** @description read / delivered */
180216
+ read: number | null;
180217
+ /** @description replied / delivered */
180218
+ replied: number | null;
180219
+ };
180220
+ /** @description Replies whose first message was a tap on one of the template's quick-reply buttons, per button (every button listed, zeros included). */
180221
+ buttons: {
180222
+ text: string;
180223
+ count: number;
180224
+ }[];
180225
+ /** @description Replies whose first message was not a button tap. */
180226
+ free_text: number;
180227
+ failures: {
180228
+ code: string;
180229
+ title: string;
180230
+ human_es: string;
180231
+ human_en: string;
180232
+ /**
180233
+ * @description none: Meta decided, nothing to do; remove_number: the number cannot receive WhatsApp — take it out of the audience; retry_later: a limit or transient error; check_template: the template/variables/media must be fixed.
180234
+ * @enum {string}
180235
+ */
180236
+ action: "none" | "remove_number" | "retry_later" | "check_template";
180237
+ count: number;
180238
+ }[];
180239
+ opt_outs: {
180240
+ count: number;
180241
+ by_reason: {
180242
+ [key: string]: number;
180243
+ };
180244
+ };
180245
+ timeline: {
180246
+ /** @enum {string} */
180247
+ unit: "hour" | "day";
180248
+ timezone: string;
180249
+ points: {
180250
+ /** @description Bucket start (ISO, UTC). */
180251
+ at: string;
180252
+ sent: number;
180253
+ delivered: number;
180254
+ read: number;
180255
+ replied: number;
180256
+ }[];
180257
+ };
180258
+ };
179671
180259
  CampaignTestSendResult: {
179672
180260
  /** Format: uuid */
179673
180261
  campaign_id: string;