@getlatedev/node 0.2.243 → 0.2.245

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/README.md CHANGED
@@ -554,7 +554,7 @@ try {
554
554
  | Method | Description |
555
555
  |--------|-------------|
556
556
  | `messages.listInboxConversations()` | List conversations |
557
- | `messages.createInboxConversation()` | Create conversation |
557
+ | `messages.createInboxConversation()` | Create conversation (send a WhatsApp template) |
558
558
  | `messages.getInboxConversation()` | Get conversation |
559
559
  | `messages.getInboxConversationMessages()` | List messages |
560
560
  | `messages.updateInboxConversation()` | Update conversation status |
package/dist/index.d.mts CHANGED
@@ -12690,32 +12690,68 @@ type SendInboxMessageData = {
12690
12690
  phone?: string;
12691
12691
  }>;
12692
12692
  /**
12693
- * Generic template for carousels (Instagram/Facebook only, ignored on Telegram).
12693
+ * Platform-dependent template payload. Ignored on Telegram.
12694
+ *
12695
+ * Instagram / Facebook: a generic template (carousel). Set `type: generic`
12696
+ * and provide up to 10 `elements`, each with a `title` (required) and
12697
+ * optional `subtitle`, `imageUrl`, and `buttons`.
12698
+ *
12699
+ * WhatsApp: sends an approved WhatsApp template message, the only message
12700
+ * type WhatsApp accepts when the 24-hour customer-service window is closed.
12701
+ * Provide exactly one element carrying the template reference:
12702
+ * `{ "elements": [{ "name": "order_update", "language": "en_US", "components": [...] }] }`
12703
+ * (`type` is ignored on WhatsApp). `components` is optional and is forwarded
12704
+ * unchanged as the `template.components` array of Meta's Cloud API send
12705
+ * payload; use it to fill body/header variables and button parameters, e.g.
12706
+ * `[{ "type": "body", "parameters": [{ "type": "text", "text": "John" }] }]`.
12707
+ * Templates with media headers (image, video, document) must include the
12708
+ * header component with its media link here at send time. To send a template
12709
+ * to a phone number with no existing conversation, or to have media headers
12710
+ * filled in automatically from the template definition, use the
12711
+ * create-conversation endpoint (POST /v1/inbox/conversations) instead.
12712
+ *
12694
12713
  */
12695
12714
  template?: {
12696
12715
  /**
12697
- * Template type
12716
+ * Template type. Required for Instagram/Facebook generic templates; ignored on WhatsApp.
12698
12717
  */
12699
12718
  type?: 'generic';
12700
12719
  elements?: Array<{
12701
12720
  /**
12702
- * Element title (max 80 chars)
12721
+ * Element title (max 80 chars). Required for Instagram/Facebook generic templates.
12703
12722
  */
12704
- title: string;
12723
+ title?: string;
12705
12724
  /**
12706
- * Element subtitle
12725
+ * Element subtitle (Instagram/Facebook only)
12707
12726
  */
12708
12727
  subtitle?: string;
12709
12728
  /**
12710
- * Element image URL
12729
+ * Element image URL (Instagram/Facebook only)
12711
12730
  */
12712
12731
  imageUrl?: string;
12732
+ /**
12733
+ * Element buttons (Instagram/Facebook only)
12734
+ */
12713
12735
  buttons?: Array<{
12714
12736
  type?: 'url' | 'postback';
12715
12737
  title?: string;
12716
12738
  url?: string;
12717
12739
  payload?: string;
12718
12740
  }>;
12741
+ /**
12742
+ * WhatsApp only. Name of the approved template to send.
12743
+ */
12744
+ name?: string;
12745
+ /**
12746
+ * WhatsApp only. Template language code (e.g. en_US).
12747
+ */
12748
+ language?: string;
12749
+ /**
12750
+ * WhatsApp only. Meta Cloud API send-shape components array, forwarded to Meta verbatim.
12751
+ */
12752
+ components?: Array<{
12753
+ [key: string]: unknown;
12754
+ }>;
12719
12755
  }>;
12720
12756
  };
12721
12757
  /**
@@ -14847,6 +14883,16 @@ type PurchaseWhatsAppPhoneNumberData = {
14847
14883
  *
14848
14884
  */
14849
14885
  country?: string;
14886
+ /**
14887
+ * Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: "already_purchased", numberId, phoneNumber } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase.
14888
+ *
14889
+ */
14890
+ purchaseIntentId?: string;
14891
+ /**
14892
+ * Any second purchase within 10 minutes of a previous one is rejected with 409 code PURCHASE_VELOCITY as duplicate protection. Pass true to confirm the additional purchase is intentional (e.g. bulk provisioning).
14893
+ *
14894
+ */
14895
+ allowMultiple?: boolean;
14850
14896
  };
