@zavudev/sdk 0.60.3 → 0.62.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/src/types.ts CHANGED
@@ -514,6 +514,30 @@ export interface MessageContent {
514
514
  * applies: no line breaks, tabs or more than 4 consecutive spaces.
515
515
  */
516
516
  templateHeaderVariables?: { [key: string]: string };
517
+ /**
518
+ * HTTPS URL of the media for this send, for a WhatsApp template whose header is
519
+ * `image`, `video` or `document`. It replaces the file stored on the template for
520
+ * this message only; the template is not changed. WhatsApp fetches the URL when
521
+ * the message is sent, so it must be publicly reachable at that moment (a
522
+ * short-lived signed link works if it outlives the send). Without it, the
523
+ * template's stored header file is sent.
524
+ *
525
+ * A template whose header is `text`, or that has no header, is refused with `400
526
+ * invalid_request` and `details.field` set to `content.templateHeaderMediaUrl`,
527
+ * before anything is sent or charged. A URL that is not HTTPS is refused with `400
528
+ * invalid_request` and a `details.errors` entry whose `path` is `["content",
529
+ * "templateHeaderMediaUrl"]`. Ignored on channels other than WhatsApp.
530
+ */
531
+ templateHeaderMediaUrl?: string;
532
+ /**
533
+ * File name WhatsApp shows the recipient for a `document` header, e.g.
534
+ * `invoice-1042.pdf`. Works with `templateHeaderMediaUrl`, or on its own to name
535
+ * the template's stored file. Only valid when the template's header is `document`:
536
+ * any other header is refused with `400 invalid_request` and `details.field` set
537
+ * to `content.templateHeaderFilename`, before anything is sent or charged. Ignored
538
+ * on channels other than WhatsApp.
539
+ */
540
+ templateHeaderFilename?: string;
517
541
  referral?: AdReferral;
518
542
  }
519
543
 
@@ -948,7 +972,10 @@ export type TemplateCreateRequestButtonsItemOtpType = 'COPY_CODE' | 'ONE_TAP';
948
972
  * attribution — including `ctwaClid`, the identifier Meta's Conversions API
949
973
  * needs to credit a conversion back to that ad. WhatsApp only, and only on the
950
974
  * first message of the thread: it is absent from every later message, so persist
951
- * it when it arrives.
975
+ * it when it arrives. A message that was held because the allowance was spent
976
+ * (see `POST /v1/messages`) is delivered once the team pays, carrying
977
+ * `data.heldAt`: when it was held, in Unix milliseconds. It is absent on every
978
+ * other message.
952
979
  * - `message.unsupported`: Received a message type that is not supported
953
980
  *
954
981
  * **Broadcast events:**
@@ -1137,6 +1164,14 @@ export interface WebhookMessageData {
1137
1164
  * returns it, under `content.referral`.
1138
1165
  */
1139
1166
  referral?: AdReferral;
1167
+ /**
1168
+ * When this message was held, in Unix milliseconds. Present on `message.inbound`
1169
+ * only for a message that arrived while the monthly allowance was spent and was
1170
+ * delivered later, once the team paid; absent on every other message. Compare it
1171
+ * with `providerTimestamp` (when the contact sent it) and the event's `timestamp`
1172
+ * (when it was delivered) to decide whether an automated reply still makes sense.
1173
+ */
1174
+ heldAt?: number;
1140
1175
  }
1141
1176
 
