@vitrina/api 11.11.0 → 11.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.
package/dist/index.d.cts CHANGED
@@ -71831,7 +71831,13 @@ interface paths {
71831
71831
  * Open a conversation from the platform side
71832
71832
  * @description The outbound counterpart to an inbound provider message — everything else in the inbox is created BY the provider webhook when a customer writes. Because nothing arrived from a provider, the caller supplies the channel and the contact identity.
71833
71833
  *
71834
- * ⚠ The contact is matched on `external_id` ONLY, never on email or phone. Send `contact.external_id` and the call reuses that contact; omit it and a NEW contact is created every time, because the id it falls back to is a fresh `manual:<uuid>` that by construction matches nothing. Calling this twice for the same person without an `external_id` leaves two contacts. Carry your own stable id for anyone you may open a second thread with.
71834
+ * The contact is RESOLVED before it is created, in this order: `contact.external_id`, then `contact.email`, then `contact.phone`. The first one that finds somebody wins and that contact is reused; only a miss on all three creates a new one. So calling this twice for the same person no longer leaves two contacts, and a 201 may well carry a contact that already existed — read `contact.id` rather than assuming the response describes a new record.
71835
+ *
71836
+ * ⚠ A BLANK FIELD NEVER MATCHES. An email or phone you omit, send empty, or send in a shape we cannot parse is skipped entirely — it is not compared against contacts that have none, because fusing two unrelated people onto one record is worse than the duplicate it would avoid. Send only the identifiers you actually hold.
71837
+ *
71838
+ * Matching is deliberately tolerant of spelling: email is compared case-insensitively, and a phone is normalised first, so `+56 9 1234 5678`, `56912345678` and `912345678` all resolve to the same person. An identity recorded on the contact’s channels counts as much as the one stored on the contact itself, so a number captured during an earlier WhatsApp thread is found here too.
71839
+ *
71840
+ * Carry your own `contact.external_id` for anyone you may open a second thread with: it is the only key that cannot drift. An email address and a phone number can both be reassigned to a different person, which is exactly why they are consulted after it and not before.
71835
71841
  *
71836
71842
  * ⚠ The thread is addressable only if the channel can work out where to send. On `web` the address IS the visitor session, so a conversation opened here gets a synthetic `manual:<uuid>` external id and sending on it answers 422 `no_channel_identity` — open a web thread from the widget instead. On `whatsapp` and `email` the contact's phone or address is the address, and the thread is sendable as soon as `messaging_account_id` names a connected account.
71837
71843
  */
@@ -102456,6 +102462,8 @@ interface paths {
102456
102462
  example?: string;
102457
102463
  };
102458
102464
  };
102465
+ /** @enum {string} */
102466
+ usage?: "first_contact" | "reminder" | "follow_up" | "update" | "aftercare" | "internal" | "other";
102459
102467
  };
102460
102468
  };
102461
102469
  };
@@ -102742,6 +102750,163 @@ interface paths {
102742
102750
  };
102743
102751
  trace?: never;
102744
102752
  };