14851
14897
  };
14852
14898
  type PurchaseWhatsAppPhoneNumberResponse = (({
@@ -14863,6 +14909,10 @@ type PurchaseWhatsAppPhoneNumberResponse = (({
14863
14909
  metaPreverifiedId?: string;
14864
14910
  metaVerificationStatus?: string;
14865
14911
  };
14912
+ } | {
14913
+ status?: 'already_purchased';
14914
+ numberId?: string;
14915
+ phoneNumber?: string;
14866
14916
  }) | {
14867
14917
  status?: 'kyc_required';
14868
14918
  country?: string;
@@ -14870,6 +14920,9 @@ type PurchaseWhatsAppPhoneNumberResponse = (({
14870
14920
  });
14871
14921
  type PurchaseWhatsAppPhoneNumberError = (unknown | {
14872
14922
  error?: string;
14923
+ } | {
14924
+ error?: string;
14925
+ code?: 'PURCHASE_VELOCITY';
14873
14926
  });
14874
14927
  type ListWhatsAppNumberCountriesResponse = ({
14875
14928
  countries?: Array<{
package/dist/index.d.ts CHANGED
@@ -12690,32 +12690,68 @@ type SendInboxMessageData = {
12690
12690
  phone?: string;
12691
12691
  }>;
12692
12692
  /**
12693
- * Generic template for carousels (Instagram/Facebook only, ignored on Telegram).
12693
+ * Platform-dependent template payload. Ignored on Telegram.
12694
+ *
12695
+ * Instagram / Facebook: a generic template (carousel). Set `type: generic`
12696
+ * and provide up to 10 `elements`, each with a `title` (required) and
12697
+ * optional `subtitle`, `imageUrl`, and `buttons`.
12698
+ *
12699
+ * WhatsApp: sends an approved WhatsApp template message, the only message
12700
+ * type WhatsApp accepts when the 24-hour customer-service window is closed.
12701
+ * Provide exactly one element carrying the template reference:
12702
+ * `{ "elements": [{ "name": "order_update", "language": "en_US", "components": [...] }] }`
12703
+ * (`type` is ignored on WhatsApp). `components` is optional and is forwarded
12704
+ * unchanged as the `template.components` array of Meta's Cloud API send
12705
+ * payload; use it to fill body/header variables and button parameters, e.g.
12706
+ * `[{ "type": "body", "parameters": [{ "type": "text", "text": "John" }] }]`.
12707
+ * Templates with media headers (image, video, document) must include the
12708
+ * header component with its media link here at send time. To send a template
12709
+ * to a phone number with no existing conversation, or to have media headers
12710
+ * filled in automatically from the template definition, use the
12711
+ * create-conversation endpoint (POST /v1/inbox/conversations) instead.
12712
+ *
12694
12713
  */
12695
12714
  template?: {
12696
12715
  /**
12697
- * Template type
12716
+ * Template type. Required for Instagram/Facebook generic templates; ignored on WhatsApp.
12698
12717
  */
12699
12718
  type?: 'generic';
12700
12719
  elements?: Array<{
12701
12720
  /**
12702
- * Element title (max 80 chars)
12721
+ * Element title (max 80 chars). Required for Instagram/Facebook generic templates.
12703
12722
  */
12704
- title: string;
12723
+ title?: string;
12705
12724
  /**
12706
- * Element subtitle
12725
+ * Element subtitle (Instagram/Facebook only)
12707
12726
  */
12708
12727
  subtitle?: string;
12709
12728
  /**
12710
- * Element image URL
12729
+ * Element image URL (Instagram/Facebook only)
12711
12730
  */
12712
12731
  imageUrl?: string;
12732
+ /**
12733
+ * Element buttons (Instagram/Facebook only)
12734
+ */
12713
12735
  buttons?: Array<{
12714
12736
  type?: 'url' | 'postback';
12715
12737
  title?: string;
12716
12738
  url?: string;
12717
12739
  payload?: string;
12718
12740
  }>;
12741
+ /**
12742
+ * WhatsApp only. Name of the approved template to send.
12743
+ */
12744
+ name?: string;
12745
+ /**
12746
+ * WhatsApp only. Template language code (e.g. en_US).
12747
+ */
12748
+ language?: string;
12749
+ /**
12750
+ * WhatsApp only. Meta Cloud API send-shape components array, forwarded to Meta verbatim.
12751
+ */
12752
+ components?: Array<{
12753
+ [key: string]: unknown;
12754
+ }>;
12719
12755
  }>;
12720
12756
  };
12721
12757
  /**
@@ -14847,6 +14883,16 @@ type PurchaseWhatsAppPhoneNumberData = {
14847
14883
  *
14848
14884
  */
14849
14885
  country?: string;
14886
+ /**
14887
+ * Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: "already_purchased", numberId, phoneNumber } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase.
14888
+ *
14889
+ */
14890
+ purchaseIntentId?: string;
14891
+ /**
14892
+ * Any second purchase within 10 minutes of a previous one is rejected with 409 code PURCHASE_VELOCITY as duplicate protection. Pass true to confirm the additional purchase is intentional (e.g. bulk provisioning).
14893
+ *
14894
+ */
14895
+ allowMultiple?: boolean;
14850
14896
  };
14851
14897
  };
14852
14898
  type PurchaseWhatsAppPhoneNumberResponse = (({
@@ -14863,6 +14909,10 @@ type PurchaseWhatsAppPhoneNumberResponse = (({
14863
14909
  metaPreverifiedId?: string;
14864
14910
  metaVerificationStatus?: string;
14865
14911
  };
14912
+ } | {
14913
+ status?: 'already_purchased';
14914
+ numberId?: string;
14915
+ phoneNumber?: string;
14866
14916
  }) | {
14867
14917
  status?: 'kyc_required';
14868
14918
  country?: string;
@@ -14870,6 +14920,9 @@ type PurchaseWhatsAppPhoneNumberResponse = (({
14870
14920
  });
14871
14921
  type PurchaseWhatsAppPhoneNumberError = (unknown | {
14872
14922
  error?: string;
14923
+ } | {
14924
+ error?: string;
14925
+ code?: 'PURCHASE_VELOCITY';
14873
14926
  });
14874
14927
  type ListWhatsAppNumberCountriesResponse = ({
14875
14928
  countries?: Array<{
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(index_exports);
36
36
  // package.json
37
37
  var package_default = {
38
38
  name: "@getlatedev/node",
39
- version: "0.2.243",
39
+ version: "0.2.245",
40
40
  description: "The official Node.js library for the Zernio API",
41
41
  main: "dist/index.js",
42
42
  module: "dist/index.mjs",
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@getlatedev/node",
8
- version: "0.2.243",
8
+ version: "0.2.245",
9
9
  description: "The official Node.js library for the Zernio API",
10
10
  main: "dist/index.js",
11
11
  module: "dist/index.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlatedev/node",
3
- "version": "0.2.243",
3
+ "version": "0.2.245",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -2335,10 +2335,12 @@ export const listInboxConversations = <ThrowOnError extends boolean = false>(opt
2335
2335
  };
2336
2336
 
2337
2337
  /**
2338
- * Create conversation
2338
+ * Create conversation (send a WhatsApp template)
2339
2339
  * Initiate a new direct message conversation with a specified user. If a conversation already exists with the recipient, the message is added to the existing thread.
2340
2340
  *
2341
- * Supported platforms: X/Twitter, Bluesky, Reddit, and WhatsApp. Other platforms return PLATFORM_NOT_SUPPORTED. For WhatsApp, a conversation can only be started with an approved template (provide templateName, templateLanguage, and any templateParams) — freeform initial messages are not permitted by WhatsApp; a missing template returns TEMPLATE_REQUIRED.
2341
+ * Supported platforms: X/Twitter, Bluesky, Reddit, and WhatsApp. Other platforms return PLATFORM_NOT_SUPPORTED.
2342
+ *
2343
+ * WhatsApp: this is the endpoint for sending an approved template message to a phone number. Provide templateName, templateLanguage, and templateParams (body variable values), with the recipient phone in participantId. A template is required because WhatsApp does not permit freeform messages to open a conversation; a missing template returns TEMPLATE_REQUIRED. Templates with media headers (image, video, document) are handled automatically: Zernio reads the approved template definition and fills the header at send time. Calling this for a number you already have a thread with simply sends the template into that thread, which also makes it the way to re-engage a contact after the 24-hour customer-service window has closed. Once the recipient replies (opening the 24h window), send freeform messages with the send-message endpoint (POST /v1/inbox/conversations/{conversationId}/messages). Template fields are accepted on the JSON body only, not on multipart requests.
2342
2344
  *
2343
2345
  * DM eligibility (X/Twitter): Before sending, the endpoint checks if the recipient accepts DMs from your account (via the receives_your_dm field). If not, a 422 error with code DM_NOT_ALLOWED is returned. You can skip this check with skipDmCheck: true if you have already verified eligibility.
2344
2346
  *
@@ -2419,6 +2421,14 @@ export const getInboxConversationMessages = <ThrowOnError extends boolean = fals
2419
2421
  * buttons, templates, and message tags. Attachment and interactive message
2420
2422
  * support varies by platform.
2421
2423
  *
2424
+ * WhatsApp template messages: to send an approved template into this
2425
+ * conversation (required when the 24-hour customer-service window is
2426
+ * closed), use the `template` field with a single element carrying the
2427
+ * template reference: `{ "elements": [{ "name": ..., "language": ..., "components": [...] }] }`.
2428
+ * See the `template` field below for the exact shape. To send a template
2429
+ * to a phone number you have no conversation with yet, use the
2430
+ * create-conversation endpoint (POST /v1/inbox/conversations) instead.
2431
+ *
2422
2432
  * WhatsApp rich interactive messages (list, CTA URL, Flow) are available via
2423
2433
  * the `interactive` field. Tap events are delivered through the
2424
2434
  * `message.received` webhook with WhatsApp-specific `metadata` fields
@@ -12671,32 +12671,68 @@ export type SendInboxMessageData = {
12671
12671
  phone?: string;
12672
12672
  }>;
12673
12673
  /**
12674
- * Generic template for carousels (Instagram/Facebook only, ignored on Telegram).
12674
+ * Platform-dependent template payload. Ignored on Telegram.
12675
+ *
12676
+ * Instagram / Facebook: a generic template (carousel). Set `type: generic`
12677
+ * and provide up to 10 `elements`, each with a `title` (required) and
12678
+ * optional `subtitle`, `imageUrl`, and `buttons`.
12679
+ *
12680
+ * WhatsApp: sends an approved WhatsApp template message, the only message
12681
+ * type WhatsApp accepts when the 24-hour customer-service window is closed.
12682
+ * Provide exactly one element carrying the template reference:
12683
+ * `{ "elements": [{ "name": "order_update", "language": "en_US", "components": [...] }] }`
12684
+ * (`type` is ignored on WhatsApp). `components` is optional and is forwarded
12685
+ * unchanged as the `template.components` array of Meta's Cloud API send
12686
+ * payload; use it to fill body/header variables and button parameters, e.g.
12687
+ * `[{ "type": "body", "parameters": [{ "type": "text", "text": "John" }] }]`.
12688
+ * Templates with media headers (image, video, document) must include the
12689
+ * header component with its media link here at send time. To send a template
12690
+ * to a phone number with no existing conversation, or to have media headers
12691
+ * filled in automatically from the template definition, use the
12692
+ * create-conversation endpoint (POST /v1/inbox/conversations) instead.
12693
+ *
12675
12694
  */
12676
12695
  template?: {
12677
12696
  /**
12678
- * Template type
12697
+ * Template type. Required for Instagram/Facebook generic templates; ignored on WhatsApp.
12679
12698
  */
12680
12699
  type?: 'generic';
12681
12700
  elements?: Array<{
12682
12701
  /**
12683
- * Element title (max 80 chars)
12702
+ * Element title (max 80 chars). Required for Instagram/Facebook generic templates.
12684
12703
  */
12685
- title: string;
12704
+ title?: string;
12686
12705
  /**
12687
- * Element subtitle
12706
+ * Element subtitle (Instagram/Facebook only)
12688
12707
  */
12689
12708
  subtitle?: string;
12690
12709
  /**
12691
- * Element image URL
12710
+ * Element image URL (Instagram/Facebook only)
12692
12711
  */
12693
12712
  imageUrl?: string;
12713
+ /**
12714
+ * Element buttons (Instagram/Facebook only)
12715
+ */
12694
12716
  buttons?: Array<{
12695
12717
  type?: 'url' | 'postback';
12696
12718
  title?: string;
12697
12719
  url?: string;
12698
12720
  payload?: string;
12699
12721
  }>;
12722
+ /**
12723
+ * WhatsApp only. Name of the approved template to send.
12724
+ */
12725
+ name?: string;
12726
+ /**
12727
+ * WhatsApp only. Template language code (e.g. en_US).
12728
+ */
12729
+ language?: string;
12730
+ /**
12731
+ * WhatsApp only. Meta Cloud API send-shape components array, forwarded to Meta verbatim.
12732
+ */
12733
+ components?: Array<{
12734
+ [key: string]: unknown;
12735
+ }>;
12700
12736
  }>;
12701
12737
  };
12702
12738
  /**
@@ -15005,6 +15041,16 @@ export type PurchaseWhatsAppPhoneNumberData = {
15005
15041
  *
15006
15042
  */
15007
15043
  country?: string;
15044
+ /**
15045
+ * Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: "already_purchased", numberId, phoneNumber } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase.
15046
+ *
15047
+ */
15048
+ purchaseIntentId?: string;
15049
+ /**
15050
+ * Any second purchase within 10 minutes of a previous one is rejected with 409 code PURCHASE_VELOCITY as duplicate protection. Pass true to confirm the additional purchase is intentional (e.g. bulk provisioning).
15051
+ *
15052
+ */
15053
+ allowMultiple?: boolean;
15008
15054
  };
15009
15055
  };
15010
15056
 
@@ -15022,6 +15068,10 @@ export type PurchaseWhatsAppPhoneNumberResponse = (({
15022
15068
  metaPreverifiedId?: string;
15023
15069
  metaVerificationStatus?: string;
15024
15070
  };
15071
+ } | {
15072
+ status?: 'already_purchased';
15073
+ numberId?: string;
15074
+ phoneNumber?: string;
15025
15075
  }) | {
15026
15076
  status?: 'kyc_required';
15027
15077
  country?: string;
@@ -15030,6 +15080,9 @@ export type PurchaseWhatsAppPhoneNumberResponse = (({
15030
15080
 
15031
15081
  export type PurchaseWhatsAppPhoneNumberError = (unknown | {
15032
15082
  error?: string;
15083
+ } | {
15084
+ error?: string;
15085
+ code?: 'PURCHASE_VELOCITY';
15033
15086
  });
15034
15087
 
15035
15088
  export type ListWhatsAppNumberCountriesResponse = ({