1142
1177
  export interface WebhookMessageDataWhatsapp {
@@ -2069,10 +2104,11 @@ export interface PhoneNumberPricing {
2069
2104
  /** One-time purchase price in USD. */
2070
2105
  upfrontPrice?: number;
2071
2106
  /**
2072
- * Whether this number qualifies as the plan-included number: a US or Canadian
2073
- * number (a +1 number) costing $20 a month or less. The benefit is one per
2074
- * account: it is never offered again once claimed, not even after the number is
2075
- * released.
2107
+ * Whether this account can claim this number as the one its paid plan includes: a
2108
+ * US or Canadian number (a +1 number) costing $20 a month or less. It depends on
2109
+ * the account as well as the number: `false` on Free, and once the benefit has
2110
+ * been claimed, which is once per account and never again, not even after the
2111
+ * number is released.
2076
2112
  */
2077
2113
  isFreeEligible?: boolean;
2078
2114
  }
@@ -2124,6 +2160,23 @@ export interface OwnedPhoneNumber {
2124
2160
  */
2125
2161
  regulatoryStatus: OwnedPhoneNumberRegulatoryStatus;
2126
2162
  nextRenewalDate?: string;
2163
+ /**
2164
+ * When the number goes back to the carrier, if it is on its way out. Absent
2165
+ * otherwise.
2166
+ *
2167
+ * - **A paid plan ended.** Without a paid plan a team keeps one number: the one
2168
+ * chosen in the dashboard when cancelling, else the one the plan included, else
2169
+ * the oldest it bought. That number is billed monthly from the balance and has
2170
+ * no `releaseAt` unless a renewal fails. Every other number keeps working,
2171
+ * unbilled, until this date, 7 days after the plan ended. Numbers you brought
2172
+ * yourself are never released.
2173
+ * - **A renewal could not be paid.** The number is suspended and released at the
2174
+ * end of a 7-day grace.
2175
+ *
2176
+ * Paying, or returning to a paid plan, before this date keeps the number. A
2177
+ * released number cannot be recovered.
2178
+ */
2179
+ releaseAt?: string;
2127
2180
  createdAt: string;
2128
2181
  updatedAt?: string;
2129
2182
  }
@@ -3062,6 +3115,13 @@ export interface SubAccountResponse {
3062
3115
  subAccount: SubAccount;
3063
3116
  }
3064
3117
 
3118
+ /**
3119
+ * The team's balance, and what stops or charges it this month. Every field past
3120
+ * `isSubAccount` is team-level, the same for every project and sub-account of the
3121
+ * team. An integration that only replies to `message.inbound` never sends while
3122
+ * incoming messages are held, so it never sees the `429` that reports them: poll
3123
+ * this instead.
3124
+ */
3065
3125
  export interface BalanceResponse {
3066
3126
  /** Team balance in cents. All charges are billed to the parent team. */
3067
3127
  balance: number;
@@ -3072,6 +3132,59 @@ export interface BalanceResponse {
3072
3132
  totalSpent?: number | null;
3073
3133
  /** Whether this API key belongs to a sub-account. */
3074
3134
  isSubAccount?: boolean;
3135
+ /**
3136
+ * Whether the team is on Free and has added funds, so app messages past the
3137
+ * allowance are billed in blocks from the balance instead of stopping.
3138
+ */
3139
+ payAsYouGo: boolean;
3140
+ /**
3141
+ * The monthly usage spend cap in cents, set in the dashboard's Billing. Null means
3142
+ * no cap. The first deposit on Free sets $50 when none was chosen.
3143
+ */
3144
+ spendCap: number | null;
3145
+ /**
3146
+ * Usage taken from the balance this calendar month (UTC), in cents: what the spend
3147
+ * cap is measured against. Renewals are not counted.
3148
+ */
3149
+ spentThisMonth: number;
3150
+ /**
3151
+ * This month's WhatsApp, Telegram, Instagram and Messenger messages, sent and
3152
+ * received.
3153
+ */
3154
+ appMessages: BalanceResponseAppMessages;
3155
+ /**
3156
+ * Incoming messages held at the allowance, or null when none are. Counts and a
3157
+ * date only, never content or senders. They are delivered once the team pays; see
3158
+ * `POST /v1/messages`.
3159
+ */
3160
+ heldInbound: BalanceResponseHeldInbound | null;
3161
+ }
3162
+
3163
+ export interface BalanceResponseAppMessages {
3164
+ /** Messages counted this month, in both directions. */
3165
+ used: number;
3166
+ /**
3167
+ * Messages the plan includes this month. Null on a paid plan, which does not cap
3168
+ * them.
3169
+ */
3170
+ included: number | null;
3171
+ /**
3172
+ * Why app messages are stopped right now, or null. `allowance`: Free without funds
3173
+ * at its allowance. `balance`: pay as you go and the balance cannot cover the next
3174
+ * block. `spend_cap`: pay as you go and the spend cap leaves no room for it. While
3175
+ * paused, sends answer `429 a2p_limit_exceeded` and incoming messages are held.
3176
+ */
3177
+ paused: BalanceResponseAppMessagesPaused | null;
3178
+ }
3179
+
3180
+ export type BalanceResponseAppMessagesPaused = 'allowance' | 'balance' | 'spend_cap';
3181
+
3182
+ export interface BalanceResponseHeldInbound {
3183
+ count: number;
3184
+ /** How many the team can have held at once (1,000). Past it new ones are refused. */
3185
+ max: number;
3186
+ /** When the oldest held message expires and is dropped. */
3187
+ nextExpiresAt: string | null;
3075
3188
  }
3076
3189
 
3077
3190
  export interface SubAccountApiKey {
@@ -4313,6 +4426,8 @@ export interface EscalateUrlResponse {
4313
4426
  message: string;
4314
4427
  }
4315
4428
 
4429
+ export type SendMessageError409 = MessageResponse | ErrorBody;
4430
+
4316
4431
  export interface SendMessageError429 {
4317
4432
  code?: string;
4318
4433
  message?: string;
package/src/v2/types.ts CHANGED
@@ -1128,6 +1128,31 @@ export interface MessageContent {
1128
1128
  * text headers need no value.
1129
1129
  */
1130
1130
  templateHeaderVariables?: { [key: string]: string };
1131
+ /**
1132
+ * HTTPS URL of the media for this send, for a WhatsApp template whose header is
1133
+ * `image`, `video` or `document`. It replaces the file stored on the template for
1134
+ * this message only; the template is not changed. WhatsApp fetches the URL when
1135
+ * the message is sent, so it must be publicly reachable at that moment (a
1136
+ * short-lived signed link works if it outlives the send). Without it, the
1137
+ * template's stored header file is sent.
1138
+ *
1139
+ * A template whose header is `text`, or that has no header, is refused with `400
1140
+ * invalid_request`: `details.field` is `content.templateHeaderMediaUrl` and
1141
+ * `details.errors` repeats the message, before anything is sent or charged. A URL
1142
+ * that is not HTTPS is refused with `400 invalid_request` and a `details.errors`
1143
+ * entry whose `path` is `["content", "templateHeaderMediaUrl"]`. Ignored on
1144
+ * channels other than WhatsApp.
1145
+ */
1146
+ templateHeaderMediaUrl?: string;
1147
+ /**
1148
+ * File name WhatsApp shows the recipient for a `document` header, e.g.
1149
+ * `invoice-1042.pdf`. Works with `templateHeaderMediaUrl`, or on its own to name
1150
+ * the template's stored file. Only valid when the template's header is `document`:
1151
+ * any other header is refused with `400 invalid_request`, `details.field` set to
1152
+ * `content.templateHeaderFilename` and `details.errors` repeating the message,
1153
+ * before anything is sent or charged. Ignored on channels other than WhatsApp.
1154
+ */
1155
+ templateHeaderFilename?: string;
1131
1156
  referral?: AdReferral;
1132
1157
  }
1133
1158
 
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // Generated by zavu-codegen from apps/docs/openapi.json. Do not edit: run `bun run codegen`.
2
2
 
3
- export const VERSION = '0.60.3'; // x-release-please-version
3
+ export const VERSION = '0.62.0'; // x-release-please-version
package/types.d.mts CHANGED
@@ -461,6 +461,30 @@ export interface MessageContent {
461
461
  templateHeaderVariables?: {
462
462
  [key: string]: string;
463
463
  };
464
+ /**
465
+ * HTTPS URL of the media for this send, for a WhatsApp template whose header is
466
+ * `image`, `video` or `document`. It replaces the file stored on the template for
467
+ * this message only; the template is not changed. WhatsApp fetches the URL when
468
+ * the message is sent, so it must be publicly reachable at that moment (a
469
+ * short-lived signed link works if it outlives the send). Without it, the
470
+ * template's stored header file is sent.
471
+ *
472
+ * A template whose header is `text`, or that has no header, is refused with `400
473
+ * invalid_request` and `details.field` set to `content.templateHeaderMediaUrl`,
474
+ * before anything is sent or charged. A URL that is not HTTPS is refused with `400
475
+ * invalid_request` and a `details.errors` entry whose `path` is `["content",
476
+ * "templateHeaderMediaUrl"]`. Ignored on channels other than WhatsApp.
477
+ */
478
+ templateHeaderMediaUrl?: string;
479
+ /**
480
+ * File name WhatsApp shows the recipient for a `document` header, e.g.
481
+ * `invoice-1042.pdf`. Works with `templateHeaderMediaUrl`, or on its own to name
482
+ * the template's stored file. Only valid when the template's header is `document`:
483
+ * any other header is refused with `400 invalid_request` and `details.field` set
484
+ * to `content.templateHeaderFilename`, before anything is sent or charged. Ignored
485
+ * on channels other than WhatsApp.
486
+ */
487
+ templateHeaderFilename?: string;
464
488
  referral?: AdReferral;
465
489
  }
466
490
  export interface MessageContentContactsItem {
@@ -866,7 +890,10 @@ export type TemplateCreateRequestButtonsItemOtpType = 'COPY_CODE' | 'ONE_TAP';
866
890
  * attribution — including `ctwaClid`, the identifier Meta's Conversions API
867
891
  * needs to credit a conversion back to that ad. WhatsApp only, and only on the
868
892
  * first message of the thread: it is absent from every later message, so persist
869
- * it when it arrives.
893
+ * it when it arrives. A message that was held because the allowance was spent
894
+ * (see `POST /v1/messages`) is delivered once the team pays, carrying
895
+ * `data.heldAt`: when it was held, in Unix milliseconds. It is absent on every
896
+ * other message.
870
897
  * - `message.unsupported`: Received a message type that is not supported
871
898
  *
872
899
  * **Broadcast events:**
@@ -1036,6 +1063,14 @@ export interface WebhookMessageData {
1036
1063
  * returns it, under `content.referral`.
1037
1064
  */
1038
1065
  referral?: AdReferral;
1066
+ /**
1067
+ * When this message was held, in Unix milliseconds. Present on `message.inbound`
1068
+ * only for a message that arrived while the monthly allowance was spent and was
1069
+ * delivered later, once the team paid; absent on every other message. Compare it
1070
+ * with `providerTimestamp` (when the contact sent it) and the event's `timestamp`
1071
+ * (when it was delivered) to decide whether an automated reply still makes sense.
1072
+ */
1073
+ heldAt?: number;
1039
1074
  }
1040
1075
  export interface WebhookMessageDataWhatsapp {
1041
1076
  /**
@@ -1865,10 +1900,11 @@ export interface PhoneNumberPricing {
1865
1900
  /** One-time purchase price in USD. */
1866
1901
  upfrontPrice?: number;
1867
1902
  /**
1868
- * Whether this number qualifies as the plan-included number: a US or Canadian
1869
- * number (a +1 number) costing $20 a month or less. The benefit is one per
1870
- * account: it is never offered again once claimed, not even after the number is
1871
- * released.
1903
+ * Whether this account can claim this number as the one its paid plan includes: a
1904
+ * US or Canadian number (a +1 number) costing $20 a month or less. It depends on
1905
+ * the account as well as the number: `false` on Free, and once the benefit has
1906
+ * been claimed, which is once per account and never again, not even after the
1907
+ * number is released.
1872
1908
  */
1873
1909
  isFreeEligible?: boolean;
1874
1910
  }
@@ -1917,6 +1953,23 @@ export interface OwnedPhoneNumber {
1917
1953
  */
1918
1954
  regulatoryStatus: OwnedPhoneNumberRegulatoryStatus;
1919
1955
  nextRenewalDate?: string;
1956
+ /**
1957
+ * When the number goes back to the carrier, if it is on its way out. Absent
1958
+ * otherwise.
1959
+ *
1960
+ * - **A paid plan ended.** Without a paid plan a team keeps one number: the one
1961
+ * chosen in the dashboard when cancelling, else the one the plan included, else
1962
+ * the oldest it bought. That number is billed monthly from the balance and has
1963
+ * no `releaseAt` unless a renewal fails. Every other number keeps working,
1964
+ * unbilled, until this date, 7 days after the plan ended. Numbers you brought
1965
+ * yourself are never released.
1966
+ * - **A renewal could not be paid.** The number is suspended and released at the
1967
+ * end of a 7-day grace.
1968
+ *
1969
+ * Paying, or returning to a paid plan, before this date keeps the number. A
1970
+ * released number cannot be recovered.
1971
+ */
1972
+ releaseAt?: string;
1920
1973
  createdAt: string;
1921
1974
  updatedAt?: string;
1922
1975
  }
@@ -2751,6 +2804,13 @@ export interface SubAccountUpdateRequest {
2751
2804
  export interface SubAccountResponse {
2752
2805
  subAccount: SubAccount;
2753
2806
  }
2807
+ /**
2808
+ * The team's balance, and what stops or charges it this month. Every field past
2809
+ * `isSubAccount` is team-level, the same for every project and sub-account of the
2810
+ * team. An integration that only replies to `message.inbound` never sends while
2811
+ * incoming messages are held, so it never sees the `429` that reports them: poll
2812
+ * this instead.
2813
+ */
2754
2814
  export interface BalanceResponse {
2755
2815
  /** Team balance in cents. All charges are billed to the parent team. */
2756
2816
  balance: number;
@@ -2761,6 +2821,56 @@ export interface BalanceResponse {
2761
2821
  totalSpent?: number | null;
2762
2822
  /** Whether this API key belongs to a sub-account. */
2763
2823
  isSubAccount?: boolean;
2824
+ /**
2825
+ * Whether the team is on Free and has added funds, so app messages past the
2826
+ * allowance are billed in blocks from the balance instead of stopping.
2827
+ */
2828
+ payAsYouGo: boolean;
2829
+ /**
2830
+ * The monthly usage spend cap in cents, set in the dashboard's Billing. Null means
2831
+ * no cap. The first deposit on Free sets $50 when none was chosen.
2832
+ */
2833
+ spendCap: number | null;
2834
+ /**
2835
+ * Usage taken from the balance this calendar month (UTC), in cents: what the spend
2836
+ * cap is measured against. Renewals are not counted.
2837
+ */
2838
+ spentThisMonth: number;
2839
+ /**
2840
+ * This month's WhatsApp, Telegram, Instagram and Messenger messages, sent and
2841
+ * received.
2842
+ */
2843
+ appMessages: BalanceResponseAppMessages;
2844
+ /**
2845
+ * Incoming messages held at the allowance, or null when none are. Counts and a
2846
+ * date only, never content or senders. They are delivered once the team pays; see
2847
+ * `POST /v1/messages`.
2848
+ */
2849
+ heldInbound: BalanceResponseHeldInbound | null;
2850
+ }
2851
+ export interface BalanceResponseAppMessages {
2852
+ /** Messages counted this month, in both directions. */
2853
+ used: number;
2854
+ /**
2855
+ * Messages the plan includes this month. Null on a paid plan, which does not cap
2856
+ * them.
2857
+ */
2858
+ included: number | null;
2859
+ /**
2860
+ * Why app messages are stopped right now, or null. `allowance`: Free without funds
2861
+ * at its allowance. `balance`: pay as you go and the balance cannot cover the next
2862
+ * block. `spend_cap`: pay as you go and the spend cap leaves no room for it. While
2863
+ * paused, sends answer `429 a2p_limit_exceeded` and incoming messages are held.
2864
+ */
2865
+ paused: BalanceResponseAppMessagesPaused | null;
2866
+ }
2867
+ export type BalanceResponseAppMessagesPaused = 'allowance' | 'balance' | 'spend_cap';
2868
+ export interface BalanceResponseHeldInbound {
2869
+ count: number;
2870
+ /** How many the team can have held at once (1,000). Past it new ones are refused. */
2871
+ max: number;
2872
+ /** When the oldest held message expires and is dropped. */
2873
+ nextExpiresAt: string | null;
2764
2874
  }
2765
2875
  export interface SubAccountApiKey {
2766
2876
  id: string;
@@ -3905,6 +4015,7 @@ export interface EscalateUrlResponse {
3905
4015
  url: VerifiedUrl;
3906
4016
  message: string;
3907
4017
  }
4018
+ export type SendMessageError409 = MessageResponse | ErrorBody;
3908
4019
  export interface SendMessageError429 {
3909
4020
  code?: string;
3910
4021
  message?: string;