102753
+ "/whatsapp-templates/{id}/usage": {
102754
+ parameters: {
102755
+ query?: never;
102756
+ header?: never;
102757
+ path?: never;
102758
+ cookie?: never;
102759
+ };
102760
+ get?: never;
102761
+ put?: never;
102762
+ post?: never;
102763
+ delete?: never;
102764
+ options?: never;
102765
+ head?: never;
102766
+ /**
102767
+ * Re-file the template under another usage bucket
102768
+ * @description What the template is FOR, operator-facing (first_contact | reminder | follow_up | update | aftercare | internal | other) — distinct from Meta's billing `category`. Inferred from the name at create/sync, editable here. Local-only: no Meta round-trip, no re-approval. `internal` templates are hidden from customer-facing send pickers.
102769
+ */
102770
+ patch: {
102771
+ parameters: {
102772
+ query?: never;
102773
+ header?: never;
102774
+ path: {
102775
+ id: string;
102776
+ };
102777
+ cookie?: never;
102778
+ };
102779
+ requestBody?: {
102780
+ content: {
102781
+ /**
102782
+ * @example {
102783
+ * "usage": "follow_up"
102784
+ * }
102785
+ */
102786
+ "application/json": {
102787
+ /** @enum {string} */
102788
+ usage: "first_contact" | "reminder" | "follow_up" | "update" | "aftercare" | "internal" | "other";
102789
+ };
102790
+ };
102791
+ };
102792
+ responses: {
102793
+ /** @description The updated template */
102794
+ 200: {
102795
+ headers: {
102796
+ [name: string]: unknown;
102797
+ };
102798
+ content: {
102799
+ /**
102800
+ * @example {
102801
+ * "data": {
102802
+ * "id": "e2e2e2e2-0000-4000-8000-000000000001",
102803
+ * "messaging_account_id": "e4e4e4e4-0000-4000-8000-000000000001",
102804
+ * "name": "seguimiento_stock",
102805
+ * "language": "es_CL",
102806
+ * "category": "MARKETING",
102807
+ * "body_text": "Hola {{1}}, el {{2}} que consultaste sigue disponible. ¿Seguimos viéndolo?",
102808
+ * "header_text": null,
102809
+ * "footer_text": "Autos del Valle",
102810
+ * "params": [
102811
+ * "1",
102812
+ * "2"
102813
+ * ],
102814
+ * "param_meta": {
102815
+ * "1": {
102816
+ * "label": "Nombre del contacto",
102817
+ * "example": "María"
102818
+ * },
102819
+ * "2": {
102820
+ * "label": "Modelo consultado",
102821
+ * "example": "Chevrolet Onix 2023"
102822
+ * }
102823
+ * },
102824
+ * "param_binding": {
102825
+ * "1": {
102826
+ * "source": "contact_field",
102827
+ * "field": "name"
102828
+ * },
102829
+ * "2": {
102830
+ * "source": "lead_interest"
102831
+ * }
102832
+ * },
102833
+ * "components": null,
102834
+ * "status": "APPROVED",
102835
+ * "rejection_reason": null,
102836
+ * "managed_for": null,
102837
+ * "managed_key": null,
102838
+ * "synced_at": "2026-09-15T18:20:00.000Z",
102839
+ * "created_at": "2026-01-10T13:00:00.000Z",
102840
+ * "updated_at": "2026-09-15T18:20:00.000Z"
102841
+ * }
102842
+ * }
102843
+ */
102844
+ "application/json": {
102845
+ data?: unknown;
102846
+ meta?: {
102847
+ [key: string]: unknown;
102848
+ };
102849
+ };
102850
+ };
102851
+ };
102852
+ /** @description Validation error */
102853
+ 400: {
102854
+ headers: {
102855
+ [name: string]: unknown;
102856
+ };
102857
+ content: {
102858
+ "application/json": components["schemas"]["Error"];
102859
+ };
102860
+ };
102861
+ /** @description Unauthorized */
102862
+ 401: {
102863
+ headers: {
102864
+ [name: string]: unknown;
102865
+ };
102866
+ content: {
102867
+ "application/json": components["schemas"]["Error"];
102868
+ };
102869
+ };
102870
+ /** @description Forbidden */
102871
+ 403: {
102872
+ headers: {
102873
+ [name: string]: unknown;
102874
+ };
102875
+ content: {
102876
+ "application/json": components["schemas"]["Error"];
102877
+ };
102878
+ };
102879
+ /** @description Not found */
102880
+ 404: {
102881
+ headers: {
102882
+ [name: string]: unknown;
102883
+ };
102884
+ content: {
102885
+ "application/json": components["schemas"]["Error"];
102886
+ };
102887
+ };
102888
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
102889
+ 409: {
102890
+ headers: {
102891
+ [name: string]: unknown;
102892
+ };
102893
+ content: {
102894
+ "application/json": components["schemas"]["Error"];
102895
+ };
102896
+ };
102897
+ /** @description Rate limited */
102898
+ 429: {
102899
+ headers: {
102900
+ [name: string]: unknown;
102901
+ };
102902
+ content: {
102903
+ "application/json": components["schemas"]["Error"];
102904
+ };
102905
+ };
102906
+ };
102907
+ };
102908
+ trace?: never;
102909
+ };
102745
102910
  "/whatsapp-templates/{id}/param-binding": {
102746
102911
  parameters: {
102747
102912
  query?: never;
package/dist/index.d.ts CHANGED
@@ -71831,7 +71831,13 @@ interface paths {
71831
71831
  * Open a conversation from the platform side
71832
71832
  * @description The outbound counterpart to an inbound provider message — everything else in the inbox is created BY the provider webhook when a customer writes. Because nothing arrived from a provider, the caller supplies the channel and the contact identity.
71833
71833
  *
71834
- * ⚠ The contact is matched on `external_id` ONLY, never on email or phone. Send `contact.external_id` and the call reuses that contact; omit it and a NEW contact is created every time, because the id it falls back to is a fresh `manual:<uuid>` that by construction matches nothing. Calling this twice for the same person without an `external_id` leaves two contacts. Carry your own stable id for anyone you may open a second thread with.
71834
+ * The contact is RESOLVED before it is created, in this order: `contact.external_id`, then `contact.email`, then `contact.phone`. The first one that finds somebody wins and that contact is reused; only a miss on all three creates a new one. So calling this twice for the same person no longer leaves two contacts, and a 201 may well carry a contact that already existed — read `contact.id` rather than assuming the response describes a new record.
71835
+ *
71836
+ * ⚠ A BLANK FIELD NEVER MATCHES. An email or phone you omit, send empty, or send in a shape we cannot parse is skipped entirely — it is not compared against contacts that have none, because fusing two unrelated people onto one record is worse than the duplicate it would avoid. Send only the identifiers you actually hold.
71837
+ *
71838
+ * Matching is deliberately tolerant of spelling: email is compared case-insensitively, and a phone is normalised first, so `+56 9 1234 5678`, `56912345678` and `912345678` all resolve to the same person. An identity recorded on the contact’s channels counts as much as the one stored on the contact itself, so a number captured during an earlier WhatsApp thread is found here too.
71839
+ *
71840
+ * Carry your own `contact.external_id` for anyone you may open a second thread with: it is the only key that cannot drift. An email address and a phone number can both be reassigned to a different person, which is exactly why they are consulted after it and not before.
71835
71841
  *
71836
71842
  * ⚠ The thread is addressable only if the channel can work out where to send. On `web` the address IS the visitor session, so a conversation opened here gets a synthetic `manual:<uuid>` external id and sending on it answers 422 `no_channel_identity` — open a web thread from the widget instead. On `whatsapp` and `email` the contact's phone or address is the address, and the thread is sendable as soon as `messaging_account_id` names a connected account.
71837
71843
  */
@@ -102456,6 +102462,8 @@ interface paths {
102456
102462
  example?: string;
102457
102463
  };
102458
102464
  };
102465
+ /** @enum {string} */
102466
+ usage?: "first_contact" | "reminder" | "follow_up" | "update" | "aftercare" | "internal" | "other";
102459
102467
  };
102460
102468
  };
