@wats/types 0.3.1 → 0.3.3

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.
@@ -1,7 +1,7 @@
1
- export type { WhatsAppMessage } from "./messages/union";
2
- export type { WhatsAppContact, WhatsAppContactName, ContactPhone, ContactEmail, ContactAddress, ContactOrg, ContactUrl } from "./contacts";
3
- export type { WhatsAppMessageStatus, WhatsAppMessageStatusKind, ConversationRef, PricingRef } from "./statuses";
4
- export type { WhatsAppError, WhatsAppErrorPayload } from "./errors";
1
+ export type { WhatsAppMessage } from "./messages/union.js";
2
+ export type { WhatsAppContact, WhatsAppContactName, ContactPhone, ContactEmail, ContactAddress, ContactOrg, ContactUrl } from "./contacts.js";
3
+ export type { WhatsAppMessageStatus, WhatsAppMessageStatusKind, ConversationRef, PricingRef } from "./statuses.js";
4
+ export type { WhatsAppError, WhatsAppErrorPayload } from "./errors.js";
5
5
  export interface WhatsAppMessageText {
6
6
  body: string;
7
7
  }
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- export * from "./config";
2
- export * from "./webhook";
3
- export * from "./entities";
4
- export type { TextMessage, ImageMessage, VideoMessage, AudioMessage, DocumentMessage, StickerMessage, LocationMessage, LocationPayload, ContactsMessage, ReactionMessage, ReactionPayload, OrderMessage, OrderPayload, OrderProductItem, SystemMessage, SystemNotification, UnsupportedMessage, InteractiveMessage, InteractiveReply, InteractiveButtonReply, InteractiveListReply, InteractiveNfmReply, InteractiveProductReply, InteractiveProductListReply, InteractiveCtaUrlReply, ButtonMessage, ButtonPayload, WhatsAppMessageKind, MediaReference, DocumentReference, MessageContext } from "./messages";
5
- export { WATS_TYPES_MESSAGES_EXPORTS } from "./messages";
6
- export { WATS_TYPES_STATUSES_EXPORTS } from "./statuses";
7
- export { WATS_TYPES_CONTACTS_EXPORTS } from "./contacts";
8
- export { WATS_TYPES_ERRORS_EXPORTS } from "./errors";
9
- export type { WhatsAppMessagesFieldValue, WhatsAppTemplateStatusUpdateValue, WhatsAppAccountReviewUpdateValue, WhatsAppUserMarketingPreferencesValue, WhatsAppPhoneNumberChangeValue, WhatsAppIdentityChangeValue, WhatsAppRawWebhookValue } from "./webhook";
1
+ export * from "./config.js";
2
+ export * from "./webhook.js";
3
+ export * from "./entities.js";
4
+ export type { WhatsAppMessageStatus, WhatsAppMessageStatusKind, PricingRef, ConversationRef, WhatsAppPricingCategory, WhatsAppPricingModel, WhatsAppMarketingMessageStatus } from "./statuses.js";
5
+ export type { TextMessage, ImageMessage, VideoMessage, AudioMessage, DocumentMessage, StickerMessage, LocationMessage, LocationPayload, ContactsMessage, ReactionMessage, ReactionPayload, OrderMessage, OrderPayload, OrderProductItem, SystemMessage, SystemNotification, UnsupportedMessage, UnsupportedMessageDetail, InteractiveMessage, InteractiveReply, InteractiveButtonReply, InteractiveListReply, InteractiveNfmReply, InteractiveProductReply, InteractiveProductListReply, InteractiveCtaUrlReply, InteractiveCallPermissionReply, ButtonMessage, ButtonPayload, WhatsAppMessageKind, MediaReference, DocumentReference, MessageContext } from "./messages/index.js";
6
+ export { WATS_TYPES_MESSAGES_EXPORTS } from "./messages/index.js";
7
+ export { WATS_TYPES_STATUSES_EXPORTS } from "./statuses.js";
8
+ export { WATS_TYPES_CONTACTS_EXPORTS } from "./contacts.js";
9
+ export { WATS_TYPES_ERRORS_EXPORTS } from "./errors.js";
10
+ export type { WhatsAppMessagesFieldValue, WhatsAppAccountUpdateValue, WhatsAppTemplateStatusUpdateValue, WhatsAppAccountReviewUpdateValue, WhatsAppUserMarketingPreferencesValue, WhatsAppPhoneNumberChangeValue, WhatsAppIdentityChangeValue, WhatsAppRawWebhookValue } from "./webhook.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export * from "./config";
2
- export * from "./webhook";
3
- export * from "./entities";
4
- export { WATS_TYPES_MESSAGES_EXPORTS } from "./messages";
5
- export { WATS_TYPES_STATUSES_EXPORTS } from "./statuses";
6
- export { WATS_TYPES_CONTACTS_EXPORTS } from "./contacts";
7
- export { WATS_TYPES_ERRORS_EXPORTS } from "./errors";
1
+ export * from "./config.js";
2
+ export * from "./webhook.js";
3
+ export * from "./entities.js";
4
+ export { WATS_TYPES_MESSAGES_EXPORTS } from "./messages/index.js";
5
+ export { WATS_TYPES_STATUSES_EXPORTS } from "./statuses.js";
6
+ export { WATS_TYPES_CONTACTS_EXPORTS } from "./contacts.js";
7
+ export { WATS_TYPES_ERRORS_EXPORTS } from "./errors.js";
@@ -1,4 +1,4 @@
1
- import type { MediaReference, MessageContext } from "./media";
1
+ import type { MediaReference, MessageContext } from "./media.js";
2
2
  export interface AudioMessage {
3
3
  type: "audio";
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import type { MessageContext } from "./media";
1
+ import type { MessageContext } from "./media.js";
2
2
  export interface ButtonPayload {
3
3
  text: string;
4
4
  payload?: string;
@@ -1,5 +1,5 @@
1
- import type { WhatsAppContact } from "../contacts";
2
- import type { MessageContext } from "./media";
1
+ import type { WhatsAppContact } from "../contacts.js";
2
+ import type { MessageContext } from "./media.js";
3
3
  export interface ContactsMessage {
4
4
  type: "contacts";
5
5
  id: string;
@@ -1,4 +1,4 @@
1
- import type { DocumentReference, MessageContext } from "./media";
1
+ import type { DocumentReference, MessageContext } from "./media.js";
2
2
  export interface DocumentMessage {
3
3
  type: "document";
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import type { MediaReference, MessageContext } from "./media";
1
+ import type { MediaReference, MessageContext } from "./media.js";
2
2
  export interface ImageMessage {
3
3
  type: "image";
4
4
  id: string;
@@ -1,17 +1,17 @@
1
- export type { TextMessage } from "./text";
2
- export type { ImageMessage } from "./image";
3
- export type { VideoMessage } from "./video";
4
- export type { AudioMessage } from "./audio";
5
- export type { DocumentMessage } from "./document";
6
- export type { StickerMessage } from "./sticker";
7
- export type { LocationMessage, LocationPayload } from "./location";
8
- export type { ContactsMessage } from "./contacts";
9
- export type { ReactionMessage, ReactionPayload } from "./reaction";
10
- export type { OrderMessage, OrderPayload, OrderProductItem } from "./order";
11
- export type { SystemMessage, SystemNotification } from "./system";
12
- export type { UnsupportedMessage } from "./unsupported";
13
- export type { InteractiveMessage, InteractiveReply, InteractiveButtonReply, InteractiveListReply, InteractiveNfmReply, InteractiveProductReply, InteractiveProductListReply, InteractiveCtaUrlReply } from "./interactive";
14
- export type { ButtonMessage, ButtonPayload } from "./button";
15
- export type { WhatsAppMessage, WhatsAppMessageKind } from "./union";
16
- export type { MediaReference, DocumentReference, MessageContext } from "./media";
1
+ export type { TextMessage } from "./text.js";
2
+ export type { ImageMessage } from "./image.js";
3
+ export type { VideoMessage } from "./video.js";
4
+ export type { AudioMessage } from "./audio.js";
5
+ export type { DocumentMessage } from "./document.js";
6
+ export type { StickerMessage } from "./sticker.js";
7
+ export type { LocationMessage, LocationPayload } from "./location.js";
8
+ export type { ContactsMessage } from "./contacts.js";
9
+ export type { ReactionMessage, ReactionPayload } from "./reaction.js";
10
+ export type { OrderMessage, OrderPayload, OrderProductItem } from "./order.js";
11
+ export type { SystemMessage, SystemNotification } from "./system.js";
12
+ export type { UnsupportedMessage, UnsupportedMessageDetail } from "./unsupported.js";
13
+ export type { InteractiveMessage, InteractiveReply, InteractiveButtonReply, InteractiveListReply, InteractiveNfmReply, InteractiveProductReply, InteractiveProductListReply, InteractiveCtaUrlReply, InteractiveCallPermissionReply } from "./interactive.js";
14
+ export type { ButtonMessage, ButtonPayload } from "./button.js";
15
+ export type { WhatsAppMessage, WhatsAppMessageKind } from "./union.js";
16
+ export type { MediaReference, DocumentReference, MessageContext } from "./media.js";
17
17
  export declare const WATS_TYPES_MESSAGES_EXPORTS: readonly ["TextMessage", "ImageMessage", "VideoMessage", "AudioMessage", "DocumentMessage", "StickerMessage", "LocationMessage", "ContactsMessage", "ReactionMessage", "OrderMessage", "SystemMessage", "UnsupportedMessage", "InteractiveMessage", "ButtonMessage", "WhatsAppMessage", "InteractiveReply", "MediaReference", "DocumentReference", "MessageContext"];
@@ -1,4 +1,4 @@
1
- import type { MessageContext } from "./media";
1
+ import type { MessageContext } from "./media.js";
2
2
  export interface InteractiveButtonReply {
3
3
  type: "button_reply";
4
4
  buttonReply: {
@@ -45,7 +45,14 @@ export interface InteractiveCtaUrlReply {
45
45
  url: string;
46
46
  };
47
47
  }
48
- export type InteractiveReply = InteractiveButtonReply | InteractiveListReply | InteractiveNfmReply | InteractiveProductReply | InteractiveProductListReply | InteractiveCtaUrlReply;
48
+ export interface InteractiveCallPermissionReply {
49
+ type: "call_permission_reply";
50
+ callPermissionReply: {
51
+ response: "accepted" | "rejected";
52
+ expirationTimestamp?: string;
53
+ };
54
+ }
55
+ export type InteractiveReply = InteractiveButtonReply | InteractiveListReply | InteractiveNfmReply | InteractiveProductReply | InteractiveProductListReply | InteractiveCtaUrlReply | InteractiveCallPermissionReply;
49
56
  export interface InteractiveMessage {
50
57
  type: "interactive";
51
58
  id: string;
@@ -1,4 +1,4 @@
1
- import type { MessageContext } from "./media";
1
+ import type { MessageContext } from "./media.js";
2
2
  export interface LocationPayload {
3
3
  latitude: number;
4
4
  longitude: number;
@@ -2,8 +2,12 @@ export interface MediaReference {
2
2
  id: string;
3
3
  mimeType: string;
4
4
  sha256?: string;
5
+ /** WATS-89 / v24+ incoming media download URL when Meta includes it on webhook media objects. */
6
+ url?: string;
5
7
  caption?: string;
6
8
  filename?: string;
9
+ /** WATS-90 / Graph v24+ audio voice-message designation when present on audio media. */
10
+ voice?: boolean;
7
11
  }
8
12
  export interface DocumentReference extends MediaReference {
9
13
  filename: string;
@@ -1,4 +1,4 @@
1
- import type { MessageContext } from "./media";
1
+ import type { MessageContext } from "./media.js";
2
2
  export interface OrderProductItem {
3
3
  productRetailerId: string;
4
4
  quantity?: number;
@@ -1,4 +1,4 @@
1
- import type { MessageContext } from "./media";
1
+ import type { MessageContext } from "./media.js";
2
2
  export interface ReactionPayload {
3
3
  messageId: string;
4
4
  emoji: string;
@@ -1,4 +1,4 @@
1
- import type { MediaReference, MessageContext } from "./media";
1
+ import type { MediaReference, MessageContext } from "./media.js";
2
2
  export interface StickerMessage {
3
3
  type: "sticker";
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import type { MessageContext } from "./media";
1
+ import type { MessageContext } from "./media.js";
2
2
  export interface TextMessage {
3
3
  type: "text";
4
4
  id: string;
@@ -1,17 +1,17 @@
1
- import type { TextMessage } from "./text";
2
- import type { ImageMessage } from "./image";
3
- import type { VideoMessage } from "./video";
4
- import type { AudioMessage } from "./audio";
5
- import type { DocumentMessage } from "./document";
6
- import type { StickerMessage } from "./sticker";
7
- import type { LocationMessage } from "./location";
8
- import type { ContactsMessage } from "./contacts";
9
- import type { ReactionMessage } from "./reaction";
10
- import type { OrderMessage } from "./order";
11
- import type { SystemMessage } from "./system";
12
- import type { UnsupportedMessage } from "./unsupported";
13
- import type { InteractiveMessage } from "./interactive";
14
- import type { ButtonMessage } from "./button";
1
+ import type { TextMessage } from "./text.js";
2
+ import type { ImageMessage } from "./image.js";
3
+ import type { VideoMessage } from "./video.js";
4
+ import type { AudioMessage } from "./audio.js";
5
+ import type { DocumentMessage } from "./document.js";
6
+ import type { StickerMessage } from "./sticker.js";
7
+ import type { LocationMessage } from "./location.js";
8
+ import type { ContactsMessage } from "./contacts.js";
9
+ import type { ReactionMessage } from "./reaction.js";
10
+ import type { OrderMessage } from "./order.js";
11
+ import type { SystemMessage } from "./system.js";
12
+ import type { UnsupportedMessage } from "./unsupported.js";
13
+ import type { InteractiveMessage } from "./interactive.js";
14
+ import type { ButtonMessage } from "./button.js";
15
15
  export type WhatsAppMessage = TextMessage | ImageMessage | VideoMessage | AudioMessage | DocumentMessage | StickerMessage | LocationMessage | ContactsMessage | ReactionMessage | OrderMessage | SystemMessage | UnsupportedMessage | InteractiveMessage | ButtonMessage;
16
16
  /**
17
17
  * The closed set of `WhatsAppMessage.type` discriminators. Useful for
@@ -1,9 +1,16 @@
1
- import type { WhatsAppError } from "../errors";
1
+ import type { WhatsAppError } from "../errors.js";
2
+ export interface UnsupportedMessageDetail {
3
+ type?: string;
4
+ title?: string;
5
+ description?: string;
6
+ raw?: unknown;
7
+ }
2
8
  export interface UnsupportedMessage {
3
9
  type: "unsupported";
4
10
  id: string;
5
11
  from: string;
6
12
  timestamp: string;
13
+ unsupported?: UnsupportedMessageDetail;
7
14
  errors?: WhatsAppError[];
8
15
  raw?: unknown;
9
16
  }
@@ -1,4 +1,4 @@
1
- import type { MediaReference, MessageContext } from "./media";
1
+ import type { MediaReference, MessageContext } from "./media.js";
2
2
  export interface VideoMessage {
3
3
  type: "video";
4
4
  id: string;
@@ -1,15 +1,21 @@
1
- import type { WhatsAppError } from "./errors";
2
- export type WhatsAppMessageStatusKind = "sent" | "delivered" | "read" | "failed" | "deleted" | "warning";
1
+ import type { WhatsAppError } from "./errors.js";
2
+ export type WhatsAppMessageStatusKind = "sent" | "delivered" | "read" | "played" | "failed" | "deleted" | "warning";
3
+ export type WhatsAppPricingCategory = "marketing" | "marketing_lite" | string;
4
+ export type WhatsAppPricingModel = "CBP" | "NBP" | "PMP" | string;
5
+ export type WhatsAppMarketingMessageStatus = "accepted" | "held_for_quality_assessment" | "paused" | string;
3
6
  export interface ConversationRef {
4
7
  id: string;
8
+ /** WATS-98 Marketing Messages status webhooks can report `marketing_lite`. */
5
9
  origin?: {
6
- type: string;
10
+ type: "marketing_lite" | string;
7
11
  };
8
12
  expirationTimestamp?: string;
9
13
  }
10
14
  export interface PricingRef {
11
- category: string;
12
- pricingModel: string;
15
+ /** WATS-98 accepts current Meta pricing categories including `marketing_lite`. */
16
+ category: WhatsAppPricingCategory;
17
+ /** WATS-98 MM API status examples use pricing model `PMP`. */
18
+ pricingModel: WhatsAppPricingModel;
13
19
  billable?: boolean;
14
20
  }
15
21
  export interface WhatsAppMessageStatus {
@@ -19,6 +25,8 @@ export interface WhatsAppMessageStatus {
19
25
  timestamp: string;
20
26
  conversation?: ConversationRef;
21
27
  pricing?: PricingRef;
28
+ /** WATS-98 Graph wire `message_status`: `accepted`, `held_for_quality_assessment`, or `paused`. */
29
+ messageStatus?: WhatsAppMarketingMessageStatus;
22
30
  errors?: WhatsAppError[];
23
31
  raw?: unknown;
24
32
  }
package/dist/webhook.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { WhatsAppError, WhatsAppErrorPayload } from "./errors";
2
- import type { WhatsAppContact } from "./contacts";
3
- import type { WhatsAppMessage } from "./messages/union";
4
- import type { WhatsAppMessageStatus } from "./statuses";
1
+ import type { WhatsAppError, WhatsAppErrorPayload } from "./errors.js";
2
+ import type { WhatsAppContact } from "./contacts.js";
3
+ import type { WhatsAppMessage } from "./messages/union.js";
4
+ import type { WhatsAppMessageStatus } from "./statuses.js";
5
5
  export interface WhatsAppWebhookEnvelope {
6
6
  object: string;
7
7
  entry: WhatsAppWebhookEntry[];
@@ -50,6 +50,48 @@ export interface WhatsAppAccountReviewUpdateValue {
50
50
  decision: string;
51
51
  raw?: unknown;
52
52
  }
53
+ export interface WhatsAppAccountUpdateValue {
54
+ event?: string;
55
+ disconnectionInfo?: {
56
+ reason?: string;
57
+ partnerId?: string;
58
+ partnerName?: string;
59
+ raw?: unknown;
60
+ };
61
+ /** WATS-95 normalized `phone_number_quality_update` details. */
62
+ phoneNumberQuality?: {
63
+ displayPhoneNumber?: string;
64
+ oldLimit?: string;
65
+ currentLimit?: string;
66
+ maxDailyConversationsPerBusiness?: string;
67
+ raw?: unknown;
68
+ };
69
+ /** WATS-95 normalized `account_alerts.alert_info` details. */
70
+ alert?: {
71
+ entityType?: string;
72
+ entityId?: string;
73
+ severity?: string;
74
+ status?: string;
75
+ type?: string;
76
+ description?: string;
77
+ raw?: unknown;
78
+ };
79
+ /**
80
+ * WATS-98 Marketing Messages onboarding/account-update details. Current Meta
81
+ * docs prefer `marketing_messages_onboarding_status`; the older
82
+ * `marketing_messages_lite_api_status` remains readable but deprecated in docs.
83
+ * Synthetic `account_update` payloads may include events such as
84
+ * `MM_LITE_TERMS_SIGNED`.
85
+ */
86
+ marketingMessages?: {
87
+ wabaId?: string;
88
+ ownerBusinessId?: string;
89
+ onboardingStatus?: string;
90
+ liteApiStatus?: string;
91
+ raw?: unknown;
92
+ };
93
+ raw?: unknown;
94
+ }
53
95
  export interface WhatsAppUserMarketingPreferencesValue {
54
96
  waId: string;
55
97
  category: string;
@@ -86,5 +128,5 @@ export interface WhatsAppRawWebhookValue {
86
128
  * also carries its own `raw` reference so forward compatibility holds
87
129
  * without re-opening the index signature.
88
130
  */
89
- export type WhatsAppWebhookValue = WhatsAppMessagesFieldValue | WhatsAppTemplateStatusUpdateValue | WhatsAppAccountReviewUpdateValue | WhatsAppUserMarketingPreferencesValue | WhatsAppPhoneNumberChangeValue | WhatsAppIdentityChangeValue | WhatsAppRawWebhookValue;
90
- export declare const WATS_TYPES_WEBHOOK_EXPORTS: readonly ["WhatsAppWebhookEnvelope", "WhatsAppWebhookEntry", "WhatsAppWebhookChange", "WhatsAppWebhookValue"];
131
+ export type WhatsAppWebhookValue = WhatsAppMessagesFieldValue | WhatsAppAccountUpdateValue | WhatsAppTemplateStatusUpdateValue | WhatsAppAccountReviewUpdateValue | WhatsAppUserMarketingPreferencesValue | WhatsAppPhoneNumberChangeValue | WhatsAppIdentityChangeValue | WhatsAppRawWebhookValue;
132
+ export declare const WATS_TYPES_WEBHOOK_EXPORTS: readonly ["WhatsAppWebhookEnvelope", "WhatsAppWebhookEntry", "WhatsAppWebhookChange", "WhatsAppWebhookValue", "WhatsAppAccountUpdateValue"];
package/dist/webhook.js CHANGED
@@ -2,5 +2,6 @@ export const WATS_TYPES_WEBHOOK_EXPORTS = [
2
2
  "WhatsAppWebhookEnvelope",
3
3
  "WhatsAppWebhookEntry",
4
4
  "WhatsAppWebhookChange",
5
- "WhatsAppWebhookValue"
5
+ "WhatsAppWebhookValue",
6
+ "WhatsAppAccountUpdateValue"
6
7
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wats/types",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -48,6 +48,15 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/Switchbord/wats.git",
54
+ "directory": "packages/types"
55
+ },
56
+ "homepage": "https://github.com/Switchbord/wats#readme",
57
+ "bugs": {
58
+ "url": "https://github.com/Switchbord/wats/issues"
59
+ },
51
60
  "keywords": [
52
61
  "whatsapp",
53
62
  "whatsapp-cloud-api",