@getlatedev/node 0.2.244 → 0.2.246

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
  /**
@@ -14816,6 +14852,21 @@ type GetWhatsAppPhoneNumbersResponse = ({
14816
14852
  regulatoryDeclineReason?: (string) | null;
14817
14853
  createdAt?: string;
14818
14854
  }>;
14855
+ /**
14856
+ * Connected (bring-your-own) WhatsApp numbers — your own WABA
14857
+ * numbers linked via Embedded Signup. Not provisioned or billed
14858
+ * by Zernio, so they are not in `numbers`; `accountId` is the
14859
+ * social-account id used by the messaging and inbox endpoints.
14860
+ * Included only on the default and `status=active` views.
14861
+ *
14862
+ */
14863
+ connected?: Array<{
14864
+ accountId?: string;
14865
+ phoneNumber?: (string) | null;
14866
+ displayName?: (string) | null;
14867
+ profileId?: (string) | null;
14868
+ connectedAt?: (string) | null;
14869
+ }>;
14819
14870
  /**
14820
14871
  * The shared WhatsApp sandbox (one Zernio-owned number, all users test
14821
14872
  * against it). Present when the sandbox is configured; null otherwise.
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
  /**
@@ -14816,6 +14852,21 @@ type GetWhatsAppPhoneNumbersResponse = ({
14816
14852
  regulatoryDeclineReason?: (string) | null;
14817
14853
  createdAt?: string;
14818
14854
  }>;
14855
+ /**
14856
+ * Connected (bring-your-own) WhatsApp numbers — your own WABA
14857
+ * numbers linked via Embedded Signup. Not provisioned or billed
14858
+ * by Zernio, so they are not in `numbers`; `accountId` is the
14859
+ * social-account id used by the messaging and inbox endpoints.
14860
+ * Included only on the default and `status=active` views.
14861
+ *
14862
+ */
14863
+ connected?: Array<{
14864
+ accountId?: string;
14865
+ phoneNumber?: (string) | null;
14866
+ displayName?: (string) | null;
14867
+ profileId?: (string) | null;
14868
+ connectedAt?: (string) | null;
14869
+ }>;
14819
14870
  /**
14820
14871
  * The shared WhatsApp sandbox (one Zernio-owned number, all users test
14821
14872
  * against it). Present when the sandbox is configured; null otherwise.
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.244",
39
+ version: "0.2.246",
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.244",
8
+ version: "0.2.246",
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.244",
3
+ "version": "0.2.246",
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
@@ -3239,7 +3249,9 @@ export const createWhatsAppDataset = <ThrowOnError extends boolean = false>(opti
3239
3249
  /**
3240
3250
  * List phone numbers
3241
3251
  * List all WhatsApp phone numbers purchased by the authenticated user.
3242
- * By default, released numbers are excluded.
3252
+ * By default, released numbers are excluded. Connected (bring-your-own)
3253
+ * numbers are returned in the separate `connected` array — they are not
3254
+ * billed and have no provisioning lifecycle.
3243
3255
  *
3244
3256
  */
3245
3257
  export const getWhatsAppPhoneNumbers = <ThrowOnError extends boolean = false>(options?: OptionsLegacyParser<GetWhatsAppPhoneNumbersData, ThrowOnError>) => {
@@ -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
  /**
@@ -14972,6 +15008,21 @@ export type GetWhatsAppPhoneNumbersResponse = ({
14972
15008
  regulatoryDeclineReason?: (string) | null;
14973
15009
  createdAt?: string;
14974
15010
  }>;
15011
+ /**
15012
+ * Connected (bring-your-own) WhatsApp numbers — your own WABA
15013
+ * numbers linked via Embedded Signup. Not provisioned or billed
15014
+ * by Zernio, so they are not in `numbers`; `accountId` is the
15015
+ * social-account id used by the messaging and inbox endpoints.
15016
+ * Included only on the default and `status=active` views.
15017
+ *
15018
+ */
15019
+ connected?: Array<{
15020
+ accountId?: string;
15021
+ phoneNumber?: (string) | null;
15022
+ displayName?: (string) | null;
15023
+ profileId?: (string) | null;
15024
+ connectedAt?: (string) | null;
15025
+ }>;
14975
15026
  /**
14976
15027
  * The shared WhatsApp sandbox (one Zernio-owned number, all users test
14977
15028
  * against it). Present when the sandbox is configured; null otherwise.