102461
102469
  };
@@ -102742,6 +102750,163 @@ interface paths {
102742
102750
  };
102743
102751
  trace?: never;
102744
102752
  };
102753
+ "/whatsapp-templates/{id}/usage": {
102754
+ parameters: {
102755
+ query?: never;
102756
+ header?: never;
102757
+ path?: never;
102758
+ cookie?: never;
102759
+ };
102760
+ get?: never;
102761
+ put?: never;
102762
+ post?: never;
102763
+ delete?: never;
102764
+ options?: never;
102765
+ head?: never;
102766
+ /**
102767
+ * Re-file the template under another usage bucket
102768
+ * @description What the template is FOR, operator-facing (first_contact | reminder | follow_up | update | aftercare | internal | other) — distinct from Meta's billing `category`. Inferred from the name at create/sync, editable here. Local-only: no Meta round-trip, no re-approval. `internal` templates are hidden from customer-facing send pickers.
102769
+ */
102770
+ patch: {
102771
+ parameters: {
102772
+ query?: never;
102773
+ header?: never;
102774
+ path: {
102775
+ id: string;
102776
+ };
102777
+ cookie?: never;
102778
+ };
102779
+ requestBody?: {
102780
+ content: {
102781
+ /**
102782
+ * @example {
102783
+ * "usage": "follow_up"
102784
+ * }
102785
+ */
102786
+ "application/json": {
102787
+ /** @enum {string} */
102788
+ usage: "first_contact" | "reminder" | "follow_up" | "update" | "aftercare" | "internal" | "other";
102789
+ };
102790
+ };
102791
+ };
102792
+ responses: {
102793
+ /** @description The updated template */
102794
+ 200: {
102795
+ headers: {
102796
+ [name: string]: unknown;
102797
+ };
102798
+ content: {
102799
+ /**
102800
+ * @example {
102801
+ * "data": {
102802
+ * "id": "e2e2e2e2-0000-4000-8000-000000000001",
102803
+ * "messaging_account_id": "e4e4e4e4-0000-4000-8000-000000000001",
102804
+ * "name": "seguimiento_stock",
102805
+ * "language": "es_CL",
102806
+ * "category": "MARKETING",
102807
+ * "body_text": "Hola {{1}}, el {{2}} que consultaste sigue disponible. ¿Seguimos viéndolo?",
102808
+ * "header_text": null,
102809
+ * "footer_text": "Autos del Valle",
102810
+ * "params": [
102811
+ * "1",
102812
+ * "2"
102813
+ * ],
102814
+ * "param_meta": {
102815
+ * "1": {
102816
+ * "label": "Nombre del contacto",
102817
+ * "example": "María"
102818
+ * },
102819
+ * "2": {
102820
+ * "label": "Modelo consultado",
102821
+ * "example": "Chevrolet Onix 2023"
102822
+ * }
102823
+ * },
102824
+ * "param_binding": {
102825
+ * "1": {
102826
+ * "source": "contact_field",
102827
+ * "field": "name"
102828
+ * },
102829
+ * "2": {
102830
+ * "source": "lead_interest"
102831
+ * }
102832
+ * },
102833
+ * "components": null,
102834
+ * "status": "APPROVED",
102835
+ * "rejection_reason": null,
102836
+ * "managed_for": null,
102837
+ * "managed_key": null,
102838
+ * "synced_at": "2026-09-15T18:20:00.000Z",
102839
+ * "created_at": "2026-01-10T13:00:00.000Z",
102840
+ * "updated_at": "2026-09-15T18:20:00.000Z"
102841
+ * }
102842
+ * }
102843
+ */
102844
+ "application/json": {
102845
+ data?: unknown;
102846
+ meta?: {
102847
+ [key: string]: unknown;
102848
+ };
102849
+ };
102850
+ };
102851
+ };
102852
+ /** @description Validation error */
102853
+ 400: {
102854
+ headers: {
102855
+ [name: string]: unknown;
102856
+ };
102857
+ content: {
102858
+ "application/json": components["schemas"]["Error"];
102859
+ };
102860
+ };
102861
+ /** @description Unauthorized */
102862
+ 401: {
102863
+ headers: {
102864
+ [name: string]: unknown;
102865
+ };
102866
+ content: {
102867
+ "application/json": components["schemas"]["Error"];
102868
+ };
102869
+ };
102870
+ /** @description Forbidden */
102871
+ 403: {
102872
+ headers: {
102873
+ [name: string]: unknown;
102874
+ };
102875
+ content: {
102876
+ "application/json": components["schemas"]["Error"];
102877
+ };
102878
+ };
102879
+ /** @description Not found */
102880
+ 404: {
102881
+ headers: {
102882
+ [name: string]: unknown;
102883
+ };
102884
+ content: {
102885
+ "application/json": components["schemas"]["Error"];
102886
+ };
102887
+ };
102888
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
102889
+ 409: {
102890
+ headers: {
102891
+ [name: string]: unknown;
102892
+ };
102893
+ content: {
102894
+ "application/json": components["schemas"]["Error"];
102895
+ };
102896
+ };
102897
+ /** @description Rate limited */
102898
+ 429: {
102899
+ headers: {
102900
+ [name: string]: unknown;
102901
+ };
102902
+ content: {
102903
+ "application/json": components["schemas"]["Error"];
102904
+ };
102905
+ };
102906
+ };
102907
+ };
102908
+ trace?: never;
102909
+ };
102745
102910
  "/whatsapp-templates/{id}/param-binding": {
102746
102911
  parameters: {
102747
102912
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrina/api",
3
- "version": "11.11.0",
3
+ "version": "11.13.0",
4
4
  "description": "Typed TypeScript SDK for the Vitrina API pública — generated from the committed openapi.public.json (ADR 0106).",
5
5
  "type": "module",
6
6
  "license": "MIT",